Skip to content

Commit 0f9285b

Browse files
committed
make : improve test target
- add a dependency on the test executables - indicate to the user when some tests have failed
1 parent c9c3220 commit 0f9285b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ endif
4242

4343
default: $(BUILD_TARGETS)
4444

45-
test:
45+
test: $(TEST_TARGETS)
4646
@echo "Running tests..."
47-
@for test_target in $(TEST_TARGETS); do \
47+
@failures=0; \
48+
for test_target in $(TEST_TARGETS); do \
4849
if [ "$$test_target" = "tests/test-tokenizer-0-llama" ]; then \
4950
./$$test_target $(CURDIR)/models/ggml-vocab-llama.gguf; \
5051
elif [ "$$test_target" = "tests/test-tokenizer-0-falcon" ]; then \
@@ -54,8 +55,15 @@ test:
5455
else \
5556
./$$test_target; \
5657
fi; \
57-
done
58-
@echo "All tests have been run."
58+
if [ $$? -ne 0 ]; then \
59+
failures=$$(( failures + 1 )); \
60+
fi; \
61+
done; \
62+
if [ $$failures -gt 0 ]; then \
63+
printf '\n%%s tests failed.\n' $$failures; \
64+
exit 1; \
65+
fi
66+
@printf '\nAll tests passed.\n'
5967

6068
all: $(BUILD_TARGETS) $(TEST_TARGETS)
6169

0 commit comments

Comments
 (0)