]> mj.ucw.cz Git - moe.git/blob - bin/ev
The reporting script now understands grouping.
[moe.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 if [ $TASK_TYPE != open-data ] ; then
23         locate-source `if [ -n "$3" ] ; then echo $SDIR/$3 ; fi`
24         compile || true
25 fi
26
27 # Initialize the points file
28 PTSFILE=$TDIR/points
29 >$PTSFILE
30
31 function test-verdict
32 {
33         if [ $1 == 0 ] ; then
34                 pend "$2"
35         else
36                 pend "$2 ($1 points)"
37         fi
38         echo >>$PTSFILE "$TEST $1 $2"
39         exit 0
40 }
41
42 # Perform the tests
43 [ -z "$EV_SAMPLE" ] || TESTS="$SAMPLE_TESTS $TESTS"
44 for TEST in $TESTS ; do
45         (
46         [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
47         exec >$TDIR/$TEST.log
48         pstart "Test $TEST... "
49         echo "Test $TEST ($POINTS_PER_TEST points)"
50         test-run
51         syntax-check
52         output-check
53         die "You must never see this message."
54         )
55 done