X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=public%2Fsubmit;h=886a1c89e7f87ad1d4c0d28a151000be79e9b66d;hb=325264b9d0d300e7701a8c2df1300508f448ae0e;hp=eaab532b524a7bab3b7e4b8db009cc1ca0f2e2c9;hpb=e1a930ace0e383614e716e45190e548c5a170bcc;p=eval.git diff --git a/public/submit b/public/submit index eaab532..886a1c8 100755 --- a/public/submit +++ b/public/submit @@ -1,3 +1,4 @@ +#!/bin/bash # The Evaluator -- Public Submit Script # (c) 2001--2004 Martin Mares @@ -6,13 +7,36 @@ set -e . $MO_ROOT/bin/lib . $MO_ROOT/config +function usage +{ + die "Usage: check [--force] [-s ] []" +} + FORCE=0 if [ "$1" = --force ] ; then FORCE=1 shift fi -[ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] []" +[ -n "$1" -a "$1" != "--help" ] || usage +SRCFILE= +while getopts "s:" opt ; do + case $opt in + s) SRCFILE="$OPTARG" + ;; + *) usage + ;; + esac +done +shift $(($OPTIND-1)) +[ -n "$1" ] || usage PROBLEM=$1 +PART= +shift +if [ -n "$1" ] ; then + PART="$1" + shift +fi +[ -z "$1" ] || usage public-setup . $PDIR/config @@ -24,18 +48,18 @@ function test-verdict FAILED=0 if [ $TASK_TYPE == open-data ] ; then - [ -n "$2" ] || die "You need to specify test number for open data problems." - TEST=$2 + [ -n "$PART" ] || die "You need to specify test number for open data problems." + TEST=$PART pstart "Test case $TEST: " - open-locate + open-locate $SRCFILE ( ln $SRCN $TDIR/$TEST.out syntax-check test-result 1 OK ) || FAILED=1 else - [ -z "$2" ] || die "Test number should be given only for open data problems." - locate-source + [ -z "$PART" ] || die "Test number should be given only for open data problems." + locate-source $SRCFILE compile for TEST in $SAMPLE_TESTS ; do ( @@ -58,11 +82,18 @@ if [ $FAILED != 0 ] ; then fi fi +if [ -n "$REMOTE_SUBMIT" ] ; then + pstart "Submitting to the server... " + $MO_ROOT/bin/remote-submit $PROBLEM $PART $SDIR/$SRCN + pend "OK" + exit 0 +fi + pstart "Submitting... " mkdir -p ~/.submit if [ $TASK_TYPE == open-data ] ; then mkdir -p ~/.submit/$PROBLEM - cp $SRCN ~/.submit/$PROBLEM/$TEST.out + cp $SRCN ~/.submit/$PROBLEM/$PART.out else rm -rf ~/.submit/$PROBLEM mkdir -p ~/.submit/$PROBLEM