# HG changeset patch # User Matt Harbison # Date 2024-10-08 05:06:57 # 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 --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -523,29 +523,15 @@ Test debuglocks command: * 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 @@ amount of time, displays error message a * 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 @@ amount of time, displays error message a * 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 @@ amount of time, displays error message a * 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 @@ amount of time, displays error message a * Test forcing the wlock $ dolock -S & - $ waitlock .hg/wlock + $ "$RUNTESTDIR/testlib/wait-on-file" 5 .hg/wlock $ hg debuglocks lock: free