#!/bin/bash
# usage: replay.sh <edition> ; leanchecker then lean4lean on every module, offline sandbox
E=$1; S=/home/claude/grh/short; L=$S/logs
cp $S/tools/replay_in.sh $L/$E.modules.txt $S/$E/.lake/   # only the project dir is visible to the sandbox
for tool in leanchecker lean4lean; do
  echo "$tool start $(date -u +%FT%TZ)" >> $L/$E.replay.timeline
  /usr/bin/time -v $S/tools/sbx.sh $S/$E bash .lake/replay_in.sh $tool .lake/$E.modules.txt .lake/replay-$tool 7 > $L/$E.replay-$tool.time 2>&1
  cp $S/$E/.lake/replay-$tool/results.txt $L/$E.replay-$tool.results.txt
  echo "$tool done ok=$(grep -c ' ok ' $L/$E.replay-$tool.results.txt) fail=$(grep -c FAIL $L/$E.replay-$tool.results.txt) $(date -u +%FT%TZ)" >> $L/$E.replay.timeline
done
