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 ; }
7 pushd $MO_ROOT >/dev/null
14 die "Usage: submit [--force] [-s <source-file>] <problem> [<test-number>]"
18 if [ "$1" = --force ] ; then
22 [ -n "$1" -a "$1" != "--help" ] || usage
24 while getopts "s:" opt ; do
48 [ $1 == 0 ] && exit 1 || exit 0
52 if [ $TASK_TYPE == open-data ] ; then
53 [ -n "$PART" ] || die "You need to specify test number for open data problems."
55 pstart "Test case $TEST: "
56 open-locate "$SRCFILE"
58 [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
59 try-ln "$SDIR/$SRCN" $TDIR/$TEST.out
61 test-result $POINTS_PER_TEST OK
64 [ -z "$PART" ] || die "Test number should be given only for open data problems."
65 locate-source "$SRCFILE"
67 for TEST in $SAMPLE_TESTS ; do
69 pstart "Checking on sample input $TEST: "
70 [ -f $PDIR/$TEST.config ] && . $PDIR/$TEST.config
74 die "How could I get there? It's a buuuuug!"
75 ) || FAILED=$(($FAILED+1))
79 if [ $FAILED != 0 ] ; then
80 if [ $FORCE != 0 ] ; then
82 pend "TESTS FAILED, but --force given, so submitting anyway."
84 pend "TESTS FAILED. Nothing has been submitted!"
85 pend "Use submit --force if you really want to submit an obviously WRONG solution."
90 if [ -n "$REMOTE_SUBMIT" ] ; then
91 pstart "Submitting to the server... "
92 $MO_ROOT/bin/remote-submit $PROBLEM $PART "$SDIR/$SRCN"
97 pstart "Submitting... "
99 if [ $TASK_TYPE == open-data ] ; then
100 mkdir -p ~/.submit/$PROBLEM
101 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/$PART.out
103 rm -rf ~/.submit/$PROBLEM
104 mkdir -p ~/.submit/$PROBLEM
105 cp "$SDIR/$SRCN" ~/.submit/$PROBLEM/