Cmake export tests: Use unique file names for exported files

This should prevent possible errors for tests running in parallel.
We now also check for created export file.
  complainer/feature requester: Scott Kostyshak
This commit is contained in:
Kornel Benko 2014-09-09 19:02:20 +02:00
parent 5a6020ea15
commit efb8584ba1

View File

@ -47,12 +47,24 @@ else()
set(LYX_SOURCE "${LYX_ROOT}/${file}.lyx") set(LYX_SOURCE "${LYX_ROOT}/${file}.lyx")
endif() endif()
message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${file}.${extension} \"${LYX_SOURCE}\"") set(result_file_name ${file}_${_ft}.${extension})
message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${result_file_name} \"${LYX_SOURCE}\"")
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}") set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension}) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${result_file_name})
execute_process( execute_process(
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${file}.${extension} "${LYX_SOURCE}" COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name} "${LYX_SOURCE}"
RESULT_VARIABLE _err) RESULT_VARIABLE _err)
#check if result file created
if (NOT _err)
if (NOT EXISTS "${result_file_name}")
message(STATUS "Expected result file \"${result_file_name}\" does not exist")
set(_err -1)
else()
message(STATUS "Expected result file \"${result_file_name}\" exists")
endif()
endif()
if(reverted) if(reverted)
string(COMPARE EQUAL ${_err} 0 _erg) string(COMPARE EQUAL ${_err} 0 _erg)
else() else()