./test.sh with no -n/-m runs the suite as: (1) non-flaky tests under -n10 (~25s), (2) flaky-marked tests serially (~35s); either phase failing fails the run (~60s total vs ~160s serial before). Explicit -n/-m flags keep the old single-phase passthrough behavior (./test.sh -n0 forces serial). The -m override in phase 2 restates 'not fuzz' since command-line -m replaces pytest.ini's -m.
45 lines
1.3 KiB
Bash
Executable file
45 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# Test runner: ./test.sh [pytest args].
|
|
#
|
|
# Default (no -n/-m given) is the full gate in two phases:
|
|
# 1. non-flaky tests in parallel (-n10, ~25s here);
|
|
# 2. flaky-marked tests serially (~35s; they need a quiet box).
|
|
# Either phase failing fails the run. Workers are isolated (unique logs,
|
|
# per-session KICK_DUMP_DIR, pid-unique sockets).
|
|
#
|
|
# Explicit -n/-m opts pass straight through as a single phase, e.g.
|
|
# ./test.sh -n4, ./test.sh -m flaky, ./test.sh -n0 -k foo (serial).
|
|
# -n10 needs a box that can take it: 20 concurrent compositors have been
|
|
# seen to kill a desktop session, so -n10 (not -n20) is the default.
|
|
|
|
|
|
set -e
|
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
has_parallel_opt=false
|
|
has_mark_opt=false
|
|
prev=""
|
|
for a in "$@"; do
|
|
if [ "$prev" = "-n" ]; then
|
|
has_parallel_opt=true
|
|
fi
|
|
case "$a" in
|
|
-n[0-9]*|--numprocesses*) has_parallel_opt=true ;;
|
|
-n) has_parallel_opt=true ;;
|
|
-m) has_mark_opt=true ;;
|
|
esac
|
|
prev="$a"
|
|
done
|
|
|
|
if ! $has_parallel_opt && ! $has_mark_opt; then
|
|
rc=0
|
|
pytest -v -n10 "$@" || rc=$?
|
|
# Command-line -m replaces pytest.ini's -m, so restate `not fuzz`:
|
|
# the fuzz tests (real programs) stay excluded from both phases.
|
|
pytest -v -m "flaky and not fuzz" "$@" || rc=$?
|
|
exit $rc
|
|
fi
|
|
|
|
exec pytest -v "$@"
|