#!/bin/bash
# runs INSIDE the sandbox, in the project dir. usage: replay_in.sh <tool> <modules-file> <outdir> <jobs>
tool=$1; mods=$2; out=$3; jobs=$4
mkdir -p $out
export LEAN_PATH=$(lake env printenv LEAN_PATH)
ulimit -s unlimited
one() { m=$1; s=$(date +%s.%N); if $tool $m > $out/$m.log 2>&1; then r=ok; rm -f $out/$m.log; else r="FAIL($?)"; fi; e=$(date +%s.%N); echo "$m $r $(echo "$e - $s" | bc)"; }
export -f one; export tool out
xargs -a $mods -P $jobs -I{} bash -c 'one {}' > $out/results.txt
