]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/check_load.cmake
Fixup commit ff42fe
[lyx.git] / development / autotests / check_load.cmake
index 99f8df999471e45918e5a165c39dba24cd4b5ad9..4a22a27fa4f756b2753fc595d20ead8c9e8c69d0 100644 (file)
 #
 # Script should be called like:
 # cmake -DWORKDIR=${BUILD_DIR}/autotests/out-home \
+#       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
 #       -DLYXFILE=xxx \
 #       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
 #       -DPARAMS_DIR="${TOP_SRC_DIR}/development/autotests" \
 #       -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake"
 #
 
-message(STATUS "Executing ${lyx} -batch ${LYXFILE}")
-set(ENV{${LYX_USERDIR_VER}} "${WORKDIR}/.lyx")
+message(STATUS "Executing ${lyx} -batch -userdir \"${LYX_TESTS_USERDIR}\" ${LYXFILE}")
+set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
 set(ENV{LANG} "en") # to get all error-messages in english
 
 execute_process(
-  COMMAND ${lyx} -batch -userdir ${WORKDIR}/.lyx ${LYXFILE}
+  COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${LYXFILE}
   RESULT_VARIABLE _err
   ERROR_VARIABLE lyxerr)
 
 message(STATUS "Error code of lyx = ${_err}")
 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
 
+#
+# Ignore messages between "reconfiguring user directory" and "LyX: Done!"
+# (Reconfigure-messages are not symptom of an error)
 if(lyxerr)
+  set(ConfigureOutput 0)
   file(STRINGS "${PARAMS_DIR}/filterCheckWarnings" ignoreRegexp)
   # Split lyxerr into lines
   string(REGEX REPLACE "[\n]+" ";" foundErrors ${lyxerr})
   foreach(_l ${foundErrors})
-    message(STATUS "Checking line: \"${_l}\"")
-    set(found 0)
-    foreach(_r ${ignoreRegexp})
-      string(REGEX MATCHALL "${_r}" _match ${_l})
-      if(_match)
-        set(found 1)
+    if(ConfigureOutput)
+      if(_l MATCHES "LyX: Done!")
+        set(ConfigureOutput 0)
+      endif()
+    else()
+      if(_l MATCHES "reconfiguring user directory")
+        set(ConfigureOutput 1)
+      endif()
+    endif()
+    if(NOT ConfigureOutput)
+      set(found 0)
+      foreach(_r ${ignoreRegexp})
+        if(_l MATCHES "${_r}")
+          set(found 1)
+          break()
+        endif()
+      endforeach()
+      if(NOT found)
+        message(STATUS "Error line = ${_l}")
+        # It is error, because the error-line does not match
+        # any ignoring expression
+        set(_erg 1)
         break()
       endif()
-    endforeach()
-    if(NOT found)
-      # It is error, because the error-line does not match
-      # any ignoring expression
-      set(_erg 1)
     endif()
   endforeach()
 endif()