From 61309852742548b496d222cf4e3f2c5e1569e6dd Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 5 May 2019 16:04:14 +0200 Subject: add asm diffing in test script --- tools/test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit 1.4.1