extensions or test cases. See the `override-vars' function.
Loading of per-test configuration has been moved to `test-config' in bin/lib.
#!/bin/bash
# The Evaluator -- Master Control Script
-# (c) 2001--2004 Martin Mares <mj@ucw.cz>
+# (c) 2001--2008 Martin Mares <mj@ucw.cz>
set -e
if [ ! -f config -o ! -f bin/lib ] ; then
[ -z "$EV_SAMPLE" ] || TESTS="$SAMPLE_TESTS $TESTS"
for TEST in $TESTS ; do
(
- [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
exec >$TDIR/$TEST.log
+ test-config
pstart "Test $TEST... "
echo "Test $TEST ($POINTS_PER_TEST points)"
test-run
# The Evaluator -- Shell Function Library
-# (c) 2001--2007 Martin Mares <mj@ucw.cz>
+# (c) 2001--2008 Martin Mares <mj@ucw.cz>
# General settings
shopt -s dotglob
ln $1 $2 2>/dev/null || cp $1 $2
}
+# Given a <prefix>, override each variable <x> by <prefix>_<x>
+
+function override-vars
+{
+ local OR V OLDIFS
+ declare -a OR
+ OLDIFS="$IFS"
+ IFS=$'\n'
+ OR=($(set | sed "s/^$1_//;t;d")) || true
+ IFS="$OLDIFS"
+ for V in "${OR[@]}" ; do
+ eval "$V"
+ done
+}
+
# Sandbox subroutines
function box-init
function compile
{
pstart "Compiling... "
+ override-vars "EXT_$SRCEXT"
# Beware, the original SRCN can be a strange user-supplied name
SRC=$PROBLEM.$SRCEXT
cp "$SDIR/$SRCN" $TDIR/$SRC
# Running of test program according to current task type (returns exit code and TEST_MSG)
+function test-config
+{
+ [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
+ override-vars "TEST_$TEST"
+}
+
function test-run
{
test-run-$TASK_TYPE
# Configuration file for the MO Evaluator
-# (c) 2001--2007 Martin Mares <mj@ucw.cz>
+# (c) 2001--2008 Martin Mares <mj@ucw.cz>
# The root of the whole directory hierarchy
MO_ROOT=/mo
# DEBUG: Skip output filters (if you suspect they are buggy)
#EV_NOFILTER=1
+
+### Variables overrides (most variables can be overridden for specific tests or source extensions):
+
+#EXT_pas_TIME_LIMIT=100
+#TEST_1_TIME_LIMIT=100
+#EXT_pas_TEST_1_TIME_LIMIT=100
#!/bin/bash
# The Evaluator -- Public Checking Script
-# (c) 2001--2007 Martin Mares <mj@ucw.cz>
+# (c) 2001--2008 Martin Mares <mj@ucw.cz>
set -e
[ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
if [ $TASK_TYPE == open-data ] ; then
[ -n "$TEST" ] || die "You need to specify test number for open data problems."
pstart "Checking $TEST: "
- [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
+ test-config
open-locate "$SRCFILE"
try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
syntax-check
for TEST in $SAMPLE_TESTS ; do
(
pstart "Checking on sample input $TEST: "
- [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
+ test-config
test-run
syntax-check
output-check