在集成的bash的CMake测试脚本 [英] Integrate bash test scripts in cmake
问题描述
我有一个使用升压试验单元测试C ++ cmake的项目。现在我想揭露了一系列的bash脚本(用于集成测试)向CMake的。在失败的情况下假设每个这个脚本中的 PASS 或什么情况下返回0!= 0。我想,每当我跑 cmake的测试
。
I have a C++ cmake project that uses Boost Test for unit testing. Now I would like to expose a series of bash scripts (used for integration testing) to cmake. Suppose each of this script to return 0 in case of PASS or something != 0 in case of FAILURE. I would like each script to be executed whenever I run cmake test
.
什么是获得这种行为的最简单,最快捷的方式。
What's the simplest and quickest way to obtain such behavior
推荐答案
基本上,你想通过定位bash程序来启动
Basically, you want to start by locating the bash program
find_program (BASH_PROGRAM bash)
然后,只需添加脚本的测试列表
Then just add your script to the list of tests
if (BASH_PROGRAM)
add_test (mytest ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/script.sh)
endif (BASH_PROGRAM)
和所有这一切应该工作。
And all of that should work.
这篇关于在集成的bash的CMake测试脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!