Mercurial > hg-stable
changeset 52021:f0bee30af890
tests: replace inline `waitlock()` with `wait-on-file` script
The latter scales up the timeout based on the timeout value provided to the test
runner, and I was seeing timeouts on Windows when running all of the tests using
all CPU cores.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 08 Oct 2024 01:06:57 -0400 |
parents | 4b347e9429e7 |
children | 71658f79758a |
files | tests/test-debugcommands.t |
diffstat | 1 files changed, 7 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-debugcommands.t Mon Oct 07 21:48:36 2024 -0400 +++ b/tests/test-debugcommands.t Tue Oct 08 01:06:57 2024 -0400 @@ -523,29 +523,15 @@ * Test setting the lock -waitlock <file> will wait for file to be created. If it isn't in a reasonable -amount of time, displays error message and returns 1 - $ waitlock() { - > start=`date +%s` - > timeout=5 - > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do - > now=`date +%s` - > if [ "`expr $now - $start`" -gt $timeout ]; then - > echo "timeout: $1 was not created in $timeout seconds" - > return 1 - > fi - > sleep 0.1 - > done - > } $ dolock() { > { - > waitlock .hg/unlock + > "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/unlock > rm -f .hg/unlock > echo y > } | hg debuglocks "$@" > /dev/null > } $ dolock -s & - $ waitlock .hg/store/lock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock $ hg debuglocks lock: user *, process * (*s) (glob) @@ -559,7 +545,7 @@ * Test setting the wlock $ dolock -S & - $ waitlock .hg/wlock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock $ hg debuglocks lock: free @@ -573,7 +559,8 @@ * Test setting both locks $ dolock -Ss & - $ waitlock .hg/wlock && waitlock .hg/store/lock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock $ hg debuglocks lock: user *, process * (*s) (glob) @@ -600,7 +587,7 @@ * Test forcing the lock $ dolock -s & - $ waitlock .hg/store/lock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/store/lock $ hg debuglocks lock: user *, process * (*s) (glob) @@ -619,7 +606,7 @@ * Test forcing the wlock $ dolock -S & - $ waitlock .hg/wlock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock $ hg debuglocks lock: free