Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Add untested case in gdb.gdb/complaints.exp
Date: Fri, 3 Sep 2021 16:40:49 +0200	[thread overview]
Message-ID: <6428cc1d-0291-72d5-f0d6-bc5b5b7a5b27@suse.de> (raw)
In-Reply-To: <89921d12-57b6-5fef-4adf-04ce9d3940e3@polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

[ was: re: [PATCH][gdb/testsuite] Add untested case in selftest_setup ]

On 9/3/21 2:24 PM, Simon Marchi wrote:
> On 2021-09-02 2:13 a.m., Tom de Vries via Gdb-patches wrote:
>> Any comments?
> 
> I don't see what else we could do in this case, so LGTM.
> 

Thanks for the review, pushed.

Also pushed a similar fix for a similar problem in gdb.gdb/complaints.exp.

Thanks,
- Tom


[-- Attachment #2: 0001-gdb-testsuite-Add-untested-case-in-gdb.gdb-complaints.exp.patch --]
[-- Type: text/x-patch, Size: 1729 bytes --]

[gdb/testsuite] Add untested case in gdb.gdb/complaints.exp

When building gdb with "-Wall -O2 -g -flto=auto", I run into:
...
(gdb) call clear_complaints()^M
No symbol "clear_complaints" in current context.^M
(gdb) FAIL: gdb.gdb/complaints.exp: clear complaints
...

The problem is that lto has optimized away clear_complaints, and consequently
the selftests cannot run.

Fix this by:
- using info function to detect presence of clear_complaints
- handling the absence of clear_complaints by calling untested
...
(gdb) UNTESTED: gdb.gdb/complaints.exp: \
  Cannot find clear_complaints, skipping test
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-09-03  Tom de Vries  <tdevries@suse.de>

	* gdb.gdb/complaints.exp: Use untested if clear_complaints cannot
	be found.

---
 gdb/testsuite/gdb.gdb/complaints.exp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index c70825b6623..2391d661250 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -104,6 +104,26 @@ proc test_empty_complaint { cmd msg } {
 }
 
 proc test_empty_complaints { } {
+    global decimal
+
+    set re [multi_line \
+		"All functions matching regular expression \[^:\]*:" \
+		"" \
+		"File \[^\r\n\]*/complaints\\.c:" \
+		"$decimal:\tvoid clear_complaints\\(\\);"]
+
+    set found 0
+    gdb_test_multiple "info function ^clear_complaints()$" "" {
+	-re -wrap $re {
+	    set found 1
+	}
+	-re -wrap "" {
+	}
+    }
+    if { ! $found } {
+	untested "Cannot find clear_complaints, skipping test"
+	return 0
+    }
 
     test_empty_complaint "call clear_complaints()" \
 	    "clear complaints"

      reply	other threads:[~2021-09-03 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  6:13 [PATCH][gdb/testsuite] Add untested case in selftest_setup Tom de Vries via Gdb-patches
2021-09-03 12:24 ` Simon Marchi via Gdb-patches
2021-09-03 14:40   ` Tom de Vries via Gdb-patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6428cc1d-0291-72d5-f0d6-bc5b5b7a5b27@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox