From bf1145e616175ec06be38fe846ed5af505015a1f Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 16 May 2001 09:54:33 +0000 Subject: [PATCH] Implemented submit --force --- TODO | 2 -- examples/problems/sum/config | 2 +- public/submit | 31 ++++++++++++++++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 0eca57f..a4c67ce 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ --static ? mo-install: don't copy private test data to public disable `write' command /tmp @@ -10,5 +9,4 @@ shift+sipky v rhide Delete key rhide: debugging Pascal programs: variable names must be upper-cased script na vyhazovani uzivatelu na konci souteze -submitovani uloh, ktere nefunguji pro sample input? lepsi time limity diff --git a/examples/problems/sum/config b/examples/problems/sum/config index cab1bc2..c22fc21 100644 --- a/examples/problems/sum/config +++ b/examples/problems/sum/config @@ -5,7 +5,7 @@ TESTS="1 2" # Test with example input -SAMPLE_TEST=1 +SAMPLE_TESTS=1 # Number of points per test POINTS_PER_TEST=1 diff --git a/public/submit b/public/submit index 837d43c..dfdbb13 100644 --- a/public/submit +++ b/public/submit @@ -6,21 +6,38 @@ 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 PTSFILE=$TDIR/points +FAILED=0 for TEST in $SAMPLE_TESTS ; do pstart "Checking on sample input $TEST: " - test-run - syntax-check - pend "OK" + if test-run && syntax-check ; then + pend "OK" + else + FAILED=$(($FAILED+1)) + fi done -pstart "Submiting: " -mkdir -p ~/.submit/$PROBLEM -rm -rf ~/.submit/$PROBLEM/* +pstart "Submiting... " +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 +rm -rf ~/.submit/$PROBLEM +mkdir ~/.submit/$PROBLEM cp $SRCN ~/.submit/$PROBLEM/ pend "OK" -- 2.39.2