Revert the runtests:: change but in an extensible way

Use only %.t files in new TESTSCRIPTS.t var for Perl tests.
TAPFILES and JUNITFILES can be appended to by other rules.
The runtests and test-results rules have no direct recipes.
Added run-tap-tests and tap-results rules, simlified recipe.
Make %.tap:%.t and %.xml:%.tap into static pattern rules.
This commit is contained in:
Andrew Johnson
2020-04-21 01:39:59 -05:00
parent d05d8807ec
commit dfbda1394d

View File

@@ -108,11 +108,12 @@ TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME)
# Test result files
#
# Enable testing if this host can run tests on the current target
ifneq (,$(findstring $(T_A),$(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS)))
# Enable testing if this host can run tests for the current target
ifneq (,$(filter $(T_A), $(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS)))
RUNTESTS_ENABLED = YES
TAPFILES += $(TESTSCRIPTS:.t=.tap)
JUNITFILES += $(TAPFILES:.tap=.xml)
TESTSCRIPTS.t = $(filter %.t, $(TESTSCRIPTS))
TAPFILES += $(TESTSCRIPTS.t:.t=.tap)
JUNITFILES += $(TESTSCRIPTS.t:.t=.xml)
endif
#---------------------------------------------------------------
@@ -332,17 +333,22 @@ $(MODNAME): %$(MODEXT): %$(EXE)
#---------------------------------------------------------------
# Automated testing
ifneq ($(strip $(TESTSCRIPTS)),)
runtests:: $(TESTSCRIPTS)
runtests: run-tap-tests
run-tap-tests: $(TESTSCRIPTS.t)
ifneq ($(TESTSCRIPTS.t),)
ifdef RUNTESTS_ENABLED
-$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^
$(PROVE) --failures --color $^ || $(PROVE_FAILURE)
endif
endif
test-results: tapfiles
tapfiles: $(TAPFILES)
junitfiles: $(JUNITFILES)
test-results: tap-results
tap-results: $(TAPFILES)
ifneq ($(strip $(TAPFILES)),)
ifdef RUNTESTS_ENABLED
-$(PROVE.tap) --failures --color $(TAPFILES) || $(PROVE_FAILURE)
$(PROVE.tap) --failures --color $^ || $(PROVE_FAILURE)
endif
CURRENT_TAPFILES := $(wildcard $(TAPFILES))
@@ -357,16 +363,13 @@ ifneq ($(CURRENT_JUNITFILES),)
$(RM) $(CURRENT_JUNITFILES)
endif
tapfiles: $(TESTSCRIPTS) $(TAPFILES)
junitfiles: $(JUNITFILES)
# A .tap file is the output from running the associated test script
%.tap: %.t
$(TAPFILES): %.tap: %.t
ifdef RUNTESTS_ENABLED
-$(PERL) $< -tap > $@
endif
%.xml: %.tap
$(JUNITFILES): %.xml: %.tap
$(TAPTOJUNIT) --puretap --output $@ --input $< $*
# If there's a perl test script (.plt) available, use it
@@ -513,8 +516,8 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: %
.PRECIOUS: $(COMMON_INC)
.PHONY: all host inc build install clean rebuild buildInstall build_clean
.PHONY: runtests tapfiles clean-tests test-results junitfiles
.PHONY: checkRelease warnRelease noCheckRelease
.PHONY: runtests run-tap-tests tapfiles junitfiles test-results tap-results
.PHONY: clean-tests checkRelease warnRelease noCheckRelease
endif # BASE_RULES_BUILD
# EOF RULES_BUILD