DF-2318 / run_matrix.sh
#!/bin/sh # run_matrix.sh -- A/B fix matrix: baseline + one variant per fix, each fix # applied ONLY to a patched copy of the pristine extraction source. # # Every variant runs every scenario; a correct fix flips exactly its own # finding's scenarios and leaves all others (incl. negative controls) # untouched. # # Usage: sh run_matrix.sh [workdir] set -eu cd "$(dirname "$0")" W="${1:-matrix}" ROOT="$(pwd)" SCEN="no_vers1_devadded no_vers1_nomatch no_vers1_sysctl vers1_pnpinfo_ok busypanic reentry_leak benign_cycle" rm -rf "$W" mkdir -p "$W" for V in baseline f2318 f5355 f5356; do D="$ROOT/$W/$V" mkdir -p "$D/src/sys/bus/pccard" "$D/out" cp /usr/src/sys/bus/pccard/*.c /usr/src/sys/bus/pccard/*.h "$D/src/sys/bus/pccard/" if [ "$V" != baseline ]; then (cd "$D/src" && patch -p1 < "$ROOT/fixes/d$V.diff") > "$D/patch.log" 2>&1 fi cp rig2_main.c rig2_shims.h extract2.sh build.sh "$D/" ( cd "$D" sh build.sh "$D/src/sys" --allow-patched > build.log 2>&1 || { echo "VARIANT $V BUILD FAILED"; tail -30 build.log; exit 1; } for S in $SCEN; do ./rig2 "$S" > "out/$S.log" 2>&1 || true done ) echo "variant $V: built and run" done echo echo "=== matrix summary (exit code / fault marker) ===" printf "%-22s %-18s %-18s %-18s %-18s\n" scenario baseline f2318 f5355 f5356 for S in $SCEN; do printf "%-22s" "$S" for V in baseline f2318 f5355 f5356; do L="$W/$V/out/$S.log" if [ ! -f "$L" ]; then R="NO_LOG"; else R=$(grep -o 'RIG KERNEL PANIC:.*' "$L" | head -1 | cut -c1-24) [ -z "$R" ] && R=$(grep -o 'RIG SIGSEGV.*' "$L" | head -1 | cut -c1-24) [ -z "$R" ] && R="exit $(grep -o 'RESULT .*' "$L" | awk '{print $3}')" fi printf " %-18s" "$R" done echo done echo echo "=== leak/zombie detail per variant (reentry_leak TOTAL line) ===" for V in baseline f2318 f5355 f5356; do printf '%-10s ' "$V" grep -o 'TOTAL after.*' "$W/$V/out/reentry_leak.log" | head -1 || echo "(none)" done |