summaryrefslogtreecommitdiff
path: root/tests/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.sh')
-rwxr-xr-xtests/test.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test.sh b/tests/test.sh
index ceb6cbe..9224ee3 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-DIR=$(dirname $0)
+DIR=$(pwd)/$(dirname $0)
TOC=$DIR/../toc
CFLAGS="-g -Wno-parentheses-equality"
echo $$
@@ -15,15 +15,15 @@ compile() {
}
do_tests() {
+ cd "$DIR/$1"
valgrind -q --exit-on-first-error=yes --error-exitcode=1 $TOC "$DIR/$1/$1.toc" -o "$DIR/$1/$1.c" >/dev/null || exit 1
for CC in "gcc -O0 -g" "tcc" "clang -O3 -s"; do
printf "Running test $1 with C compiler $CC... "
compile "$1"
- cd "$DIR/$1"
./test.sh || { printf "\x1b[91mfailed!\x1b[0m\n"; exit 1; }
printf '\x1b[92mpassed!\x1b[0m\n'
- cd $STARTPWD
done
+ cd $STARTPWD
}
@@ -34,3 +34,4 @@ do_tests arr
do_tests arr2
do_tests foreign
do_tests params
+do_tests nms