]> mj.ucw.cz Git - moe.git/blob - bin/ev
A lot of work...
[moe.git] / bin / ev
1 # The Evaluator -- Master Control Script
2 # (c) 2001 Martin Mares <mj@ucw.cz>
3
4 set -e
5 cd
6 . bin/lib
7 . config
8 [ -n "$TEST_USER" ] || die "TEST_USER not set. Please fix."
9 [ -d $MO_ROOT/$TEST_USER ] || die "TEST_USER set incorrectly. Please fix."
10 [ -n "$2" ] || die "Usage: ev <contestant> <problem>"
11 CT=$1
12 PROBLEM=$2
13 . bin/lib
14
15 # Initialize the testing directory
16 echo >&2 "Testing contestant $CT, problem $PROBLEM"
17 echo >&2
18 PDIR=problems/$PROBLEM
19 SDIR=solutions/$CT/$PROBLEM
20 TDIR=testing/$CT/$PROBLEM
21 . bin/task-init
22 . $PDIR/config
23
24 # Set up logging
25 exec >>$TDIR/log
26 HAVE_LOG=1
27
28 # Compile the solution
29 ( . bin/task-compile )
30
31 # Perform the tests
32 for TEST in $TESTS ; do
33         (
34         pstart "Test $TEST: "
35         [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
36         exec >$TDIR/$TEST.log
37         PTSFILE=$TDIR/$TEST.pts
38         if [ ! -f $TDIR/compile.out ] ; then
39                 echo >$PTSFILE "0 --"
40                 die "No source file"
41         fi
42         if [ ! -f $TDIR/$PROBLEM ] ; then
43                 echo >$PTSFILE "0 CE"
44                 die "No executable file"
45         fi
46         pcont "<init> "
47         box-init
48         echo "Executable file: $TDIR/$PROBLEM"
49         cp $TDIR/$PROBLEM $BOXDIR/
50         echo "Input: $TDIR/$PROBLEM"
51         cp $PDIR/$TEST.in $BOXDIR/$PROBLEM.in
52         echo "Input files:"
53         ls -Al $BOXDIR
54         echo "Timeout: $TIME_LIMIT s"
55         echo "Memory: $MEM_LIMIT KB"
56         BOXOPTS="`eval echo $TEST_SANDBOX_OPTS`"
57         echo "Sandbox options: $BOXOPTS"
58
59         pcont "<run> "
60
61         echo "Test completed OK ($POINTS_PER_TEST points)"
62         echo >$PTSFILE "$POINTS_PER_TEST OK"
63         pend "OK"
64         )
65 done