]> mj.ucw.cz Git - moe.git/blob - bin/ev
Support partial score.
[moe.git] / bin / ev
1 #!/bin/bash
2 # The Evaluator -- Master Control Script
3 # (c) 2001--2003 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 || true
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... "
40         echo "Test $TEST"
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         if [ -f $TDIR/$TEST.pts ] ; then
50                 PTS=`cat $TDIR/$TEST.pts`
51         else
52                 PTS=$POINTS_PER_TEST
53         fi
54         echo "Test completed OK ($PTS points)"
55         echo >>$PTSFILE "$PTS OK"
56         pend "OK, $PTS points"
57         )
58 done