18 lines
703 B
Bash
Executable File
18 lines
703 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs the tests and writes one line per test (from the Surefire XML) to output/09-test-results.txt.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
mvn -B -q test > /dev/null
|
|
python3 - <<'PY' > output/09-test-results.txt
|
|
import glob, xml.etree.ElementTree as ET
|
|
total = fail = 0
|
|
for f in sorted(glob.glob("target/surefire-reports/TEST-*.xml")):
|
|
root = ET.parse(f).getroot()
|
|
cls = root.get("name").rsplit(".", 1)[-1]
|
|
for tc in root.iter("testcase"):
|
|
bad = tc.find("failure") is not None or tc.find("error") is not None
|
|
total += 1; fail += bad
|
|
print(("FAIL " if bad else "PASS ") + cls + "." + tc.get("name"))
|
|
print(f"{total} tests, {fail} failures")
|
|
PY
|