]> mj.ucw.cz Git - moe.git/commitdiff
Implemented submit --force
authorMartin Mares <mj@ucw.cz>
Wed, 16 May 2001 09:54:33 +0000 (09:54 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 16 May 2001 09:54:33 +0000 (09:54 +0000)
TODO
examples/problems/sum/config
public/submit

diff --git a/TODO b/TODO
index 0eca57f40bc3606fb6c30eaf2825b75c3259095a..a4c67ce85e3eaa28b45f4fb8639ea8af886526c0 100644 (file)
--- 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
index cab1bc200e2d4c0106ad3aa4ff01faa145ddb4b4..c22fc21abc4a5d7c6628edf0a4ee7a2af6d74c5a 100644 (file)
@@ -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
index 837d43cc34a624eaf99a99994976fcd67201585f..dfdbb13d9d76ea5b914cc013fb99415a6fa0f8f9 100644 (file)
@@ -6,21 +6,38 @@ set -e
 . $MO_PUBLIC/bin/lib
 . $MO_PUBLIC/config
 
-[ -n "$1" ] || die "Usage: submit <problem>"
+FORCE=0
+if [ "$1" = --force ] ; then
+       FORCE=1
+       shift
+fi
+[ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] <problem>"
 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"