re2: Skip upstream's big tests in ptest under QEMU

The CMake build registers every test with ctest, including the ones
upstream's Makefile keeps in BIGTESTS (and Bazel marks size = "large"),
which "make test" does not run. Each of these runs silently until it
finishes, and under qemu emulation several of them take longer than the
ptest-runner timeout. On qemuriscv64, dfa_test stalled in
Multithreaded.SearchDFA until ptest-runner killed the whole suite after
450s. Under qemu-user, exhaustive3_test takes ~460s, random_test ~760s,
and dfa_test more than 15 minutes.

Exclude dfa_test, exhaustive*_test and random_test from run-ptest when
running under QEMU, detected at runtime via DMI sys_vendor, a fw-cfg
device tree node or a qemu device tree compatible. Doing this at build
time with a qemuall override would make re2's task signatures differ
between machines sharing a tune. Real hardware still runs all tests.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-10-26 17:04:29 -07:00
1 parent 73c158cd30
commit 3a05256e3b
1 file changed
+18 -1
+18 -1
View File
@@ -1,3 +1,20 @@
#!/bin/sh
ctest --force-new-ctest-process | sed -u 's/\*\*\*/ /g' | awk '/Test +#/{gsub(/Passed/,"PASS"); gsub(/Failed/,"FAIL"); gsub(/Skipped/,"SKIP"); print $6": "$4; fflush();}'
# Running under QEMU (x86 and UEFI arm64 report it via DMI, arm/arm64/riscv
# virt machines have a fw-cfg node, ppc64 pseries a qemu compatible)
is_qemu() {
[ "$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null)" = "QEMU" ] && return 0
for f in /proc/device-tree/fw-cfg@*; do
[ -e "$f" ] && return 0
done
grep -qs qemu /proc/device-tree/compatible
}
# Under QEMU, skip the tests upstream's Makefile lists as BIGTESTS (not run by
# "make test", "size = large" in Bazel); emulated, each of them can run for
# longer than the ptest-runner timeout without printing anything.
if is_qemu; then
set -- -E '^(dfa|exhaustive[0-9]*|random)_test$'
fi
ctest --force-new-ctest-process "$@" | sed -u 's/\*\*\*/ /g' | awk '/Test +#/{gsub(/Passed/,"PASS"); gsub(/Failed/,"FAIL"); gsub(/Skipped/,"SKIP"); print $6": "$4; fflush();}'