# HG changeset patch # User Matt Harbison # Date 1728364017 14400 # Node ID f0bee30af890abe02002eb3a78fc917011074ba8 # Parent 4b347e9429e7f2127d27ac904cc979bec9d38061 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. diff -r 4b347e9429e7 -r f0bee30af890 tests/test-debugcommands.t --- 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 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