diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 20:09:09 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-05 20:09:09 +0100 |
| commit | d1aaa9264089fa64a98eecef09aa4a5d9773e345 (patch) | |
| tree | aece8dd4dfc27e0368c9f2370d89caddedac6d4d | |
| parent | 0c9a5d0e5c1702d07b24eeac181f78d1689c05cc (diff) | |
| download | nissy-core-d1aaa9264089fa64a98eecef09aa4a5d9773e345.tar.gz nissy-core-d1aaa9264089fa64a98eecef09aa4a5d9773e345.zip | |
make test improvements
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README.md | 9 | ||||
| -rwxr-xr-x | test/test.sh | 5 |
3 files changed, 14 insertions, 2 deletions
| @@ -12,7 +12,7 @@ clean: | |||
| 12 | rm -rf *.o | 12 | rm -rf *.o |
| 13 | 13 | ||
| 14 | test: debugcube.o | 14 | test: debugcube.o |
| 15 | CUBETYPE=${CUBETYPE} ./test/test.sh | 15 | CUBETYPE=${CUBETYPE} TEST=${TEST} ./test/test.sh |
| 16 | 16 | ||
| 17 | benchmark: cube.o | 17 | benchmark: cube.o |
| 18 | CUBETYPE=${CUBETYPE} ./benchmark/bench.sh | 18 | CUBETYPE=${CUBETYPE} ./benchmark/bench.sh |
| @@ -20,7 +20,14 @@ Then | |||
| 20 | $ make test | 20 | $ make test |
| 21 | ``` | 21 | ``` |
| 22 | 22 | ||
| 23 | to run the tests. You can also run | 23 | to run the tests. You can also run only the tests that match a chosen |
| 24 | regex, for example: | ||
| 25 | |||
| 26 | ``` | ||
| 27 | $ TEST=coord make test | ||
| 28 | ``` | ||
| 29 | |||
| 30 | You can also run | ||
| 24 | 31 | ||
| 25 | ``` | 32 | ``` |
| 26 | $ make benchmark | 33 | $ 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 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | re="${TEST:-$@}" | ||
| 4 | |||
| 3 | CC="cc -DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra \ | 5 | CC="cc -DDEBUG -std=c99 -pthread -pedantic -Wall -Wextra \ |
| 4 | -Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE" | 6 | -Wno-unused-parameter -Wno-unused-function -g3 -D$CUBETYPE" |
| 5 | if [ "$CUBETYPE" = "CUBE_AVX2" ]; then | 7 | if [ "$CUBETYPE" = "CUBE_AVX2" ]; then |
| @@ -15,6 +17,9 @@ TESTERR="test/last.err" | |||
| 15 | CUBEOBJ="debugcube.o" | 17 | CUBEOBJ="debugcube.o" |
| 16 | 18 | ||
| 17 | for t in test/*; do | 19 | for t in test/*; do |
| 20 | if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then | ||
| 21 | continue | ||
| 22 | fi | ||
| 18 | if [ ! -d $t ]; then continue; fi | 23 | if [ ! -d $t ]; then continue; fi |
| 19 | $CC -o $TESTBIN $t/*.c $CUBEOBJ || exit 1; | 24 | $CC -o $TESTBIN $t/*.c $CUBEOBJ || exit 1; |
| 20 | for cin in $t/*.in; do | 25 | for cin in $t/*.in; do |
