This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] gdb.cp/static-print-quit.exp: fix racy tests (PR testsuite/12649)
- From: Marek Polacek <mpolacek at redhat dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 05 May 2011 20:03:32 +0200
- Subject: [RFC] gdb.cp/static-print-quit.exp: fix racy tests (PR testsuite/12649)
This test fails with Jan's read1() with:
ERROR: Window too small.
UNRESOLVED: gdb.cp/static-print-quit.exp: print c
This is because we expect to read:
"...Type <return> to continue, or q <return> to quit---$"
However, when using read1(), the "<return>" part matches with
this snippet from lib/gdb.exp:
"<return>" {
send_gdb "\n"
perror "Window too small."
fail "$message"
...
We can prevent this if we, in our gdb_test_multiple, create a "<return>"
case with `exp_continue'. Nonetheless, except this, we must also in this
case:
-re " to quit---$" {
fail $test
return -1
}
differentiate between success and failure, since after processing the "<return>"
part we now have in the buffer " to quit---". Thus, it is possible to do
something like this, using a new variable `seen_return', although I must say, I don't
like it at all. But I don't see any other way how to cure this (at least yet) without
modifying the lib/gdb.exp. Ran the test with both read{,1}. Comments or complaints, please?
set test "print c"
set seen_return 0
gdb_test_multiple $test $test {
"<return>" {
incr seen_return
exp_continue
}
-re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type " {
incr seen_return
exp_continue
}
-re " to continue, or q " {
incr seen_return
exp_continue
}
-re " to quit---$" {
if { $seen_return >= 2 } {
pass $test
} else {
fail $test
return -1
}
}
}
Thanks,
Marek