tests: Always run all unit tests
So far, the semantics have been that run-unit-tests stopped at the first
test suite that failed. This hides useful signal in later tests, so
always run all tests and collect the result.
Change-Id: I407715f85513c2c95a1cf89cfb427317dff9fbab
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41773
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jan Dabros <jsd@semihalf.com>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/tests/Makefile.inc b/tests/Makefile.inc
index 2da29c3..bfd1806 100644
--- a/tests/Makefile.inc
+++ b/tests/Makefile.inc
@@ -141,17 +141,25 @@
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)/$*