diff options
Diffstat (limited to 'tests/test.sh')
-rwxr-xr-x | tests/test.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test.sh b/tests/test.sh new file mode 100755 index 0000000..470251e --- /dev/null +++ b/tests/test.sh @@ -0,0 +1,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 |