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: check [--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: "
56 ln $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
77 pend "TESTS FAILED, but --force given, so submitting anyway."
79 pend "TESTS FAILED. Nothing has been submitted!"
80 pend "Use submit --force if you really want to submit an obviously WRONG solution."
85 if [ -n "$REMOTE_SUBMIT" ] ; then
86 pstart "Submitting to the server... "
87 $MO_ROOT/bin/remote-submit $PROBLEM $PART $SDIR/$SRCN
92 pstart "Submitting... "
94 if [ $TASK_TYPE == open-data ] ; then
95 mkdir -p ~/.submit/$PROBLEM
96 cp $SRCN ~/.submit/$PROBLEM/$PART.out
98 rm -rf ~/.submit/$PROBLEM
99 mkdir -p ~/.submit/$PROBLEM
100 cp $SRCN ~/.submit/$PROBLEM/