X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=bin%2Fev;h=a6189077d9f94b228f471887f7a1d062873345ea;hb=50cc126ebe949259a54f153a123848d771601b77;hp=ed2dc6738f1d5ed68f59ecf950a45472290c2d7a;hpb=283214723416710aaf5d94b9c1e3527fa6f1208e;p=eval.git diff --git a/bin/ev b/bin/ev index ed2dc67..a618907 100755 --- a/bin/ev +++ b/bin/ev @@ -1,65 +1,55 @@ +#!/bin/bash # The Evaluator -- Master Control Script -# (c) 2001 Martin Mares +# (c) 2001--2008 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." -[ -n "$2" ] || die "Usage: ev " -CT=$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 +[ -n "$2" -a -z "$4" ] || die "Usage: ev []" +CONTESTANT=$1 +PROBLEM=$2 +dir-init +log-init . $PDIR/config +box-init -# Set up logging -exec >>$TDIR/log -HAVE_LOG=1 +# Compile the program +if [ $TASK_TYPE != open-data ] ; then + locate-source `if [ -n "$3" ] ; then echo $SDIR/$3 ; fi` + compile || true +fi -# Compile the solution -( . bin/task-compile ) +# Initialize the points file +PTSFILE=$TDIR/points +>$PTSFILE + +function test-verdict +{ + if [ $1 == 0 ] ; then + pend "$2" + else + pend "$2 ($1 points)" + fi + echo >>$PTSFILE "$TEST $1 $2" + exit 0 +} # Perform the tests +[ -z "$EV_SAMPLE" ] || TESTS="$SAMPLE_TESTS $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 - if [ ! -f $TDIR/$PROBLEM ] ; then - echo >$PTSFILE "0 CE" - 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 " " - - echo "Test completed OK ($POINTS_PER_TEST points)" - echo >$PTSFILE "$POINTS_PER_TEST OK" - pend "OK" + test-config + pstart "Test $TEST... " + echo "Test $TEST ($POINTS_PER_TEST points)" + test-run + syntax-check + output-check + die "You must never see this message." ) done