From d1aaa9264089fa64a98eecef09aa4a5d9773e345 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 5 Nov 2023 20:09:09 +0100 Subject: make test improvements --- Makefile | 2 +- README.md | 9 ++++++++- test/test.sh | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 09967ea..4afb030 100644 --- 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 index d829af4..383b50c 100644 --- 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 index 1ee972d..a018401 100755 --- 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 -- cgit v1.3