aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2019-05-05 16:04:14 +0200
committerQuentin Carbonneaux <[email protected]>2019-05-05 16:04:14 +0200
commit61309852742548b496d222cf4e3f2c5e1569e6dd (patch)
tree5d09e86f041cf3b6d76174087e563470a424ad12 /tools
parent7ba69be87b3910cac2a8cd1cfe021e58f57f58d7 (diff)
add asm diffing in test script
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/test.sh b/tools/test.sh
index 8abdb21..c2c25c5 100755
--- a/tools/test.sh
+++ b/tools/test.sh
@@ -2,11 +2,13 @@
dir=`cd $(dirname "$0"); pwd`
bin=$dir/../obj/qbe
+binref=$dir/../obj/qbe.ref
tmp=/tmp/qbe.zzzz
drv=$tmp.c
asm=$tmp.s
+asmref=$tmp.ref.s
exe=$tmp.exe
out=$tmp.out
@@ -109,6 +111,11 @@ once() {
return 1
fi
+ if test -x $binref
+ then
+ $binref -o $asmref $t 2>/dev/null
+ fi
+
extract driver $t > $drv
extract output $t > $out
@@ -143,6 +150,14 @@ once() {
fi
echo "[ok]"
+
+ if test -f $asmref && ! cmp -s $asm $asmref
+ then
+ loc0=`wc -l $asm | cut -d' ' -f1`
+ loc1=`wc -l $asmref | cut -d' ' -f1`
+ printf " asm diff: %+d\n" $(($loc0 - $loc1))
+ return 0
+ fi
}
#trap cleanup TERM QUIT