libqbe/lisc/tools/abitest.sh
Quentin Carbonneaux 890e85c8d1 add abitest.sh tool
2016-03-21 13:42:16 -04:00

23 lines
484 B
Bash
Executable file

#!/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