I have a test script that works on linux but fails to work properly on Windows. It runs a command, captures the standard out and compares it to a reference file.
On linux everything works 99% of the time (issue with '=' or '--' in a parameter argument - later question). On windows, the execution of the test program fails with; "The process cannot access the file because it is being used by another process" Any suggestions would be welcomed. As a fallback I will need to create a windows batch file. Allen The Script - runTest.cmake : #################################### # process arguments for the test program SET (arg_list) FOREACH (arg ${TEST_ARGS}) SET (arg_list ${arg_list} ${arg}) ENDFOREACH (arg ${TEST_ARGS}) # run the test program, capture the stdout/stderr and the result var EXECUTE_PROCESS ( COMMAND ${TEST_PROGRAM} ${arg_list} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT} OUTPUT_VARIABLE TEST_ERROR ERROR_VARIABLE TEST_ERROR ) # if the return value is !=0 bail out IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) # now compare the output with the reference EXECUTE_PROCESS ( COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT} ${TEST_REFERENCE} RESULT_VARIABLE TEST_RESULT ) # again, if return value is !=0 scream and shout IF (TEST_RESULT) MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}") ENDIF (TEST_RESULT) ############################################# The CMakeLists.txt : ################################# ... MACRO (ADD_CMP_TEST resultfile resultcode) ADD_TEST ( NAME TOOL-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:tool>" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" -D "TEST_APPEND=EXIT CODE:" -P "runTest.cmake" ) ENDMACRO (ADD_CMP_TEST file) ... ADD_CMP_TEST (tool_11 1 tool_param1 tool_param2 tool_paramN) ... ################################# _______________________________________________ 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