+#!/bin/bash
# The Evaluator -- Master Control Script
-# (c) 2001 Martin Mares <mj@ucw.cz>
+# (c) 2001--2003 Martin Mares <mj@ucw.cz>
set -e
if [ ! -f config -o ! -f bin/lib ] ; then
. config
# Set up environment:
+# HDIR home dir of the evaluator
# PDIR problem specific data
# SDIR contestant's solution
# TDIR test results
# BOXDIR sandbox
# PROBLEM problem we're evaluating
-[ -n "$2" ] || die "Usage: ev <contestant> <problem>"
+[ -n "$2" ] || die "Usage: ev <contestant> <problem> [<program>]"
CONTESTANT=$1
PROBLEM=$2
dir-init
box-init
# Compile the program
-locate-source
-compile
+locate-source $3
+compile || true
# Perform the tests
PTSFILE=$TDIR/points
(
[ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
exec >$TDIR/$TEST.log
- pstart "Test $TEST ($POINTS_PER_TEST points)... "
- echo "Test $TEST ($POINTS_PER_TEST points)"
+ pstart "Test $TEST... "
+ echo "Test $TEST"
echo >>$PTSFILE -n "$TEST "
if [ ! -f $TDIR/$PROBLEM ] ; then
- echo >$PTSFILE "0 Compile error."
+ echo >>$PTSFILE "0 Compile error."
die "No executable file"
fi
test-run || exit 0
syntax-check || exit 0
output-check || exit 0
- echo "Test completed OK ($POINTS_PER_TEST points)"
- echo >>$PTSFILE "$POINTS_PER_TEST OK"
- pend "OK"
+ if [ -f $TDIR/$TEST.pts ] ; then
+ PTS=`cat $TDIR/$TEST.pts`
+ else
+ PTS=$POINTS_PER_TEST
+ fi
+ echo "Test completed OK ($PTS points)"
+ echo >>$PTSFILE "$PTS OK"
+ pend "OK, $PTS points"
)
done