]> mj.ucw.cz Git - eval.git/blob - bin/ev
The Big Cleanup.
[eval.git] / bin / ev
1 #!/bin/bash
2 # The Evaluator -- Master Control Script
3 # (c) 2001--2004 Martin Mares <mj@ucw.cz>
4
5 set -e
6 if [ ! -f config -o ! -f bin/lib ] ; then
7         echo "Unable to find evaluator files!"
8         exit 1
9 fi
10 . bin/lib
11 . config
12
13 [ -n "$2" -a -z "$4" ] || die "Usage: ev <contestant> <problem> [<program>]"
14 CONTESTANT=$1
15 PROBLEM=$2
16 dir-init
17 log-init
18 . $PDIR/config
19 box-init
20
21 # Compile the program
22 locate-source $3
23 compile || true
24
25 # Initialize the points file
26 PTSFILE=$TDIR/points
27 >$PTSFILE
28
29 function test-verdict
30 {
31         if [ $1 == 0 ] ; then
32                 pend "$2"
33         else
34                 pend "$2 ($1 points)"
35         fi
36         echo >>$PTSFILE "$TEST $1 $2"
37         exit 0
38 }
39
40 # Perform the tests
41 for TEST in $TESTS ; do
42         (
43         [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
44         exec >$TDIR/$TEST.log
45         pstart "Test $TEST... "
46         echo "Test $TEST ($POINTS_PER_TEST points)"
47         test-run
48         syntax-check
49         output-check
50         die "You must never see this message."
51         )
52 done