你如何创建&QUOT测试;请检查"与GNU自动工具 [英] How do you create tests for "make check" with GNU autotools
问题描述
我使用GNU自动工具对一个特定项目构建系统。我要开始写verifcation自动化测试。我想只需键入做检查,系统将自动运行这些。我的项目是在C ++中,虽然我仍然好奇写其他语言自动化测试为好。
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 it automatically run these. My project is in C++, although I am still curious about writing automated tests for other languages as well.
的这是用pretty每多单元测试框架在那里(我想使用的CppUnit的)兼容?我如何挂钩,这些单元测试框架到化妆检查?我可以确保我不需要单元测试软件安装到能够配置和建设项目的其余部分?的
推荐答案
为使测试运行时发出做检查
,您需要将它们添加到测试
变量
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
和他们都将获得运行。
这篇关于你如何创建&QUOT测试;请检查"与GNU自动工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!