X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2Fev;h=1681d93c612a211ae6e23c9b0fe99d81bcd3aea9;hb=62f031249f096887b62544f8e4513fd225ac86fd;hp=ad44b496594e950b071c9010a2df321322ac0e62;hpb=c2fdbe3ce6542e06346b532fb3173b9e955f24fa;p=moe.git diff --git a/bin/ev b/bin/ev index ad44b49..1681d93 100755 --- a/bin/ev +++ b/bin/ev @@ -1,6 +1,6 @@ #!/bin/bash # The Evaluator -- Master Control Script -# (c) 2001 Martin Mares +# (c) 2001--2004 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,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)... " + 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