]> mj.ucw.cz Git - eval.git/commitdiff
Implemented translation of FPC runtime errors to readable strings.
authorMartin Mares <mj@ucw.cz>
Thu, 5 Jul 2007 09:00:12 +0000 (11:00 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 5 Jul 2007 09:00:12 +0000 (11:00 +0200)
bin/lib
config

diff --git a/bin/lib b/bin/lib
index a186e1cd256e5c0c41c46967ebdf9690f3d18099..f85e52353fec131b8645f8313d0675d5ee4e7bdd 100644 (file)
--- a/bin/lib
+++ b/bin/lib
@@ -208,6 +208,23 @@ function test-result
                P=`cat $TDIR/$TEST.pts`
                rm $TDIR/$TEST.pts
        fi
                P=`cat $TDIR/$TEST.pts`
                rm $TDIR/$TEST.pts
        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"
        echo "Verdict: $M"
        echo "Points: $P"
        test-verdict $P "$M"
diff --git a/config b/config
index f03a7d0d28b97211c016db554ad51f4eae3ea9ff..785862ec8ee8b14ead88bb2170eae4b0011873d5 100644 (file)
--- a/config
+++ b/config
@@ -130,6 +130,9 @@ TEST_SANDBOX_OPTS='-a2 -f -m$MEM_LIMIT -t$TIME_LIMIT'
 # Sandbox initialization commands
 SANDBOX_INIT=
 
 # Sandbox initialization commands
 SANDBOX_INIT=
 
+# Translate FreePascal exit codes to names of well-known runtime errors
+FREE_PASCAL_RTE=1
+
 # DEBUG: Let `ev' run sample tests, too.
 #EV_SAMPLE=1
 
 # DEBUG: Let `ev' run sample tests, too.
 #EV_SAMPLE=1