X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fev;h=a6189077d9f94b228f471887f7a1d062873345ea;hb=c54cab5bbd5b7c4cb0a48e17257b0150b4ceea66;hp=4846c9fd1331d64f3d8f74634157181dc0f1fe77;hpb=fe345a6fc9d8b74caf685fdffb41500cfc795b81;p=eval.git diff --git a/bin/ev b/bin/ev index 4846c9f..a618907 100755 --- a/bin/ev +++ b/bin/ev @@ -1,6 +1,6 @@ #!/bin/bash # The Evaluator -- Master Control Script -# (c) 2001 Martin Mares +# (c) 2001--2008 Martin Mares set -e if [ ! -f config -o ! -f bin/lib ] ; then @@ -10,14 +10,7 @@ fi . bin/lib . config -# 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 []" +[ -n "$2" -a -z "$4" ] || die "Usage: ev []" CONTESTANT=$1 PROBLEM=$2 dir-init @@ -26,27 +19,37 @@ log-init box-init # Compile the program -locate-source $3 -compile +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 - pstart "Test $TEST ($POINTS_PER_TEST points)... " + test-config + pstart "Test $TEST... " echo "Test $TEST ($POINTS_PER_TEST points)" - 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 - echo "Test completed OK ($POINTS_PER_TEST points)" - echo >>$PTSFILE "$POINTS_PER_TEST OK" - pend "OK" + test-run + syntax-check + output-check + die "You must never see this message." ) done