]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/lyx2lyxtest.cmake
ctest update.
[lyx.git] / development / autotests / lyx2lyxtest.cmake
index e595fc365ed0d668d82964cc3f6e1a3f5db7ddb8..708cd5077d73307547d39862cc9463aa9377dc09 100755 (executable)
@@ -8,36 +8,43 @@
 # LYXFILE  = xxx
 #
 # Script should be called like:
-# cmake -DLYX2LYX=xxx \
+# cmake -DLYX_PYTHON_EXECUTABLE=xxx \
+#       -DLYX2LYX=xxx \
+#       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
 #       -DWORKDIR=${BUILD_DIR}/autotests/out-home \
 #       -DLYXFILE=xxx \
 #       -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
 #
 
-message(STATUS "Executing ${LYX2LYX} -e errors -o output ${LYXFILE}")
+string(RANDOM LENGTH 5 errorfile)
+string(RANDOM LENGTH 6 outputfile)
+message(STATUS "Executing ${LYX_PYTHON_EXECUTABLE} ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}")
 execute_process(
-  COMMAND ${LYX2LYX} -e errors -o output ${LYXFILE}
+  COMMAND ${LYX_PYTHON_EXECUTABLE} ${LYX2LYX} -e ${errorfile} -o ${outputfile} ${LYXFILE}
   RESULT_VARIABLE _err)
 
 message(STATUS "Error output of lyx2lyx = ${_err}")
 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
 
 # Check file "errors" being empty
-file(STRINGS "errors" foundErrors)
+file(STRINGS ${errorfile} foundErrors)
 if(foundErrors)
-  set(_erg 1)
   foreach(_l ${foundErrors})
-    message(STATUS "${_l}")
+    if (NOT _l MATCHES "Warning: No conversion needed:")
+      set(_erg 1)
+      message(STATUS "${_l}")
+  endif()
   endforeach()
 endif()
 
-# Check file "output" being not empty
-file(STRINGS "output" createdLyx)
+# Check the output-file being not empty
+file(STRINGS ${outputfile} createdLyx)
 if(NOT createdLyx)
   set(_erg 1)
   message(STATUS "Created file empty")
 endif()
 
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${errorfile} ${outputfile})
 if(_erg)
   message(FATAL_ERROR "lyx2lyx failed")
 endif()