1 # The Evaluator -- Public Submit Script
2 # (c) 2001--2004 Martin Mares <mj@ucw.cz>
5 [ -n "$MO_PUBLIC" -a -d "$MO_PUBLIC" ] || { echo >&2 "MO_PUBLIC not set, giving up." ; exit 1 ; }
10 if [ "$1" = --force ] ; then
14 [ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] <problem> [<test-number>]"
22 [ $1 == 0 ] && exit 1 || exit 0
26 if [ $TASK_TYPE == open-data ] ; then
27 [ -n "$2" ] || die "You need to specify test number for open data problems."
29 pstart "Test case $TEST: "
32 ln $SRCN $TDIR/$TEST.out
37 [ -z "$2" ] || die "Test number should be given only for open data problems."
40 for TEST in $SAMPLE_TESTS ; do
42 pstart "Checking on sample input $TEST: "
46 die "How could I get there? It's a buuuuug!"
47 ) || FAILED=$(($FAILED+1))
51 if [ $FAILED != 0 ] ; then
52 if [ $FORCE != 0 ] ; then
53 pend "TESTS FAILED, but --force given, so submitting anyway."
55 pend "TESTS FAILED. Nothing has been submitted!"
56 pend "Use submit --force if you really want to submit an obviously WRONG solution."
61 pstart "Submitting... "
63 if [ $TASK_TYPE == open-data ] ; then
64 mkdir -p ~/.submit/$PROBLEM
65 cp $SRCN ~/.submit/$PROBLEM/$TEST.out
67 rm -rf ~/.submit/$PROBLEM
68 mkdir -p ~/.submit/$PROBLEM
69 cp $SRCN ~/.submit/$PROBLEM/