]> git.lyx.org Git - features.git/commitdiff
Cmake export tests: Macro to interpret error/warning messages at loading lyx files
authorKornel Benko <kornel@lyx.org>
Fri, 25 Dec 2015 09:26:38 +0000 (10:26 +0100)
committerKornel Benko <kornel@lyx.org>
Fri, 25 Dec 2015 09:26:38 +0000 (10:26 +0100)
development/autotests/CheckLoadErrors.cmake [new file with mode: 0644]

diff --git a/development/autotests/CheckLoadErrors.cmake b/development/autotests/CheckLoadErrors.cmake
new file mode 100644 (file)
index 0000000..b7d37fc
--- /dev/null
@@ -0,0 +1,38 @@
+
+macro(CheckLoadErrors lyxerrx PARAMS_DIR res_erg)
+  set(lyxerr ${${lyxerrx}})
+  set(_erg 0)
+  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)
+        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)
+        endif()
+      endif()
+    endforeach()
+  endif()
+  set(${res_erg} ${_erg})
+endmacro()