X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=public%2Fsubmit;h=bdd475f7a512633d12033c62b7bcb27bb523071e;hb=b9ff9e0a4370eca27410e0295682d806576a42be;hp=15dd21742e9428c932c3cf0862d4fb088d9985c8;hpb=c119e07ea8001ba944e6d9c33e4e73f98fe750ee;p=moe.git diff --git a/public/submit b/public/submit index 15dd217..bdd475f 100644 --- a/public/submit +++ b/public/submit @@ -6,20 +6,46 @@ set -e . $MO_PUBLIC/bin/lib . $MO_PUBLIC/config -[ -n "$1" ] || die "Usage: submit " +FORCE=0 +if [ "$1" = --force ] ; then + FORCE=1 + shift +fi +[ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] []" PROBLEM=$1 public-setup . $PDIR/config -locate-source -compile -TEST=$SAMPLE_TEST PTSFILE=$TDIR/points -pstart "Checking on sample input: " -test-run -syntax-check -pend "OK" -pstart "Submiting: " +FAILED=0 +if [ -n "$OPEN_DATA_PROBLEM" ] ; then + [ -n "$2" ] || die "You need to specify test number for open data problems." + TEST=$2 + open-locate + syntax-check || FAILED=1 +else + [ -z "$2" ] || die "No test number should be specified for normal problems." + locate-source + compile + for TEST in $SAMPLE_TESTS ; do + pstart "Checking on sample input $TEST: " + if test-run && syntax-check && output-check ; then + pend "OK" + else + FAILED=$(($FAILED+1)) + fi + done +fi +pstart "Submitting... " +if [ $FAILED != 0 ] ; then + if [ $FORCE != 0 ] ; then + pcont "(tests failed, but --force given) " + else + pend "TESTS FAILED Use submit --force if you really want to submit a wrong solution." + exit 1 + fi +fi +mkdir -p ~/.submit +[ -z "$OPEN_DATA_PROBLEM" ] && rm -rf ~/.submit/$PROBLEM mkdir -p ~/.submit/$PROBLEM -rm -rf ~/.submit/$PROBLEM/* cp $SRCN ~/.submit/$PROBLEM/ pend "OK"