aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-11-09 22:44:08 +0000
committerPedro Alves <palves@redhat.com>2017-11-09 22:44:08 +0000
commitf29f4b6ba198674096fddf2aa38fa8d028d387b2 (patch)
tree4b61dc9175c6bfd4a0fb713754ff7796b50e2364
parentfb24d531e9ef7ad7831ca62298d21684717cbe38 (diff)
downloadgdb-f29f4b6ba198674096fddf2aa38fa8d028d387b2.zip
gdb-f29f4b6ba198674096fddf2aa38fa8d028d387b2.tar.gz
gdb-f29f4b6ba198674096fddf2aa38fa8d028d387b2.tar.bz2
Fix racy output matching in gdb.asm/asm-source.exp
Testing with: $ make check-read1 TESTS="gdb.asm/asm-source.exp" Exposes a testcase bug that can result in racy fails: (gdb) PASS: gdb.asm/asm-source.exp: next over foo3 return Make selected stack frame return now? (y or n) y n #0 main () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.asm/asmsrc1.s:53 53 gdbasm_exit0 (gdb) FAIL: gdb.asm/asm-source.exp: return from foo2 (got interactive prompt) n The problem is that the "return now\?.*" regex can match partial output like this: "Make selected stack frame return no" and then we send the 'y' too early, and then the next time around we hit gdb_test_multiple's internal "got interactive prompt" regex. Also, note we match "return no" instead of "return now" because the regex is missing one quote level. gdb/testsuite/ChangeLog: 2017-11-09 Pedro Alves <palves@redhat.com> * gdb.asm/asm-source.exp ("kill" test): Match the whole query output. Fix '?' match.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 15c0caf..8566dc1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-09 Pedro Alves <palves@redhat.com>
+
+ * gdb.asm/asm-source.exp ("kill" test): Match the whole query
+ output. Fix '?' match.
+
2017-11-08 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/scoped_watch: New testcase.
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 138609a..47717a2 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -435,7 +435,7 @@ gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
# Like "finish", "return" command also can return to the caller
# line again or the statement after, depending on the architecture.
gdb_test_multiple "return" "return from foo2" {
- -re "Make (foo2|selected stack frame) return now\?.*" {
+ -re "Make (foo2|selected stack frame) return now\\? .y or n. " {
send_gdb "y\n"
exp_continue
}