5

Whenever I call 'waf clean', waf ends up cleaning everything from the build. I would like to have a way to tell waf to only clean specific targets. This way I wont have to rebuild everything whenever I would like to just run all the unit tests again.

For example,

If I had the following folder structure:

src
   -acceptanceTests
   -applicationA
      -tests
   -shared
      -tests

When running waf, applicationA gets built and all its tests get run. Afterwards I run the acceptanceTests which do some higher level testing of applicationA. I then go and change some code in applicationA and do a recompile.

I would then like to run the acceptanceTests again, but none of the acceptanceTests have changed so waf will not rebuild and run them. Triggering 'waf clean' clears out everything in applicationA, shared, and acceptanceTests which is not ideal. Instead I would like to be able to run a 'waf cleanAcceptanceTests' command which should only clean the acceptanceTests directory.

1 Answers1

0

There is many ways to achieve that:

  • add some specific clean_acceptance_tests context to handle that.
  • add an option to force the acceptance test to run (--force-acceptance-test). You can use the 'always = force_acceptance_test' attribute of rule based task generator or add the thing to your own task generator by using the waflib.Task.always_run Task decorator.
neuro
  • 14,948
  • 3
  • 36
  • 59
  • I would be very interested to know how to create the specific context. I was able to create a specific context which only removed the acceptanceTests directory but on the next build the tests were not run, unless I added 'self.root.children={}' which would cause everything to rebuild. For now I found out there is a '--alltests' flag I can use to rerun everything without rebuilding at all. – Adam Dickin Feb 19 '14 at 16:47
  • Considering only the WAF documents and its existing functionality, and ignoring any concrete/specific use case that the OP happened to augment this scenario with: The OP is asking for a means of using "waf clean.... target=..." as a logical and corresponding aspect of the "waf build ... target=..." existing functionality of WAF. – Jordan Stefanelli Oct 25 '18 at 09:19