Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate bash test scripts in cmake

Tags:

c++

bash

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

like image 517
nopper Avatar asked Sep 02 '14 15:09

nopper


1 Answers

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.

like image 67
randomusername Avatar answered Sep 29 '22 17:09

randomusername