Better finalt test summary
[libisds.git] / test / Makefile
blob145cac868a12cf80821bd597231778da7f9d3ac6
1 include ../src/Makefile.inc
2 CFLAGS += -I../src
3 OBJS := $(wildcard ../src/*.o)
4 SRCS := $(wildcard *.c)
5 TESTS := $(SRCS:%.c=%.test)
7 %.o: %.c test.h
8 $(CC) $(CFLAGS) $< -c -o $@
9 %.test: %.o
10 $(CC) $(LDFLAGS) $< $(OBJS) -o $@
12 all: $(TESTS)
14 test: $(TESTS)
15 @FAILED=0; \
16 for T in $^; do "./$$T" || FAILED=$$((FAILED+1)); done; \
17 if [ "$$FAILED" -gt "0" ]; then \
18 UNIT="unit tests"; \
19 test "$$FAILED" == "1" && UNIT="unit test"; \
20 echo "*** $$FAILED $$UNIT failed. Please tell developers about it."; \
21 echo "Your report can make this world better!"; \
22 exit 1; \
23 else \
24 echo "*** All tests passed. Today's your lucky day :)"; \
25 exit 0; \
28 clean:
29 -rm *.test *.o