How do you create tests for “make check” with GNU autotools

后端 未结 5 1412
情歌与酒
情歌与酒 2021-02-01 16:03

I\'m using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type \"make check\" to have

5条回答
  •  梦毁少年i
    2021-02-01 16:51

    You seem to be asking 2 questions in the first paragraph.

    The first is about adding tests to the GNU autotools toolchain - but those tests, if I'm understanding you correctly, are for both validating that the environment necessary to build your application exists (dependent libraries and tools) as well as adapt the build to the environment (platform specific differences).

    The second is about unit testing your C++ application and where to invoke those tests, you've proposed doing so from the autotools tool chain, presumably from the configure script. Doing that isn't conventional though - putting a 'test' target in your Makefile is a more conventional way of executing your test suite. The typical steps for building and installing an application with autotools (at least from a user's perspective, not from your, the developer, perspective) is to run the configure script, then run make, then optionally run make test and finally make install.

    For the second issue, not wanting cppunit to be a dependency, why not just distribute it with your c++ application? Can you just put it right in what ever archive format you're using (be it tar.gz, tar.bz2 or .zip) along with your source code. I've used cppunit in the past and was happy with it, having used JUnit and other xUnit style frameworks.

提交回复
热议问题