Skip to content

Commit 9aa835e

Browse files
authored
fix: attempt to fix test_engine hang (#20292)
as title
2 parents 3155a9f + e2e051b commit 9aa835e

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

bootstrap.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,6 @@ function start_txes {
257257

258258
export test_cmds_file="/tmp/test_cmds"
259259

260-
function test_engine_start {
261-
# This trickery is to overcome an oddity in parallel.
262-
# Turns out when we hold an open pipe to parallel, like we do using tail below,
263-
# parallel will only process the result of job N when it receives a new job *after* job N has completed.
264-
# This can prevent a "fail fast" situation, or prevent the results from the first batch of commands from showing up.
265-
# Empty commands fed to run_test_cmd are no-ops, so we keep parallel processing results in timely fashion with this.
266-
while ! grep -Eq '^STOP$' $test_cmds_file; do sleep 5; echo | atomic_append $test_cmds_file; done &
267-
# Continuously stream the test cmds into parallelize.
268-
DENOISE=0 parallelize < <(tail -n+0 -f $test_cmds_file)
269-
}
270-
export -f test_engine_start
271-
272260
function prep {
273261
pull_submodules
274262
check_toolchains
@@ -289,7 +277,7 @@ function build_and_test {
289277
rm -f $test_cmds_file
290278
touch $test_cmds_file
291279
# put it in it's own process group, we can terminate on cleanup.
292-
setsid color_prefix "test-engine" "denoise test_engine_start" &
280+
setsid color_prefix "test-engine" "denoise \"test_engine $test_cmds_file\"" &
293281
test_engine_pid=$!
294282
test_engine_pgid=$(ps -o pgid= -p $test_engine_pid)
295283
echo "Started test engine with $test_engine_pid in PGID $test_engine_pgid."

ci3/test_engine

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Starts a little engine that pipes the commands in the given file into parallelize.
3+
# Will keep running until the command file is fed STOP.
4+
NO_CD=1 source $(git rev-parse --show-toplevel)/ci3/source
5+
6+
test_cmds_file=$1
7+
8+
# This trickery is to overcome an oddity in parallel.
9+
# Turns out when we hold an open pipe to parallel, like we do using tail below,
10+
# parallel will only process the result of job N when it receives a new job *after* job N has completed.
11+
# This can prevent a "fail fast" situation, or prevent the results from the first batch of commands from showing up.
12+
# Empty commands fed to run_test_cmd are no-ops, so we keep parallel processing results in timely fashion with this.
13+
while ! grep -Eq '^STOP$' $test_cmds_file; do sleep 5; echo | atomic_append $test_cmds_file; done &>/dev/null &
14+
# Continuously stream the test cmds into parallelize.
15+
DENOISE=0 parallelize < <(tail -n+0 -f $test_cmds_file) 2>/dev/null

0 commit comments

Comments
 (0)