From 8d1d46743bfe6700652f1e02352d697c47d54a86 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 27 Dec 2015 20:05:37 +0100 Subject: [PATCH] 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. --- development/autotests/ExportTests.cmake | 1 + development/autotests/export.cmake | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/development/autotests/ExportTests.cmake b/development/autotests/ExportTests.cmake index 50a0aa9d80..5123ae3fb2 100644 --- a/development/autotests/ExportTests.cmake +++ b/development/autotests/ExportTests.cmake @@ -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} diff --git a/development/autotests/export.cmake b/development/autotests/export.cmake index f90fa09f74..51bd965bac 100755 --- a/development/autotests/export.cmake +++ b/development/autotests/export.cmake @@ -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") -- 2.39.2