]> mj.ucw.cz Git - eval.git/blob - bin/ev
ev-all can fail.
[eval.git] / bin / ev
1 #!/bin/bash
2 # The Evaluator -- Master Control Script
3 # (c) 2001 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 # Set up environment:
14 #   HDIR        home dir of the evaluator
15 #   PDIR        problem specific data
16 #   SDIR        contestant's solution
17 #   TDIR        test results
18 #   BOXDIR      sandbox
19 #   PROBLEM     problem we're evaluating
20
21 [ -n "$2" ] || die "Usage: ev <contestant> <problem> [<program>]"
22 CONTESTANT=$1
23 PROBLEM=$2
24 dir-init
25 log-init
26 . $PDIR/config
27 box-init
28
29 # Compile the program
30 locate-source $3
31 compile
32
33 # Perform the tests
34 PTSFILE=$TDIR/points
35 for TEST in $TESTS ; do
36         (
37         [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
38         exec >$TDIR/$TEST.log
39         pstart "Test $TEST ($POINTS_PER_TEST points)... "
40         echo "Test $TEST ($POINTS_PER_TEST points)"
41         echo >>$PTSFILE -n "$TEST "
42         if [ ! -f $TDIR/$PROBLEM ] ; then
43                 echo >$PTSFILE "0 Compile error."
44                 die "No executable file"
45         fi
46         test-run || exit 0
47         syntax-check || exit 0
48         output-check || exit 0
49         echo "Test completed OK ($POINTS_PER_TEST points)"
50         echo >>$PTSFILE "$POINTS_PER_TEST OK"
51         pend "OK"
52         )
53 done