2017-12-29 34 views
0

저는 ctest 설정을 가지고 있고 프로젝트를 위해 빌드 한 모든 실행 파일에서 잘 작동합니다. 문제는 시스템 명령으로 몇 가지 테스트를 추가하려는 것입니다. 솔루션의 프로그램과 아무 관련이 없으며 ctest로 실행할 수 없습니다. 그런 다음간단한 명령으로 ctest를 실행할 수 없습니다.

add_test(NAME toto_test COMMAND echo bla bla bla) 

내가 ctest 실행할 때, 나는 오류

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 

있어 내가 실행

나는 그냥 에코 명령을 실행, 아래와 같이 간단한 테스트를 추가 자세한 옵션으로 ctest를 얻을 수 있습니다.

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 

누구든지 가능합니다. 제발 도와주세요. 고마워요

+0

당신은'시도해야 FIND_PROGRAM()'또는 : 테스트를 실행할 때 외부 프로그램으로 테스트를 실행의 일반적인 목적을 위해, add_custom_target를 사용하여,이 목표를 구축하기 위해 $ {CMAKE_COMMAND}을 사용 } -E echo' 훨씬 더 이식성이 있습니다. –

답변

0

나는 그것을하는 방법을 찾았습니다. {CMAKE_COMMAND`$를

add_custom_target(run_toto COMMAND echo bla bla bla) 
add_test(NAME test_toto COMMAND ${CMAKE_COMMAND} --build . --target run_toto)