summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-21 13:42:16 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-21 13:42:16 -0400
commit890e85c8d1badedf4922260d369ba629fd4327ff (patch)
treec10f164bb4e4b41b751749e7e28d1d15b807c3e3
parente004f1dd48527bf6e46a5c3a72ee4d1ff8c1d18e (diff)
downloadroux-890e85c8d1badedf4922260d369ba629fd4327ff.tar.gz
add abitest.sh tool
-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