]> mj.ucw.cz Git - eval.git/blobdiff - bin/lib
Translate names of suicidial signals, too.
[eval.git] / bin / lib
diff --git a/bin/lib b/bin/lib
index f85e52353fec131b8645f8313d0675d5ee4e7bdd..c9a7f27a6e36be9494b8718cef9c1b6a711fcdb8 100644 (file)
--- a/bin/lib
+++ b/bin/lib
@@ -209,6 +209,14 @@ function test-result
                rm $TDIR/$TEST.pts
        fi
 
+       # Translate signal numbers to readable strings
+       SG=${M#Caught fatal signal }
+       SG=${SG#Committed suicide by signal }
+       if [ "$SG" != "$M" ] ; then
+               SG=`perl -MConfig -e '@s=split / /,$Config{sig_name}; print $s[$ARGV[0]]' $SG`
+               [ -z "$SG" ] || M="$M (SIG$SG)"
+       fi
+
        # Translate Free Pascal runtime errors to readable strings
        RE=${M#Exited with error status }
        if [ "$FREE_PASCAL_RTE" == 1 -a "$RE" != "$M" ] ; then
@@ -236,7 +244,7 @@ function test-prolog
        box-clean
        echo "Executable file: $TDIR/$PROBLEM"
        if [ ! -x $TDIR/$PROBLEM ] ; then
-               test-result 0 "Compile error."
+               test-result 0 "Compile error"
        fi
        cp $TDIR/$PROBLEM $BOXDIR/
        BOX_EXTRAS=
@@ -286,10 +294,10 @@ function test-epilog
        echo "Sandbox contents after exit:"
        ls -Al $BOXDIR
        case ${OUT_TYPE:-$IO_TYPE} in
-               file)   [ -f $BOXDIR/$PROBLEM.out ] || test-result 0 "No output file."
+               file)   [ -f $BOXDIR/$PROBLEM.out ] || test-result 0 "No output file"
                        cp $BOXDIR/$PROBLEM.out $TDIR/$TEST.out
                        ;;
-               stdio)  [ -f $BOXDIR/.stdout ] || test-result 0 "No output file."
+               stdio)  [ -f $BOXDIR/.stdout ] || test-result 0 "No output file"
                        cp $BOXDIR/.stdout $TDIR/$TEST.out
                        ;;
        esac
@@ -335,7 +343,7 @@ function test-run-interactive
 
 function test-run-open-data
 {
-       [ -f $SDIR/$TEST.out ] || test-result 0 "No solution."
+       [ -f $SDIR/$TEST.out ] || test-result 0 "No solution"
        ln $SDIR/$TEST.out $TDIR/$TEST.out
 }
 
@@ -351,7 +359,7 @@ function syntax-check
        if ! eval $SCHECK 2>$TMPDIR/exec.out ; then
                cat $TMPDIR/exec.out
                MSG=`tail -1 $TMPDIR/exec.out`
-               if [ -z "$MSG" ] ; then MSG="Wrong syntax." ; fi
+               if [ -z "$MSG" ] ; then MSG="Wrong syntax" ; fi
                test-result 0 "$MSG"
        fi
        cat $TMPDIR/exec.out
@@ -370,7 +378,7 @@ function output-check
                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
+                       if [ -z "$MSG" ] ; then MSG="Wrong answer" ; fi
                        test-result 0 "$MSG"
                fi
                cat $TMPDIR/exec.out