summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.inc18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/Makefile.inc b/tests/Makefile.inc
index 2da29c3768..bfd18060ab 100644
--- a/tests/Makefile.inc
+++ b/tests/Makefile.inc
@@ -141,17 +141,25 @@ $(alltests): export CMOCKA_XML_FILE=$(testobj)/junit-$(subst /,_,$^).xml
endif
$(alltests): $$($$(@)-bin)
- rm -f $(testobj)/junit-$(subst /,_,$^).xml
- ./$^
+ rm -f $(testobj)/junit-$(subst /,_,$^).xml $(testobj)/$(subst /,_,$^).failed
+ -./$^ || echo failed > $(testobj)/$(subst /,_,$^).failed
unit-tests: build-unit-tests run-unit-tests
build-unit-tests: $(test-bins)
run-unit-tests: $(alltests)
- echo "**********************"
- echo " ALL TESTS PASSED"
- echo "**********************"
+ if [ `find $(testobj) -name '*.failed' | wc -l` -gt 0 ]; then \
+ echo "**********************"; \
+ echo " TESTS FAILED"; \
+ echo "**********************"; \
+ exit 1; \
+ else \
+ echo "**********************"; \
+ echo " ALL TESTS PASSED"; \
+ echo "**********************"; \
+ exit 0; \
+ fi
$(addprefix clean-,$(alltests)): clean-%:
rm -rf $(obj)/$*