X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=bin%2Fev;h=a6189077d9f94b228f471887f7a1d062873345ea;hb=50cc126ebe949259a54f153a123848d771601b77;hp=b2573b0958d3539520c2dab51026758e60d6f0cd;hpb=0f5aaa6fd6a30a58f7aa8cd83507fd803d59128a;p=eval.git diff --git a/bin/ev b/bin/ev index b2573b0..a618907 100755 --- a/bin/ev +++ b/bin/ev @@ -1,6 +1,6 @@ #!/bin/bash # The Evaluator -- Master Control Script -# (c) 2001--2003 Martin Mares +# (c) 2001--2008 Martin Mares set -e if [ ! -f config -o ! -f bin/lib ] ; then @@ -10,15 +10,7 @@ fi . bin/lib . config -# Set up environment: -# HDIR home dir of the evaluator -# PDIR problem specific data -# SDIR contestant's solution -# TDIR test results -# BOXDIR sandbox -# PROBLEM problem we're evaluating - -[ -n "$2" ] || die "Usage: ev []" +[ -n "$2" -a -z "$4" ] || die "Usage: ev []" CONTESTANT=$1 PROBLEM=$2 dir-init @@ -27,32 +19,37 @@ log-init box-init # Compile the program -locate-source $3 -compile || true +if [ $TASK_TYPE != open-data ] ; then + locate-source `if [ -n "$3" ] ; then echo $SDIR/$3 ; fi` + compile || true +fi -# Perform the tests +# 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 ( - [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config exec >$TDIR/$TEST.log + test-config pstart "Test $TEST... " - echo "Test $TEST" - echo >>$PTSFILE -n "$TEST " - if [ ! -f $TDIR/$PROBLEM ] ; then - echo >>$PTSFILE "0 Compile error." - die "No executable file" - fi - test-run || exit 0 - syntax-check || exit 0 - output-check || exit 0 - if [ -f $TDIR/$TEST.pts ] ; then - PTS=`cat $TDIR/$TEST.pts` - else - PTS=$POINTS_PER_TEST - fi - echo "Test completed OK ($PTS points)" - echo >>$PTSFILE "$PTS OK" - pend "OK, $PTS points" + echo "Test $TEST ($POINTS_PER_TEST points)" + test-run + syntax-check + output-check + die "You must never see this message." ) done