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

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.
This commit is contained in:
Tom de Vries
2024-10-10 07:46:06 +02:00
parent 1f0bc051ac
commit cc72ea8235
5 changed files with 15 additions and 6 deletions

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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]

View File

@@ -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
}

View File

@@ -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"