summaryrefslogtreecommitdiff
path: root/tests/test.sh
blob: 470251e2b58a953fb978df2da83e97ae4f97ff19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
DIR=$(dirname $0)
TOC=$DIR/../toc
CFLAGS="-g -Wno-parentheses-equality"
if [ "$COMPILERS" = "" ]; then
	COMPILERS="gcc tcc clang"
fi

echo $$

compile() {
	$TOC $DIR/$1/$1.toc -o $DIR/$1/$1.c > /dev/null || exit 1
	$CC $EXTRA_CFLAGS $CFLAGS -o $DIR/$1/$1.bin $DIR/$1/$1.c || exit 1
}

STARTPWD="$(pwd)"

for CC in $COMPILERS; do

	for EXTRA_CFLAGS in "-O0 -g" "-O3 -s"; do
		echo "Running tests with C compiler $CC and flags $EXTRA_CFLAGS."
		printf "bf... "
		compile bf
		cd $DIR/bf
		./test.sh || exit 1
		echo "passed!"
		cd $STARTPWD
	done
done