I have the ctest setting and work fine with all executable I've built for the project. The problem is I want to add some test with a system command, it has nothing to do with program in the solution, I cannot get it run by ctest.
I added a simple test as below, it just run the command echo:
add_test(NAME toto_test COMMAND echo bla bla bla)
Then the when I run ctest, I got the error
Start 1: toto_test
Could not find executable echo
Looked in the following places:
echo
echo.exe
Release/echo
Release/echo.exe
Release/echo
Release/echo.exe
Unable to find executable: echo
1/10 Test #1: toto_test ........................***Not Run 0.00 sec
The following tests FAILED:
1 - toto_test (Not Run)
Errors while running CTest
And when I run ctest with verbose option, I get
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: toto_test
Could not find executable echo
Looked in the following places:
echo
echo.exe
Release/echo
Release/echo.exe
Release/echo
Release/echo.exe
1: Test command: "bla" "bla" "bla"
Unable to find executable: echo
1/1 Test #1: toto_test ........................***Not Run 0.00 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.02 sec
The following tests FAILED:
1 - toto_test (Not Run)
Errors while running CTest
Can anyone come to help please. Thanks a lot
FIND_PROGRAM()or${CMAKE_COMMAND} -E echoit will be much more portable