X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=bin%2Fev;h=0a462bf40f4a0a56689f85b4641b2847be2c4030;hb=666506e10535397d92733c7b6df0421c18708d04;hp=ed2dc6738f1d5ed68f59ecf950a45472290c2d7a;hpb=283214723416710aaf5d94b9c1e3527fa6f1208e;p=eval.git diff --git a/bin/ev b/bin/ev index ed2dc67..0a462bf 100755 --- a/bin/ev +++ b/bin/ev @@ -2,62 +2,47 @@ # (c) 2001 Martin Mares set -e -cd +if [ ! -f config -o ! -f bin/lib ] ; then + echo "Unable to find evaluator files!" + exit 1 +fi . bin/lib . config -[ -n "$TEST_USER" ] || die "TEST_USER not set. Please fix." -[ -d $MO_ROOT/$TEST_USER ] || die "TEST_USER set incorrectly. Please fix." + +# Set up environment: +# PDIR problem specific data +# SDIR contestant's solution +# TDIR test results +# BOXDIR sandbox +# PROBLEM problem we're evaluating + [ -n "$2" ] || die "Usage: ev " -CT=$1 +CONTESTANT=$1 PROBLEM=$2 -. bin/lib - -# Initialize the testing directory -echo >&2 "Testing contestant $CT, problem $PROBLEM" -echo >&2 -PDIR=problems/$PROBLEM -SDIR=solutions/$CT/$PROBLEM -TDIR=testing/$CT/$PROBLEM -. bin/task-init +dir-init +log-init . $PDIR/config +box-init -# Set up logging -exec >>$TDIR/log -HAVE_LOG=1 - -# Compile the solution -( . bin/task-compile ) +# Compile the program +locate-source +compile # Perform the tests for TEST in $TESTS ; do ( - pstart "Test $TEST: " [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config exec >$TDIR/$TEST.log PTSFILE=$TDIR/$TEST.pts - if [ ! -f $TDIR/compile.out ] ; then - echo >$PTSFILE "0 --" - die "No source file" - fi + pstart "Test $TEST ($POINTS_PER_TEST points)... " + echo "Test $TEST ($POINTS_PER_TEST points)" if [ ! -f $TDIR/$PROBLEM ] ; then - echo >$PTSFILE "0 CE" + echo >$PTSFILE "0 Compile error." die "No executable file" fi - pcont " " - box-init - echo "Executable file: $TDIR/$PROBLEM" - cp $TDIR/$PROBLEM $BOXDIR/ - echo "Input: $TDIR/$PROBLEM" - cp $PDIR/$TEST.in $BOXDIR/$PROBLEM.in - echo "Input files:" - ls -Al $BOXDIR - echo "Timeout: $TIME_LIMIT s" - echo "Memory: $MEM_LIMIT KB" - BOXOPTS="`eval echo $TEST_SANDBOX_OPTS`" - echo "Sandbox options: $BOXOPTS" - - pcont " " - + $TEST_RUN_METHOD || exit 0 + syntax-check || exit 0 + output-check || exit 0 echo "Test completed OK ($POINTS_PER_TEST points)" echo >$PTSFILE "$POINTS_PER_TEST OK" pend "OK"