Cmake lyx2lyx tests: Add roundtrip to exported lyx-files

Until now we exported e.g. to lyx16x ans tested if the result is loadable.
Now we also test if export of the exported is loadable.
This commit is contained in:
Kornel Benko 2015-12-27 20:05:37 +01:00
parent ddfd228dc3
commit 8d1d46743b
2 changed files with 17 additions and 4 deletions

View File

@ -317,6 +317,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates autote
-DLYX_USERDIR_VER=${LYX_USERDIR_VER}
-Dformat=lyx${_lyx_format_num}x
-Dextension=${_lyx_format_num}.lyx
-Dextension2=${_lyx_format_num}.${_lyx_format_num}.lyx
-Dfile=${f}
-Dinverted=${inverted}
-DTOP_SRC_DIR=${TOP_SRC_DIR}

View File

@ -52,6 +52,7 @@ else()
set(LYX_SOURCE "${LYX_ROOT}/${file}.lyx")
# Font-type not relevant for lyx16/lyx21 exports
set(result_file_name ${file}.${extension})
set(result_file_name2 ${file}.${extension2})
endif()
message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${result_file_name} \"${LYX_SOURCE}\"")
@ -75,21 +76,32 @@ include(${TOP_SRC_DIR}/development/autotests/CheckLoadErrors.cmake)
# If no error, and extension matches '\.lyx$', try to load the created lyx file
if (NOT _err)
if (result_file_name MATCHES "\\.lyx$")
message(STATUS "check load of ${result_file_name}")
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
set(ENV{LANG} "en") # to get all error-messages in english
message(STATUS "check structures of ${result_file_name}")
execute_process(
COMMAND ${PERL_EXECUTABLE} ${Structure_Script} "${WORKDIR}/${result_file_name}"
RESULT_VARIABLE _err
ERROR_VARIABLE lyxerr)
if (NOT _err)
message(STATUS "check load of ${result_file_name}")
execute_process(
COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${result_file_name}
RESULT_VARIABLE _err
ERROR_VARIABLE lyxerr)
endif()
if (NOT _err)
CheckLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
if (NOT _err)
CheckLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
if (NOT _err)
execute_process(
COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${result_file_name2} ${result_file_name}
RESULT_VARIABLE _err
ERROR_VARIABLE lyxerr)
if (NOT _err)
message(STATUS "check load of ${result_file_name2}")
CheckLoadErrors(lyxerr "${TOP_SRC_DIR}/development/autotests" _err)
endif()
endif()
endif()
endif()
else()
message(STATUS "\"${result_file_name}\" is not a lyx file, do not check load")