Collect submodule test failures into the parent

Instead of displaying the failures from each submodule at the end
of testing that submodule, RULES_TOP suppresses the output when
it detects a parent module, and RULES_MODULES adds the children's
failure lists into the parent's list so they all get shown at the
end of the tests/results.
This commit is contained in:
Andrew Johnson
2020-05-27 01:43:40 -05:00
parent a6f85ffd1a
commit d41b3979fb
4 changed files with 25 additions and 6 deletions

View File

@@ -68,5 +68,6 @@ TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl
PROVE = $(PERL) $(TOOLS)/epicsProve.pl
PROVE.tap = $(PROVE) --ext .tap --exec "$(CAT)"
TEST_FAILURE_FILE = $(TOP)/.tests-failed
TEST_FAILURE_FILENAME = .tests-failed
TEST_FAILURE_FILE = $(TOP)/$(TEST_FAILURE_FILENAME)
PROVE_FAILURE = echo $(abspath .)>> $(TEST_FAILURE_FILE)

View File

@@ -23,7 +23,8 @@
# -include $(TOP)/../CONFIG_SITE.local
# Add checked-out submodules to DIRS
DIRS += $(subst /Makefile,,$(wildcard $(addsuffix /Makefile, $(SUBMODULES))))
LIVE_SUBMODULES = $(subst /Makefile,,$(wildcard $(addsuffix /Makefile, $(SUBMODULES))))
DIRS += $(LIVE_SUBMODULES)
include $(CONFIG)/RULES_DIRS
@@ -45,3 +46,13 @@ realclean:
$(RM) $(wildcard RELEASE.*.local)
.PHONY: RELEASE.host realclean
# Append all our live submodule failure files
FAILURE_FILES = $(addsuffix /$(TEST_FAILURE_FILENAME), $(LIVE_SUBMODULES))
runtests: | $(addsuffix $(DIVIDER)runtests, $(LIVE_SUBMODULES))
@$(TOUCH) $(FAILURE_FILES)
@$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE)
test-results: | $(addsuffix $(DIVIDER)test-results, $(LIVE_SUBMODULES))
@$(TOUCH) $(FAILURE_FILES)
@$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE)

View File

@@ -50,6 +50,9 @@ uninstall$(DIVIDER)%:
$(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \
$(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB))
runtests test-results:
@$(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE)
else
#
# Using a disabled rule aborts
@@ -63,8 +66,7 @@ endif # DISABLE_TOP_RULES
before-runtests before-test-results: rm-failure-file
rm-failure-file:
@$(RM) $(TEST_FAILURE_FILE)
runtests test-results:
$(PERL) $(TOOLS)/testFailures.pl $(TEST_FAILURE_FILE)
@$(TOUCH) $(TEST_FAILURE_FILE)
help:
@echo "Usage: gnumake [options] [target] ..."

View File

@@ -22,12 +22,17 @@ use warnings;
die "Usage: testFailures.pl .tests-failed\n"
unless @ARGV == 1;
# No file means success.
open FAILURES, '<', shift or
exit 0;
my @failures = <FAILURES>;
chomp(my @failures = <FAILURES>);
close FAILURES;
# A file with just empty lines also mean success
my @dirs = grep {$_} @failures;
exit 0 unless @dirs;
print "\nTest failures were reported in:\n",
(map {" $_"} @failures), "\n";
(map {" $_\n"} @dirs), "\n\n";
exit 1;