automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to avoid stopping the recursive `check` target?


From: Philippe Proulx
Subject: How to avoid stopping the recursive `check` target?
Date: Tue, 8 Aug 2017 13:32:05 -0400

My project has the following directory structure (some files hidden for
clarity):

    Makefile.am
    tests/
      Makefile.am
      a/
        Makefile.am
      b/
        Makefile.am
      c/
        Makefile.am

If I put all the tests to run that are in the a/, b/, and c/
subdirectories in the TESTS variable of tests/Makefile.am, then with
`make check` in tests/, all the tests run, even if one test in one of
the subdirectories fail. Assume this is the behaviour I want.

With this configuration, however, I cannot go to b/, for example, and
run `make check`: since there's no TESTS variable there, `make check`
does nothing.

So I put a TESTS variable in a/Makefile.am, b/Makefile.am, and
c/Makefile.am, and remove the TESTS variable from tests/Makefile.am. Now
I can go to a/, b/, or c/ and run `make check` to test only specific
parts of the project. However, since each individual `make check` can
fail, now the "global" `make check` in tests/ fails as soon as one
subdirectory fails, which is the expected behaviour of Make.

My current workaround is to use `make --keep-going check` in tests/, so
that, as per make(1):

    Continue as much as possible after an error.  While the target that
    failed, and those that depend on it, can‐ not be remade, the other
    dependencies of these targets can be processed all the same.

This seems to run all the individual `make check` and exit with
something else than 0 if one of them fails.

I can also wrap this `make --keep-going check` in a new target, for
example:

    test:
            $(MAKE) $(AM_MAKEFLAGS) --keep-going check

Now `make test` does what I want in tests/.

Is there anything more "Automaky" I could do to achieve the same goal?
Or is using `make --keep-going check` the expected method here if I
don't want Make to stop as soon as one subdirectory test fails?

Thank you for your time,
Phil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]