]> mj.ucw.cz Git - eval.git/commitdiff
Fix evaluation of interactive programs.
authorMartin Mares <mj@ucw.cz>
Mon, 11 Jun 2007 20:52:30 +0000 (22:52 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 11 Jun 2007 20:52:30 +0000 (22:52 +0200)
TODO
bin/lib

diff --git a/TODO b/TODO
index 433b8c4e447d013245ddf71ee8bd88ce42a367ff..bb5d5e50600e847f70fa2cd5d6720829a3cc81c9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -7,6 +7,9 @@ interactive tasks: logging of messages
 rename problem to task
 submit, check: unify command-line arguments
 clean up retest utility
+document IA_CHECK
+bin/lib changes from mo-eval user
+writing of verdicts to stdout (include timing and check on interactive tasks, including judge errors)
 
 Environment
 ~~~~~~~~~~~
diff --git a/bin/lib b/bin/lib
index 87d7100305a837acde774fef69be09b65247f6dd..237a89139141f97ee4d9608cd9e00c92faa4d210 100644 (file)
--- a/bin/lib
+++ b/bin/lib
@@ -227,7 +227,7 @@ function test-prolog
                file)   echo "Input file: $PROBLEM.in (from $PDIR/$TEST.in)"
                        try-ln $PDIR/$TEST.in $TDIR/$TEST.in
                        cp $PDIR/$TEST.in $BOXDIR/$PROBLEM.in
-                       BOX_EXTRAS="$BOX_EXTRAS -i/dev/null"
+                       [ $TASK_TYPE == interactive ] || BOX_EXTRAS="$BOX_EXTRAS -i/dev/null"
                        ;;
                stdio)  echo "Input file: <stdin> (from $PDIR/$TEST.in)"
                        try-ln $PDIR/$TEST.in $TDIR/$TEST.in
@@ -241,7 +241,7 @@ function test-prolog
        esac
        case $OUT_TYPE in
                file)   echo "Output file: $PROBLEM.out"
-                       BOX_EXTRAS="$BOX_EXTRAS -o/dev/null"
+                       [ $TASK_TYPE == interactive ] || BOX_EXTRAS="$BOX_EXTRAS -o/dev/null"
                        ;;
                stdio)  echo "Output file: <stdout>"
                        BOX_EXTRAS="$BOX_EXTRAS -o.stdout"
@@ -301,7 +301,7 @@ function test-run-interactive
        echo "Interactive checker: $ICCMD"
        if ! $HDIR/bin/iwrapper $BOXCMD $BOXOPTS -- ./$PROBLEM @@ $ICCMD 2>$TMPDIR/exec.out ; then
                cat $TMPDIR/exec.out
-               MSG="`tail -1 $TMPDIR/exec.out`"
+               MSG="`head -1 $TMPDIR/exec.out`"
                test-result 0 "$MSG"
        fi
        cat $TMPDIR/exec.out
@@ -329,19 +329,21 @@ function syntax-check
 
 function output-check
 {
-       [ -n "$OUTPUT_CHECK" ] || return 0
-       pcont "<check> "
-       [ -f $PDIR/$TEST.out ] && try-ln $PDIR/$TEST.out $TDIR/$TEST.ok
-       OCHECK=`eval echo $OUTPUT_CHECK`
-       echo "Output check command: $OCHECK"
-       if ! eval $OCHECK 2>$TMPDIR/exec.out ; then
+       MSG=
+       if [ -n "$OUTPUT_CHECK" -a "$OUT_TYPE" != none ] ; then
+               pcont "<check> "
+               [ -f $PDIR/$TEST.out ] && ln $PDIR/$TEST.out $TDIR/$TEST.ok
+               OCHECK=`eval echo $OUTPUT_CHECK`
+               echo "Output check command: $OCHECK"
+               if ! eval $OCHECK 2>$TMPDIR/exec.out ; then
+                       cat $TMPDIR/exec.out
+                       MSG=`tail -1 $TMPDIR/exec.out`
+                       if [ -z "$MSG" ] ; then MSG="Wrong answer." ; fi
+                       test-result 0 "$MSG"
+               fi
                cat $TMPDIR/exec.out
                MSG=`tail -1 $TMPDIR/exec.out`
-               if [ -z "$MSG" ] ; then MSG="Wrong answer." ; fi
-               test-result 0 "$MSG"
        fi
-       cat $TMPDIR/exec.out
-       MSG=`tail -1 $TMPDIR/exec.out`
        if [ -z "$MSG" ] ; then MSG="OK" ; fi
        test-result $POINTS_PER_TEST "$MSG"
 }