[4/5,gdb/testsuite] Fix gdb.threads/ia64-sigill.exp with check-read1

Message ID 20241010072510.25545-4-tdevries@suse.de
State Committed
Headers
Series [1/5,gdb/testsuite] Fix some test-cases for check-read1 (gdb_test_lines) |

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-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries Oct. 10, 2024, 7:25 a.m. UTC
  Fix test-case gdb.threads/ia64-sigill.exp with make target check-read1 by
using a custom line-by-line exp_continue clause:
...
    -re "\r\n\[^\r\n\]*(?=\r\n\[^\r\n\]*\r\n)" {
	exp_continue
    }
...
which drops a line each time it finds two lines in the buffer.

This allows the other clauses to use two-line patterns.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.threads/ia64-sigill.exp | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.exp b/gdb/testsuite/gdb.threads/ia64-sigill.exp
index 05f998244f6..79233ee3bee 100644
--- a/gdb/testsuite/gdb.threads/ia64-sigill.exp
+++ b/gdb/testsuite/gdb.threads/ia64-sigill.exp
@@ -58,20 +58,35 @@  gdb_test_no_output "set debug infrun 1"
 # The ia64 SIGILL signal is visible only in the linux-nat debug output.
 
 set prompt "$gdb_prompt \\\[infrun\\\] fetch_inferior_event: exit\r\n$"
+set ok 0
 gdb_test_multiple "continue" "continue" -prompt $prompt {
-    -re "Breakpoint \[0-9\]+,( .* in)? thread_func .*$prompt$" {
-	pass $gdb_test_name
+    -re "Breakpoint \[0-9\]+,( \[^\r\n\]+ in)? thread_func \[^\r\n\]+" {
+	set ok 1
+	exp_continue
+    }
+    -re -wrap "" {
+	gdb_assert { $ok } $gdb_test_name
+    }
+    -re "\r\n\[^\r\n\]*(?=\r\n\[^\r\n\]*\r\n)" {
+	exp_continue
     }
 }
 
 gdb_test_no_output {delete $sigill_bpnum}
 
+set ok 0
 gdb_test_multiple "continue" "continue for the pending signal" -prompt $prompt {
-    -re "Breakpoint \[0-9\]+, .*break-at-exit.*\r\n$prompt$" {
+    -re "Breakpoint \[0-9\]+, .*break-at-exit" {
 	# Breakpoint has been skipped in the other thread.
-	pass $gdb_test_name
+	set ok 1
     }
     -re " received signal .*\r\n$gdb_prompt $" {
 	fail $gdb_test_name
     }
+    -re -wrap "" {
+	gdb_assert { $ok } $gdb_test_name
+    }
+    -re "\r\n\[^\r\n\]*(?=\r\n\[^\r\n\]*\r\n)" {
+	exp_continue
+    }
 }