Skip to content

Commit 27f5987

Browse files
committed
Make btest-bg-run delay configurable
Allow users to remove the unconditional sleep 1 by introducing a new environment variable BTEST_BG_RUN_SLEEP that specifies the amount of seconds to sleep. If tests are written robustly, setting this to 0 can speed up execution of btest-bg-run heavy test suites. Keep the 1 second delay by default as existing test suites may unknowingly rely on it.
1 parent e55c0db commit 27f5987

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

btest-bg-run

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# and spawns <cmdline> in there in the background. It also records
77
# a set of meta information that btest-bg-wait will read.
88

9+
# Sleep this many seconds after creating the process and before
10+
# returning from btest-bg-run.
11+
BTEST_BG_RUN_SLEEP=${BTEST_BG_RUN_SLEEP:-1}
12+
913
if [ "$#" -le 1 ]; then
1014
echo "usage: $(basename "$0") <tag> <cmdline>"
1115
exit 1
@@ -33,4 +37,4 @@ echo "$@" >.cmdline
3337

3438
$setsid "$helper" "$@" >.stdout 2>.stderr &
3539

36-
sleep 1
40+
sleep "$BTEST_BG_RUN_SLEEP"

0 commit comments

Comments
 (0)