EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: tapfiles double-colon rule
From: "Johnson, Andrew N. via Core-talk" <core-talk at aps.anl.gov>
To: Ralph Lange <ralph.lange at gmx.de>
Cc: EPICS core-talk <core-talk at aps.anl.gov>
Date: Mon, 20 Apr 2020 21:37:56 +0000
On Apr 20, 2020, at 2:48 PM, Ralph Lange via Core-talk <core-talk at aps.anl.gov> wrote:

The problem withe the existing runtests target is that it depends on files and has a recipe.
With that setup, there is no way to add a different recipe for different files.
Unless you make it a double colon rule, which basically treats it like a completely separate thing. (The Make doc says: "Double-colon rules are somewhat obscure and not often very useful; they provide a mechanism for cases in which the method used to update a target differs depending on which prerequisite files caused the update." - which exactly describes that case.

I have no problem in changing some of the other rules to make the build system more extensible, I would actually prefer that to introducing a double-colon rule here. The only limitations I see us having to work within here are to not change the meaning of the existing Makefile variables, do you know of any others problems with changing the internals?

I was hoping we might be able to make something that would work with the existing runtests rule, but I see that I was, this can’t be made to work since the existing recipe’s $^ will include the name of new intermediate target which the Perl code won’t like. By adding an intermediate target for running the tap tests though that problem goes away. There’s also no need for a conditional around the rule’s action since the above Perl does nothing if TESTSCRIPTS is empty, but we can simplify the above and just use $(PROVE) if we never run it when the list is empty:

-ifneq ($(strip $(TESTSCRIPTS)),)
-runtests:: $(TESTSCRIPTS)
+runtests: run-tap-tests
+run-tap-tests: $(TESTSCRIPTS)
+ifneq ($(TESTSCRIPTS),)
 ifdef RUNTESTS_ENABLED
-       -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^
+       $(PROVE) --failures --color $^



The problem with your suggested pattern is that when the ...dependencies... don't exist, the intermediate phony target gets executed unconditionally, probably failing as the variables for prerequisites are empty.

My point was not so much what your run-gtests rule looks like, but just the introduction of it as an intermediate target that will be called in addition to or instead of the run-tap-tests rule.


Also, any rules for the generation of the report files should be pattern rules that only apply to the expected targets. It is very hard to work around something like the existing implicit "%.xml: %.tap" rule when - like in the Google Test case - the test executable creates both xml and tap output directly.

That’s fine, I don’t see a problem with using pattern rules for these, see below.

BTW since Perl TESTSCRIPTS were all supposed to be named *.t we can open up additional suffixes for other test systems. I would introduce a filter like this (which also avoids the need to use strip):

-TAPFILES += $(TESTSCRIPTS:.t=.tap)
+TESTSCRIPTS.t = $(filter %.t, $(TESTSCRIPTS))
+TAPFILES += $(TESTSCRIPTS.t:.t=.tap)

and use the variable TESTSCRIPTS.t instead in the run-tap-tests rule above and here:

-tapfiles: $(TESTSCRIPTS) $(TAPFILES)
+tapfiles: $(TESTSCRIPTS.t) $(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 $< $*

Does this look acceptable, or at least promising?

- Andrew



On Mon, 20 Apr 2020 at 19:40, Johnson, Andrew N. <anj at anl.gov> wrote:
Hi Ralph,

You committed this to the 3.15 branch last week:

commit cbf917e8332d620b6a2f60ea9822d1f84467ef28
Author: Ralph Lange <ralph.lange at gmx.de>
Date:   Thu Apr 16 12:04:16 2020 +0200

    Improve automated testing rules to allow other test frameworks
    
    - make runtests a double-colon rule, so that other test frameworks
      can add their own recipes independently
    - only define runtests:: $TESTSCRIPTS rule when there are TESTSCRIPTS
      (to avoid having it run every time when no TESTSCRIPTS are defined)
    - $(strip $TAPFILES) inside ifneq to fix trouble when TAPFILES=' '

I would like to undo the double-colon change, it is never actually necessary and double-colon rules can cause problems, although I’m not exactly sure what specific issues caused Janet to very deliberately change the clean rule back from a double-colon to a single-colon rule again (it was single-colon in earlier versions).

You can add additional recipes for the runtests target without them clashing with the existing one by adding intermediate targets, e.g.:

runtests: run-gtests

run-gtests: ...dependencies...
...commands...

With that modification I don’t think your other changes are required either, although I could be wrong. If you want I could add a similar intermediary for the tap-tests.

BTW take a look at the new pre-make and test-results recipes I’m considering adding to RULES_TOP in https://github.com/epics-base/epics-base/compare/3.15...anjohnson:appveyor?expand=1. pre-make may be a bad name, it gets run by RULES_DIRS before any recursion into a subdirectory; I needed it to clean out the new test summary file which the new test-results recipe displays and uses to mark test failures as an error. The exact behavior of the testFailures.pl script could be changed, but the idea is to collect all the test failures and have the test-results target print them out at the end of the build rather than bury them higher up. I realized these were needed after my last commit to the 3.15 branch which stopped the test-results target from ever failing; I wanted it to display all the results before test-results stopped, and for some reason ‘make -k’ isn’t doing that properly on the 7.0 builds.

Comments and suggestions on that welcome. For some reason Appveyor was failing most of my builds of this over the weekend but they’re passing now, I don’t think the two commits I made should have changed anything though.

- Andrew

-- 
Complexity comes for free, simplicity you have to work for.


-- 
Complexity comes for free, simplicity you have to work for.


Replies:
Re: tapfiles double-colon rule Ben Franksen via Core-talk
References:
tapfiles double-colon rule Johnson, Andrew N. via Core-talk
Re: tapfiles double-colon rule Ralph Lange via Core-talk

Navigate by Date:
Prev: Re: tapfiles double-colon rule Ralph Lange via Core-talk
Next: Build failed: epics-base base-appveyor-15 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: tapfiles double-colon rule Ralph Lange via Core-talk
Next: Re: tapfiles double-colon rule Ben Franksen via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 21 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·