On 31. Mar, 2010, at 9:59 , David Graf wrote:

> Hello Everybody
> 
> I want to execute batch files in CTest tests (to set the correct paths to the 
> PATH environment variables before executing an executable). Unfortunately, 
> that does not work smoothly. The reason is the error handling.
> If an error happens in the batch file, the batch file has to be killed with 
> an exit command. Otherwise, ctest doesn't receive an error code. My script 
> has to look like this:
> 
> SETLOCAL
> SET PATH=...;%PATH%
> execute_something.exe
> IF %ERRORLEVEL% neq 0 ( 
>  EXIT %ERRORLEVEL%
> )
> ENDLOCAL
> 
> 
> Unfortunately, this is not handy because the batch file cannot be executed 
> anymore from the cmd. Actually, it can. But it kills that cmd every time an 
> error happens. Not really nice. In my opinion, the batch file should look 
> like this:
> 
> SETLOCAL
> SET PATH=...;%PATH%
> execute_something.exe
> IF %ERRORLEVEL% neq 0 ( 
>  EXIT /B %ERRORLEVEL%
> )
> ENDLOCAL
> 
> Because of the argument '/B', the cmd is not killed anymore, but the error 
> code is correctly set! Unfortunately, ctest doesn't behave correctly anymore 
> after this change. After this change, every test passes. No matter what is 
> going on. CTest doesn't seem to check the %ERRORLEVEL%.
> 
> Is this a missing feature in ctest? Or am I missing something?
> 
> Cheers,
> 
> David Graf

Instead of checking the exit status, you could have CTest check the output for 
success or failure. Have a look at SET_TESTS_PROPERTIES.

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to