X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=bin%2Flib;h=c9a7f27a6e36be9494b8718cef9c1b6a711fcdb8;hb=41059938d4d279dbb3c6bf6712f8c84759f5d5c0;hp=a186e1cd256e5c0c41c46967ebdf9690f3d18099;hpb=785567d13d74d89796cb251b1945fe9a0ab39220;p=moe.git diff --git a/bin/lib b/bin/lib index a186e1c..c9a7f27 100644 --- a/bin/lib +++ b/bin/lib @@ -208,6 +208,31 @@ function test-result P=`cat $TDIR/$TEST.pts` 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 + N="Runtime error $RE" + case "$RE" in + 200) M="$N: Division by zero" ;; + 201) M="$N: Range check error" ;; + 202) M="$N: Stack overflow" ;; + 203) M="$N: Heap overflow" ;; + 205) M="$N: Floating point overflow" ;; + 215) M="$N: Arithmetic overflow" ;; + 216) M="$N: Segmentation fault" ;; + ???) M="$N" ;; + esac + fi + echo "Verdict: $M" echo "Points: $P" test-verdict $P "$M" @@ -219,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= @@ -269,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 @@ -318,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 } @@ -334,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 @@ -353,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