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

后端 未结 5 1490
情歌与酒
情歌与酒 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条回答
  •  别跟我提以往
    2021-02-01 16:47

    To make test run when you issue make check, you need to add them to the TESTS variable

    Assuming you've already built the executable that runs the unit tests, you just add the name of the executable to the TESTS variable like this:

    TESTS=my-test-executable
    

    It should then be automatically run when you make check, and if the executable returns a non-zero value, it will report that as a test failure. If you have multiple unit test executables, just list them all in the TESTS variable:

    TESTS=my-first-test my-second-test my-third-test
    

    and they will all get run.

提交回复
热议问题