]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/check_load.cmake
Some layout fixes
[lyx.git] / development / autotests / check_load.cmake
index 967bb66989f731bf333f0c611b01a273d0ca0725..0a0d35154bdf9d8082db9827bfe8f18b2b2e1a73 100644 (file)
 #       -DLYXFILE=xxx \
 #       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
 #       -DPARAMS_DIR="${TOP_SRC_DIR}/development/autotests" \
+#       -Dinverted=${inverted}
 #       -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake"
 #
 
-message(STATUS "Executing ${lyx} -batch ${LYXFILE}")
+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
 
@@ -27,48 +28,20 @@ execute_process(
   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})
-    if(ConfigureOutput)
-      string(REGEX MATCHALL "LyX: Done!" _match ${_l})
-      if(_match)
-        set(ConfigureOutput 0)
-      endif()
-    else()
-      string(REGEX MATCHALL "reconfiguring user directory" _match ${_l})
-      if(_match)
-        set(ConfigureOutput 1)
-      endif()
-    endif()
-    if(NOT ConfigureOutput)
-      set(found 0)
-      foreach(_r ${ignoreRegexp})
-        string(REGEX MATCHALL "${_r}" _match ${_l})
-        if(_match)
-          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()
-    endif()
-  endforeach()
+include(${PARAMS_DIR}/CheckLoadErrors.cmake)
+if (NOT _err)
+  CheckLoadErrors(lyxerr "${PARAMS_DIR}" _err)
 endif()
 
+if(inverted)
+  string(COMPARE EQUAL  ${_err} 0 _erg)
+else()
+  string(COMPARE NOTEQUAL  ${_err} 0 _erg)
+endif()
 if(_erg)
   # We print here the whole error output, even the ignored part
   message(FATAL_ERROR "lyx gave warnings/errors:\n${lyxerr}")