#!/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 the editors and any render so the # verifier's ffmpeg seeks are not competing with a Friction render for 4 cores. pkill -x shotcut 2>/dev/null || true pkill -x friction 2>/dev/null || true pkill -f 'melt' 2>/dev/null || true pkill -f 'ffmpeg' 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/*.mp4 /root/edit/*.mlt /root/edit/*.friction "$dst"/ 2>/dev/null || true # every Friction export (Sid: all Friction + Shotcut exports reviewable outside the job) mkdir -p "$dst"/traced "$dst"/svg cp -f /root/edit/traced/*.mp4 "$dst"/traced/ 2>/dev/null || true cp -f /root/edit/svg/*.svg "$dst"/svg/ 2>/dev/null || true # Friction projects saved elsewhere under /root — the rubric accepts them find /root -maxdepth 3 -name '*.friction' -not -path '/root/edit/*' -exec cp -f {} "$dst"/ \; 2>/dev/null || true mkdir -p "$dst"/autosave cp -f /root/.local/share/Meltytech/Shotcut/autosave/*.mlt "$dst"/autosave/ 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 # GUI-only audit: the terminal stub logs every attempt (rubric gate). cp -f /logs/artifacts/terminal-attempts.log /logs/verifier/artifacts/ 2>/dev/null || true # Per-checkpoint tracer numbers (pixel counts per sampled frame) for # calibration — the rubric writes them next to reward.txt. cp -f /tmp/t16-grade/tracer-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