SUMMARY=<log> keeps the full log and prints a bounded verdict summary; wait <log> blocks at most 270 s and returns it once. mutation-table.sh runs hand mutants in one verify job and returns a kill table. testparse.sh is the one parser for both. Fixtures: real cargo and mutation logs from Yggdrasil (tiny-crate), plus hand-written dotnet, vitest, pytest, exit-0-but-failed and no-verdict logs. Every commit here builds; verified live on Yggdrasil. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
38 lines
2 KiB
Shell
38 lines
2 KiB
Shell
#!/usr/bin/env bash
|
|
# Local, cheap checks of the verdict-bearing text parsers: tools/testparse.sh and
|
|
# the summary mode of tools/stopgap/ygg-verify.sh, over tools/fixtures/logs.
|
|
# cargo-*.log and mutation-table.log are real Yggdrasil runs (the tiny-crate
|
|
# fixture, 2026-10-01); dotnet, vitest, pytest, exit0 and no-verdict are
|
|
# hand-written. Run: bash tools/test-tools.sh (no network, no builds)
|
|
set -uo pipefail
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
L=$here/fixtures/logs; V=$here/stopgap/ygg-verify.sh
|
|
fail=0
|
|
# check <log> <exit status> <must-contain> [<must-not-contain>]
|
|
check() {
|
|
out=$(bash "$V" summarize "$L/$1" "$2")
|
|
printf '%s\n' "$out" | grep -qF -- "$3" || { echo "FAIL $1: missing: $3"; fail=1; return; }
|
|
if [ -n "${4:-}" ] && printf '%s\n' "$out" | grep -qF -- "$4"; then echo "FAIL $1: must not contain: $4"; fail=1; return; fi
|
|
[ "$(printf '%s\n' "$out" | wc -l)" -le 81 ] || { echo "FAIL $1: summary over 81 lines"; fail=1; return; }
|
|
echo "ok $1: $3"
|
|
}
|
|
check cargo-green.log 0 "exit 0 GREEN" "RED"
|
|
check cargo-green.log 0 "FRAMEWORK cargo passed=3 failed=0"
|
|
check cargo-red.log 101 "exit 101 RED"
|
|
check cargo-red.log 101 "FAILED tests::add_adds"
|
|
check cargo-red.log 101 "left: 5"
|
|
check cargo-zero-tests.log 0 "ZERO TESTS RAN"
|
|
check mutation-table.log 1 "clamp-positive | SURVIVED"
|
|
check mutation-table.log 1 "add-typo | UNVIABLE"
|
|
check mutation-table.log 1 "add-minus | CAUGHT | tests::add_adds"
|
|
check mutation-table.log 1 "caught=2 survived=1 unviable=1 timeout=0 noapply=1 error=0" "no test counts recognised"
|
|
check dotnet-red.log 1 "FRAMEWORK dotnet passed=11 failed=1 skipped=2"
|
|
check dotnet-red.log 1 "FAILED MyNs.AddTests.Subtracts"
|
|
check vitest-red.log 1 "FRAMEWORK vitest passed=10 failed=1 skipped=1"
|
|
check vitest-red.log 1 "FAILED src/add.test.ts > add > carries"
|
|
check pytest-red.log 1 "FRAMEWORK pytest passed=5 failed=1 skipped=1"
|
|
check pytest-red.log 1 "FAILED tests/test_add.py::test_carries"
|
|
check exit0-but-failed.log 0 "MISMATCH: exit 0 but the log shows"
|
|
check no-verdict.log 97 "NO VERDICT"
|
|
check no-verdict.log 97 "RED" "GREEN"
|
|
exit $fail
|