summary refs log tree commit diff
path: root/lisc/tools
diff options
context:
space:
mode:
Diffstat (limited to 'lisc/tools')
-rwxr-xr-xlisc/tools/abitest.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisc/tools/abitest.sh b/lisc/tools/abitest.sh
new file mode 100755
index 0000000..164aff2
--- /dev/null
+++ b/lisc/tools/abitest.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+OCAML=/usr/bin/ocaml
+QBE=lisc
+TMP=`mktemp -d abifuzz.XXXXXX`
+
+failure() {
+	echo "Failure at stage:" $1 >&2
+	exit 1
+}
+
+if ! test -x $QBE
+then
+	echo "error: I must run in the directory containing $QBE." >&2
+	exit 1
+fi
+
+	$OCAML tools/abi.ml $TMP c ssa
+	./$QBE -o $TMP/callee.s $TMP/callee.ssa         || failure "qbe"
+	c99 -o $TMP/abitest $TMP/caller.c $TMP/callee.s || failure "cc + linking"
+	$TMP/abitest                                    || failure "runtime"
+
+rm -fr $TMP