commit d1aaa9264089fa64a98eecef09aa4a5d9773e345
parent 0c9a5d0e5c1702d07b24eeac181f78d1689c05cc
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 5 Nov 2023 20:09:09 +0100
make test improvements
Diffstat:
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -12,7 +12,7 @@ clean:
rm -rf *.o
test: debugcube.o
- CUBETYPE=${CUBETYPE} ./test/test.sh
+ CUBETYPE=${CUBETYPE} TEST=${TEST} ./test/test.sh
benchmark: cube.o
CUBETYPE=${CUBETYPE} ./benchmark/bench.sh
diff --git a/README.md b/README.md
@@ -20,7 +20,14 @@ Then
$ make test
```
-to run the tests. You can also run
+to run the tests. You can also run only the tests that match a chosen
+regex, for example:
+
+```
+$ TEST=coord make test
+```
+
+You can also run
```
$ make benchmark
diff --git a/test/test.sh b/test/test.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+re="${TEST:-$@}"
+
CC="cc -DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra \
-Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE"
if [ "$CUBETYPE" = "CUBE_AVX2" ]; then
@@ -15,6 +17,9 @@ TESTERR="test/last.err"
CUBEOBJ="debugcube.o"
for t in test/*; do
+ if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then
+ continue
+ fi
if [ ! -d $t ]; then continue; fi
$CC -o $TESTBIN $t/*.c $CUBEOBJ || exit 1;
for cin in $t/*.in; do