]> git.lyx.org Git - features.git/commitdiff
Cmake lyx2lyx tests: Add roundtrip to exported lyx-files
authorKornel Benko <kornel@lyx.org>
Sun, 27 Dec 2015 19:05:37 +0000 (20:05 +0100)
committerKornel Benko <kornel@lyx.org>
Sun, 27 Dec 2015 19:05:37 +0000 (20:05 +0100)
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
development/autotests/export.cmake

index 50a0aa9d800e379901849800c6521a0d740a12d2..5123ae3fb2fabed900f0aaee2d6434ae313af3a8 100644 (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}
index f90fa09f7422d970afd19a4dad1ff62b71efaac1..51bd965bac2c45a40bddf052ea6b450033b1d4d6 100755 (executable)
@@ -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")