]> mj.ucw.cz Git - moe.git/blobdiff - bin/ev
Added the show-submits utility.
[moe.git] / bin / ev
diff --git a/bin/ev b/bin/ev
index 018f2370da93834ee26c209e4c250ec8235649d3..554e5dc874778df2d980539088e1d30365475242 100755 (executable)
--- a/bin/ev
+++ b/bin/ev
@@ -1,6 +1,6 @@
 #!/bin/bash
 # The Evaluator -- Master Control Script
 #!/bin/bash
 # The Evaluator -- Master Control Script
-# (c) 2001 Martin Mares <mj@ucw.cz>
+# (c) 2001--2004 Martin Mares <mj@ucw.cz>
 
 set -e
 if [ ! -f config -o ! -f bin/lib ] ; then
 
 set -e
 if [ ! -f config -o ! -f bin/lib ] ; then
@@ -10,14 +10,7 @@ fi
 . bin/lib
 . config
 
 . 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 <contestant> <problem>"
+[ -n "$2" -a -z "$4" ] || die "Usage: ev <contestant> <problem> [<program>]"
 CONTESTANT=$1
 PROBLEM=$2
 dir-init
 CONTESTANT=$1
 PROBLEM=$2
 dir-init
@@ -26,27 +19,34 @@ log-init
 box-init
 
 # Compile the program
 box-init
 
 # Compile the program
-locate-source
-compile
+locate-source $3
+compile || true
 
 
-# Perform the tests
+# Initialize the points file
 PTSFILE=$TDIR/points
 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
 for TEST in $TESTS ; do
        (
        [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
        exec >$TDIR/$TEST.log
 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 "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
        )
 done