Improve gdb.threads/attach-many-short-lived-threads.exp timeout handling
authorPedro Alves <palves@redhat.com>
Fri, 6 Feb 2015 12:24:32 +0000 (13:24 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 6 Feb 2015 12:24:32 +0000 (13:24 +0100)
commite584fdbc6a9b0da786c5a55855f9fd9f7e676198
tree2425480a6d835fd3de665398000174b1ebbec53f
parent8490fb409a37072389da7cafc3a92255e9a34c98
Improve gdb.threads/attach-many-short-lived-threads.exp timeout handling

The buildbot shows that this test is still racy, and occasionally
fails with time outs on some machines.  I'd like to get major issues
with load out of the way.

The test currently exits after 180s, which is just a random number,
that has no relation to what the .exp file considers a time out.  This
commit makes the program wait a bit longer than what the .exp file
considers a time out, and, resets the timer for each iteration.

Tested on x86_64 Fedora 20, native and extended-remote gdbserver.

gdb/testsuite/
2015-02-06  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-many-short-lived-threads.c (SECONDS): New
macro.
(seconds_left, again): New globals.
(main): Wait seconds_left in a 1-second sleep loop instead of
sleeping 180 seconds.  If 'again' is set, reset the seconds
counter.
* gdb.threads/attach-many-short-lived-threads.exp (test): Set
'again' in the inferior before detaching.  Print the seconds left.
(options): New global.
(top level): Build program with -DTIMEOUT=$timeout.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.threads/attach-many-short-lived-threads.c
gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp