]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp
authorTom de Vries <tdevries@suse.de>
Fri, 16 Dec 2022 14:28:27 +0000 (15:28 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 16 Dec 2022 14:28:27 +0000 (15:28 +0100)
commit832a980e1725a4a7fa527f2dcd92a64d7e68ab0f
treee9b093bcdef66a36b675874c42cd25e9bb38febe
parentc3efaf0afd9d37004c42cdfd3ce0c1bfa979c45e
[gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp

Once in a while I run into:
...
FAIL: gdb.threads/detach-step-over.exp: \
  breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \
  displaced=off: iter 1: all threads running
...

In can easily reproduce this by doing:
...
     # Wait a bit, to give time for the threads to hit the
     # breakpoint.
-    sleep 1

     return true
...

Fix this by counting the running threads in a loop, effectively allowing 10
seconds (instead of 1) for the threads to start running, but only sleeping if
needed.

Reduces total execution time from 1m27s to 56s.

Tested on x86_64-linux.
gdb/testsuite/gdb.threads/detach-step-over.exp