#!/bin/bash
# usage: judge.sh <edition> ; waits for that edition's build, then runs lake comparator --paranoid
E=$1; S=/home/claude/grh/short; L=$S/logs
until grep -q '^axioms' $L/$E.timeline; do sleep 5; done
grep -q '^build exit=0' $L/$E.timeline || { echo "judge not started: build failed" >> $L/$E.timeline; exit 1; }
TC=/home/claude/.elan/toolchains/leanprover--lean4---v4.35.0/bin
export PATH=$TC:$PATH; ulimit -s unlimited; ulimit -n 65536 2>/dev/null
cd $S/$E
echo "judge start $(date -u +%FT%TZ)" >> $L/$E.timeline
/usr/bin/time -v $TC/lake comparator --paranoid > $L/$E.judge.log 2>&1
echo "lake comparator --paranoid exit=$? $(date -u +%FT%TZ)" >> $L/$E.timeline
