X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=public%2Fcheck;h=6a8012f2bcfefee60ab3c2c174d8cba91a867614;hb=6cba59728737842b32077102280642d269b78d90;hp=d5fecff46b3e1872cc429a1e8b70645286101693;hpb=40ce544840cdbdccc1fbfb4af95cfa97f6e30db4;p=moe.git diff --git a/public/check b/public/check index d5fecff..6a8012f 100755 --- a/public/check +++ b/public/check @@ -1,14 +1,37 @@ #!/bin/bash # The Evaluator -- Public Checking Script -# (c) 2001--2004 Martin Mares +# (c) 2001--2008 Martin Mares set -e [ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; } . $MO_ROOT/bin/lib . $MO_ROOT/config -[ -n "$1" ] || die "Usage: check []" +function usage +{ + die "Usage: check [-s ] []" +} + +SRCFILE= +while getopts "s:" opt ; do + case $opt in + s) SRCFILE="$OPTARG" + ;; + *) usage + ;; + esac +done +shift $(($OPTIND-1)) +[ -n "$1" ] || usage PROBLEM=$1 +TEST= +shift +if [ -n "$1" ] ; then + TEST="$1" + shift +fi +[ -z "$1" ] || usage + public-setup . $PDIR/config @@ -23,21 +46,22 @@ function test-verdict } if [ $TASK_TYPE == open-data ] ; then - [ -n "$2" ] || die "You need to specify test number for open data problems." - TEST=$2 + [ -n "$TEST" ] || die "You need to specify test number for open data problems." pstart "Checking $TEST: " - open-locate - ln $SRCN $TDIR/$TEST.out + test-config + open-locate "$SRCFILE" + try-ln "$SDIR/$SRCN" $TDIR/$TEST.out syntax-check - test-result 1 OK + test-result $POINTS_PER_TEST OK else - [ -z "$2" ] || die "Test number should be given only for open data problems." - locate-source + [ -z "$TEST" ] || die "Test number should be given only for open data problems." + locate-source "$SRCFILE" compile RC=0 for TEST in $SAMPLE_TESTS ; do ( pstart "Checking on sample input $TEST: " + test-config test-run syntax-check output-check