2 # The Evaluator -- Public Submit Script
3 # (c) 2001--2007 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 [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
57 try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
59 test-result $POINTS_PER_TEST OK
62 [ -z "$PART" ] || die "Test number should be given only for open data problems."
63 locate-source "$SRCFILE"
65 for TEST in $SAMPLE_TESTS ; do
67 pstart "Checking on sample input $TEST: "
68 [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
72 die "How could I get there? It's a buuuuug!"
73 ) || FAILED=$(($FAILED+1))
77 if [ $FAILED != 0 ] ; then
78 if [ $FORCE != 0 ] ; then
80 pend "TESTS FAILED, but --force given, so submitting anyway."
82 pend "TESTS FAILED. Nothing has been submitted!"
83 pend "Use submit --force if you really want to submit an obviously WRONG solution."
88 if [ -n "$REMOTE_SUBMIT" ] ; then
89 pstart "Submitting to the server... "
90 $MO_ROOT/bin/remote-submit $PROBLEM $PART "$SDIR/$SRCN"
95 pstart "Submitting... "
97 if [ $TASK_TYPE == open-data ] ; then
98 mkdir -p ~/.submit/$PROBLEM
99 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/$PART.out
101 rm -rf ~/.submit/$PROBLEM
102 mkdir -p ~/.submit/$PROBLEM
103 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/