]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix some test-cases for check-read1 (pipe/grep)
authorTom de Vries <tdevries@suse.de>
Fri, 25 Oct 2024 04:14:03 +0000 (06:14 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 25 Oct 2024 04:14:03 +0000 (06:14 +0200)
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.

gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
gdb/testsuite/gdb.base/charset.exp
gdb/testsuite/gdb.base/corefile.exp
gdb/testsuite/gdb.base/osabi.exp
gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
gdb/testsuite/gdb.threads/corethreads.exp

index b0a51961870edd81865c5e75c290e215bb362b36..21cc7ff51339feda3ab6b653527381e114a0e466 100644 (file)
@@ -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
index babfa285c943ef76aef6bd4bc266eee855797a75..0d39d04bc87656acb06ef85f8fb0cc42c45ef2f0 100644 (file)
@@ -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" \
index f4f102a156bcb63601a9c704a3944e36d3a7abfc..dc3c8b1dfc85d3f6846b9f863d18950fcc976331 100644 (file)
@@ -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
            }
        }
index 9bbfff52bae8564f25f7d07847878473bb78ae4d..4fd267bdbf47a0a568fa7d1df66604b2c4c4b10c 100644 (file)
@@ -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
index 773afa793a069c515c36f378c62568fbea75d37f..226a756c765c940cbf9ba1bc6599327183d10a4d 100644 (file)
@@ -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
index dfaca828a4552d9d868fcbaf3dac3ea52266c1d8..417594860462f517e145a39017e645a210a48018 100644 (file)
@@ -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 $" {