Files
RetroArch/.github/workflows/scripts/run-parallel.sh
LibretroAdmin 8360f25509 CI: run the slow audio samples' real-time lanes at once
Three steps of Linux-samples-audio took six minutes between them, and
two of them spent it waiting: pipeline_rate_control's eight runs and
pipeline_clocked's fill cap lanes are seconds of audio each against a
device that drains in real time, on almost no CPU, run one after
another.

.github/workflows/scripts/run-parallel.sh starts commands at once and,
when all are done, prints each one's output in order with a pass or
FAIL line, failing the step if any failed. The rate control step builds
its ASan and TSan binaries in turn and runs all eight at once; the fill
cap step runs its five lanes at once, pipeline_clocked_test taking
PACED_ONLY=<lane> to run one (PACED_ONLY=1 still runs them all).
discrete_multichannel_test is CPU-bound - most of it building Kaiser
tables - so it is now built at -O1 instead of -O0, and its plain and
ASan runs share the runner's cores.

Measured on two cores: pipeline_rate_control 162 -> 33 s of runs, the
fill cap lanes 116 -> 36 s, discrete_multichannel 87 -> 40 s. Each new
arrangement passed three times in a row there.
2026-11-03 01:59:17 +01:00

36 lines
1.1 KiB
Bash

# Sourced by a step: runs commands at the same time, for tests that wait
# on a real clock and use next to no CPU, so the step takes as long as
# the longest of them rather than all of them in a row.
#
# par "name" command args... start one, its output kept apart
# par_wait wait for all; print each one's output in
# the order started, and fail the step if
# any of them failed
par_names=""
par_pids=""
par_dir=$(mktemp -d)
par() {
name="$1"; shift
"$@" > "$par_dir/$(echo "$name" | tr ' /' '__').log" 2>&1 &
par_pids="$par_pids $!"
par_names="$par_names|$name"
}
par_wait() {
bad=0
set -- $par_pids
old_ifs=$IFS; IFS='|'; names=${par_names#|}; IFS=$old_ifs
while [ $# -gt 0 ]; do
name=${names%%|*}; names=${names#*|}
if wait "$1"; then status=pass; else status=FAIL; bad=1; fi
echo "== $name"
cat "$par_dir/$(echo "$name" | tr ' /' '__').log"
echo "[$status] $name"
shift
done
rm -rf "$par_dir"
par_names=""; par_pids=""; par_dir=$(mktemp -d)
return $bad
}