From bc146dd87d43e294fd477f92f20e8dd43da83f21 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 5 Jul 2007 11:00:12 +0200 Subject: [PATCH] Implemented translation of FPC runtime errors to readable strings. --- bin/lib | 17 +++++++++++++++++ config | 3 +++ 2 files changed, 20 insertions(+) diff --git a/bin/lib b/bin/lib index a186e1c..f85e523 100644 --- a/bin/lib +++ b/bin/lib @@ -208,6 +208,23 @@ function test-result 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" diff --git a/config b/config index f03a7d0..785862e 100644 --- a/config +++ b/config @@ -130,6 +130,9 @@ TEST_SANDBOX_OPTS='-a2 -f -m$MEM_LIMIT -t$TIME_LIMIT' # 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 -- 2.39.2