sidrefresh's picture
Add files using upload-large-folder tool
7ec48b5 verified
Raw History Blame
2.02 kB
#!/bin/bash
# Run the tests. Copied to /tests/test.sh and run from the working directory.
#
# Nothing is installed here: pytest, pytest-json-ctrf and ffmpeg/ffprobe are
# baked into vedit-task:base. Fetching them at grading time would couple every
# score to network luck.
mkdir -p /logs/verifier
# Free the box for grading (t10 lesson): stop Friction (and any render it is
# still running) and the tutorial browser so the verifier's ffmpeg seeks are
# not competing for 4 cores. The harness's own chromium is left alone.
pkill -x friction 2>/dev/null || true
pkill -f 'tutorial-chromium' 2>/dev/null || true
sleep 2
# Preserve deliverables before teardown (fcpx.md rule 1a). NOTE (2026-08-20):
# harbor collects /logs/artifacts BEFORE the verifier runs, so
# /logs/verifier/artifacts is the copy that actually reaches the host
# (harvested with reward.txt). Both are written, belt and braces.
mkdir -p /logs/artifacts /logs/verifier/artifacts
for dst in /logs/artifacts /logs/verifier/artifacts; do
cp -f /root/Desktop/final.mp4 "$dst"/ 2>/dev/null || true
cp -f /root/edit/*.friction /root/edit/*.mp4 /root/edit/*.png "$dst"/ 2>/dev/null || true
# any Friction project saved elsewhere (Desktop, home) — the rubric accepts them
find /root -maxdepth 3 -name '*.friction' -not -path '/root/edit/*' -exec cp -f {} "$dst"/ \; 2>/dev/null || true
done
# CTRF produces a standard test report in JSON format which is useful for logging.
python3 -m pytest --ctrf /logs/verifier/ctrf.json /tests/test_outputs.py -rA
# Per-sample reconstruction numbers (mode/flip/offset/MAD) for calibration —
# the rubric writes them next to reward.txt.
cp -f /tmp/t18-grade/samples.json /logs/verifier/artifacts/ 2>/dev/null || true
# test_outputs.py writes the FRACTIONAL reward itself. Do not clobber it here --
# a partial score is the whole point of the rubric. Only fall back to 0 if the
# verifier crashed before writing anything.
if [ ! -s /logs/verifier/reward.txt ]; then
echo 0 > /logs/verifier/reward.txt
fi