[gdb/testsuite] Fix some gdb.dwarf2 test-cases for check-read1

Message ID 20241009113715.19491-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Fix some gdb.dwarf2 test-cases for check-read1 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Tom de Vries Oct. 9, 2024, 11:37 a.m. UTC
  I ran the testsuite in an environment simulating a stressed system in
combination with check-read1.  This exposes a few more FAILs.

Fix the gdb.dwarf2 ones by using pipe / grep to filter out unnecessary output.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp | 3 ++-
 gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp  | 3 ++-
 gdb/testsuite/gdb.dwarf2/gdb-index.exp              | 8 +++++++-
 gdb/testsuite/gdb.dwarf2/pr13961.exp                | 3 ++-
 gdb/testsuite/gdb.dwarf2/self-spec.exp              | 4 ++--
 5 files changed, 15 insertions(+), 6 deletions(-)


base-commit: 2ae9b1b2d7e5feb0fd734f91250fc5dd187767a5
  

Comments

Tom Tromey Oct. 9, 2024, 4:28 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> I ran the testsuite in an environment simulating a stressed system in
Tom> combination with check-read1.  This exposes a few more FAILs.

Tom> Fix the gdb.dwarf2 ones by using pipe / grep to filter out unnecessary output.

Tom> -    gdb_test "maint print objfiles" "$eol$ws+qualified:$ws+ns::v$eol.*" \
Tom> +    gdb_test "pipe maint print objfiles | grep ns::v" \
Tom> +	"$ws+qualified:$ws+ns::v" \

Does the test suite already assume that the test host has grep
available?

If so then this seems fine, but if not it means that this is adding a
new dependency.

Tom
  
Tom de Vries Oct. 10, 2024, 5:21 a.m. UTC | #2
On 10/9/24 18:28, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> I ran the testsuite in an environment simulating a stressed system in
> Tom> combination with check-read1.  This exposes a few more FAILs.
> 
> Tom> Fix the gdb.dwarf2 ones by using pipe / grep to filter out unnecessary output.
> 
> Tom> -    gdb_test "maint print objfiles" "$eol$ws+qualified:$ws+ns::v$eol.*" \
> Tom> +    gdb_test "pipe maint print objfiles | grep ns::v" \
> Tom> +	"$ws+qualified:$ws+ns::v" \
> 
> Does the test suite already assume that the test host has grep
> available?
> 
> If so then this seems fine, but if not it means that this is adding a
> new dependency.

Hi Tom,

thanks for the review.

This seems to be present in 3 other test-cases:
...
$ find gdb/testsuite/gdb.* -type f -name *.exp* | grep -v sigrepeat | 
xargs grep grep
gdb/testsuite/gdb.base/shreloc.exp:    send_gdb "shell grep -E \" 
${var}(\[ \t\]+.*)?\$\" ${msymfile}\n"
gdb/testsuite/gdb.base/maint.exp:	gdb_test_multiple "shell grep 
'main.*function' $psymbols_output" "" {
gdb/testsuite/gdb.base/maint.exp:gdb_test "shell grep factorial 
$msymbols_output" \
gdb/testsuite/gdb.base/maint.exp:gdb_test "shell grep factorial 
$msymbols_output" \
gdb/testsuite/gdb.base/maint.exp:    gdb_test "shell grep 'main(.*block' 
$symbols_output"\
gdb/testsuite/gdb.base/shell.exp:gdb_test "pipe foo truc2 | grep truc | 
wc -l" "2" "double pipe"
gdb/testsuite/gdb.base/shell.exp:gdb_test "| foo truc2 | grep truc | wc 
-l" "2" "double pipe, pipe char"
gdb/testsuite/gdb.base/shell.exp:gdb_test "|foo|grep truc|wc -l" "1" "no 
space around pipe char"
...

So, I'll go ahead and commit this.

Thanks,
- Tom
  

Patch

diff --git a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
index 59b3db50dbb..2f41db97841 100644
--- a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
@@ -98,6 +98,7 @@  foreach_with_prefix worker_threads $worker_threads_list {
 
     gdb_load $binfile
 
-    gdb_test "maint print objfiles" "$eol$ws+qualified:$ws+ns::v$eol.*" \
+    gdb_test "pipe maint print objfiles | grep ns::v" \
+	"$ws+qualified:$ws+ns::v" \
 	"v has parent ns"
 }
diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
index d8367b0a162..b734c309f9c 100644
--- a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
@@ -98,6 +98,7 @@  foreach_with_prefix worker_threads $worker_threads_list {
 
     gdb_load $binfile
 
-    gdb_test "maint print objfiles" "$eol$ws+qualified:$ws+ns::v$eol.*" \
+    gdb_test "pipe maint print objfiles | grep ns::v" \
+	"$ws+qualified:$ws+ns::v" \
 	"v has parent ns"
 }
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 4e442278f9b..23d60da6a53 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -95,7 +95,13 @@  proc local_add_gdb_index { program } {
 # building an index from a program already using one.
 
 set test "check if index present"
-gdb_test_multiple "mt print objfiles ${testfile}" $test {
+set filter "gdb_index|debug_names|Psymtabs|Cooked"
+set cmd "pipe mt print objfiles ${testfile} | grep -E \"$filter\""
+set cmd_re [string_to_regexp $cmd]
+gdb_test_multiple $cmd $test {
+    -re ^$cmd_re {
+	exp_continue
+    }
     -re "gdb_index.*${gdb_prompt} $" {
 	set binfile_with_index $binfile
 	set host_binfile_with_index [gdb_remote_download host $binfile]
diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.exp b/gdb/testsuite/gdb.dwarf2/pr13961.exp
index a306c45a125..e4ea9d0f8c0 100644
--- a/gdb/testsuite/gdb.dwarf2/pr13961.exp
+++ b/gdb/testsuite/gdb.dwarf2/pr13961.exp
@@ -36,7 +36,8 @@  gdb_test "break -q main" "Breakpoint.*at.*"
 pass $testfile
 
 # Regression test for PR symtab/30739.
-gdb_test_multiple "maint print objfiles $binfile" "no foo::foo" {
+set cmd "pipe maint print objfiles $binfile | grep foo::foo"
+gdb_test_multiple $cmd "no foo::foo" {
     -re -wrap "\r\n *qualified: *foo::foo\r\n.*" {
 	fail $gdb_test_name
     }
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
index 2e8fe6b3933..9bb4064874f 100644
--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
@@ -59,8 +59,8 @@  require {string eq $index ""}
 
 require !readnow
 
-gdb_test "maint print objfiles $testfile" \
-    "\r\n *qualified: *c1\r\n.*" \
+gdb_test "pipe maint print objfiles $testfile | grep c1" \
+    " *qualified: *c1" \
     "class c1 in cooked index"
 
 gdb_test "maint expand-symtabs"