[CMake] ctest return code
Tom Deblauwe
tom.deblauwe at traficon.com
Wed Feb 15 15:57:31 EST 2012
Hello,
It is apparently a combination of the two things, first I had to check
the "RETURN_VALUE" of the ctest_test command and then issue a
fatal_error when not zero.
Secondly: This works if I test it like you suggest in a command window:
the %errorlevel% is set. However in the "git bash" shell thingy on
windows, I always get 0. I tried it now in linux too, and there the
"echo $?" is working and is showing me the error code instead of 0.
So thanks to both for the suggestions!
Best regards,
Tom,
Op 15/02/2012 21:12, David Cole schreef:
> Is this just a "git bash" shell thing, then...?
>
> Do you get zero if you run it in a Windows cmd prompt, too?
>
> What does this give you?
>
> Start > Run > cmd
> C:
> cd \werk\cmake_tests
> ctest -S dashboard/continuous_dashboard.cmake -VV
> echo %ERRORLEVEL%
>
>
> On Wed, Feb 15, 2012 at 2:44 PM, Tom Deblauwe
> <tom.deblauwe at traficon.com <mailto:tom.deblauwe at traficon.com>> wrote:
>
> Hello,
>
> In attachment a project which illustrates the problem.
>
> Just change the directory in the ctest script
> "continuous_dashboard.cmake" to where your source is.
>
> Then i run ctest in my bash script. I'm in git bash on windows
> now, but I get the problem on linux too.
>
> tdb at PCTDBP /c/werk/cmake_tests
> $ ctest -S dashboard/continuous_dashboard.cmake -VV
>
> Ctest then runs, and this is the last of the output, in which you
> can see that it builds but that the unittest fails.
>
> .========== Build: 3 succeeded, 0 failed, 2 up-to-date, 0 skipped
> ==========
> Size of output: 1K
> Command exited with the value: 0
> MakeCommand:C:\PROGRA~2\MI30EB~1\Common7\IDE\devenv.com
> <http://devenv.com> Project.sln /build Relea
> se /project ALL_BUILD
> 0 Compiler errors
> 0 Compiler warnings
> SetCTestConfiguration:BuildDirectory:c:/werk/cmake_tests/bld-Release
> SetCTestConfiguration:SourceDirectory:c:/werk/cmake_tests/prog
> Test project C:/werk/cmake_tests/bld-Release
> Constructing a list of tests
> Done constructing a list of tests
> Checking test dependency graph...
> Checking test dependency graph end
> test 1
> Start 1: testMylibTest
>
> 1: Test command:
> C:\werk\cmake_tests\bld-Release\mylib\test\mylib\release\testMy
> lib.exe
> 1: Test timeout computed to be: 600
> 1/1 Test #1: testMylibTest ....................***Failed 0.05 sec
>
> 0% tests passed, 1 tests failed out of 1
>
> Total Test time (real) = 2.44 sec
>
> The following tests FAILED:
> 1 - testMylibTest (Failed)
>
> Then after ctest exits I do:
> tdb at PCTDBP /c/werk/cmake_tests
> $ echo $?
> 0
>
> As you can see: the test failed, but ctest just returns 0.
>
> Best regards,
> Tom,
>
>
--
*Tom Deblauwe*
*R&D Engineer*
Traficon International N.V.
Vlamingstraat 19
B-8560 Wevelgem
Belgium
Tel.: +32 (0)56 37.22.00
Fax: +32 (0)56 37.21.96
URL: www.traficon.com <http://www.traficon.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120215/fad7aa21/attachment.htm>
More information about the CMake
mailing list