2 # The Evaluator -- Public Submit Script
3 # (c) 2001--2004 Martin Mares <mj@ucw.cz>
6 [ -n "$MO_ROOT" -a -d "$MO_ROOT" ] || { echo >&2 "MO_ROOT not set, giving up." ; exit 1 ; }
12 die "Usage: submit [--force] [-s <source-file>] <problem> [<test-number>]"
16 if [ "$1" = --force ] ; then
20 [ -n "$1" -a "$1" != "--help" ] || usage
22 while getopts "s:" opt ; do
46 [ $1 == 0 ] && exit 1 || exit 0
50 if [ $TASK_TYPE == open-data ] ; then
51 [ -n "$PART" ] || die "You need to specify test number for open data problems."
53 pstart "Test case $TEST: "
54 open-locate "$SRCFILE"
56 ln "$SDIR/$SRCN" $TDIR/$TEST.out
61 [ -z "$PART" ] || die "Test number should be given only for open data problems."
62 locate-source "$SRCFILE"
64 for TEST in $SAMPLE_TESTS ; do
66 pstart "Checking on sample input $TEST: "
70 die "How could I get there? It's a buuuuug!"
71 ) || FAILED=$(($FAILED+1))
75 if [ $FAILED != 0 ] ; then
76 if [ $FORCE != 0 ] ; then
78 pend "TESTS FAILED, but --force given, so submitting anyway."
80 pend "TESTS FAILED. Nothing has been submitted!"
81 pend "Use submit --force if you really want to submit an obviously WRONG solution."
86 if [ -n "$REMOTE_SUBMIT" ] ; then
87 pstart "Submitting to the server... "
88 $MO_ROOT/bin/remote-submit $PROBLEM $PART "$SDIR/$SRCN"
93 pstart "Submitting... "
95 if [ $TASK_TYPE == open-data ] ; then
96 mkdir -p ~/.submit/$PROBLEM
97 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/$PART.out
99 rm -rf ~/.submit/$PROBLEM
100 mkdir -p ~/.submit/$PROBLEM
101 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/