From: Tom de Vries Date: Fri, 25 Oct 2024 04:14:03 +0000 (+0200) Subject: [gdb/testsuite] Fix some test-cases for check-read1 (pipe/grep) X-Git-Tag: gdb-16-branchpoint~600 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c593605f5f674b8a3c6252f246205ae74e4eb939;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix some test-cases for check-read1 (pipe/grep) I ran the testsuite in an environment simulating a stressed system in combination with check-read1. This exposes a few more FAILs. Fix some by using pipe / grep to filter out unnecessary output. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp index b0a51961870..21cc7ff5133 100644 --- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp +++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp @@ -43,7 +43,7 @@ proc probe_target_hardware_step {} { gdb_test_no_output "set debug target 1" set test "probe target hardware step" - gdb_test_multiple "si" $test { + gdb_test_multiple "pipe si | grep resume" $test { -re "resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" { set hw_step 1 pass $test diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index babfa285c94..0d39d04bc87 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -87,9 +87,20 @@ if {[lsearch -exact $show_charset $show_host_charset] >= 0} { } # Try a malformed `set charset'. -gdb_test "set charset" \ - "Requires an argument. Valid arguments are.*" \ - "try malformed `set charset'" +set cmd "set charset" +set ok 0 +gdb_test_multiple $cmd "try malformed `set charset'" { + -re "^$cmd\r\nRequires an argument. Valid arguments are " { + set ok 1 + exp_continue + } + -re ", " { + exp_continue + } + -re -wrap "" { + gdb_assert { $ok } $gdb_test_name + } +} # Try using `set host-charset' on an invalid character set. gdb_test "set host-charset my_grandma_bonnie" \ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index f4f102a156b..dc3c8b1dfc8 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -266,7 +266,10 @@ proc corefile_test_run {} { clean_restart $::binfile gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again" - gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file" + set re "Local core dump file:" + gdb_test "pipe info files | grep \"$re\"" \ + "Local core dump file:" \ + "run: sanity check we see the core file" set test "run: with core" if [runto_main] { @@ -276,11 +279,12 @@ proc corefile_test_run {} { } set test "run: core file is cleared" - gdb_test_multiple "info files" $test { - -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { + set re "Local core dump file:" + gdb_test_multiple "pipe info files | grep \"$re\"" $test { + -re -wrap $re { fail $test } - -re "\r\n$gdb_prompt $" { + -re -wrap "" { pass $test } } @@ -349,11 +353,12 @@ proc corefile_test_attach {} { gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core" set test "attach: core file is cleared" - gdb_test_multiple "info files" $test { - -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { + set re "Local core dump file:" + gdb_test_multiple "pipe info files | grep \"$re\"" $test { + -re -wrap $re { fail $test } - -re "\r\n$gdb_prompt $" { + -re -wrap "" { pass $test } } diff --git a/gdb/testsuite/gdb.base/osabi.exp b/gdb/testsuite/gdb.base/osabi.exp index 9bbfff52bae..4fd267bdbf4 100644 --- a/gdb/testsuite/gdb.base/osabi.exp +++ b/gdb/testsuite/gdb.base/osabi.exp @@ -24,7 +24,8 @@ require !gdb_debug_enabled proc test_set_osabi_none { } { clean_restart gdb_test_no_output "set debug arch 1" - gdb_test "set osabi none" ".*gdbarch_find_by_info: info.osabi 1 \\(none\\).*" + gdb_test "pipe set osabi none | grep gdbarch_find_by_info" \ + ".*gdbarch_find_by_info: info.osabi 1 \\(none\\).*" } test_set_osabi_none diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp index 773afa793a0..226a756c765 100644 --- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp +++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp @@ -64,7 +64,7 @@ delete_breakpoints gdb_test_no_output "set debug target 1" set hardware_step 0 set test "probe target hardware step" -gdb_test_multiple "si" $test { +gdb_test_multiple "pipe si | grep resume" $test { -re "resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" { set hardware_step 1 pass $test diff --git a/gdb/testsuite/gdb.threads/corethreads.exp b/gdb/testsuite/gdb.threads/corethreads.exp index dfaca828a45..41759486046 100644 --- a/gdb/testsuite/gdb.threads/corethreads.exp +++ b/gdb/testsuite/gdb.threads/corethreads.exp @@ -35,8 +35,10 @@ if {$corefile == ""} { clean_restart $executable gdb_test "core-file $corefile" "Core was generated by .*" "load core" -gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "sanity check we see the core file" - +set re "Local core dump file:" +gdb_test "pipe info files | grep \"$re\"" \ + $re \ + "sanity check we see the core file" set test "print pthread_t of thread0" gdb_test_multiple "p/x thread0" $test { -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {