aboutsummaryrefslogtreecommitdiff
path: root/runtests
blob: 4b92de6b88c47db123034ac3fea62661327f9905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

if [ $# = 0 ] ; then
	set -- test/*.c
fi

numfail=0
out=$(mktemp)
trap 'rm "$out"' EXIT
for test ; do
	if ${CCQBE:=./cproc-qbe} -o $out $test && diff -Nu "${test%.c}.qbe" "$out" ; then
		result="PASS"
	else
		result="FAIL"
		numfail=$((numfail + 1))
	fi
	echo "[$result] $test" >&2
done

if [ "$numfail" -gt 0 ] ; then
	printf "%d test(s) failed\n" "$numfail"
	exit 1
fi