1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
5 # Copyright (c) 2013 Scott Kostyshak skotysh@lyx.org
11 # Script should be called like:
12 # cmake -DWORKDIR=${BUILD_DIR}/autotests/out-home \
13 # -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
15 # -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
16 # -DPARAMS_DIR="${TOP_SRC_DIR}/development/autotests" \
17 # -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake"
20 message(STATUS "Executing ${lyx} -batch ${LYXFILE}")
21 set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
22 set(ENV{LANG} "en") # to get all error-messages in english
25 COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${LYXFILE}
27 ERROR_VARIABLE lyxerr)
29 message(STATUS "Error code of lyx = ${_err}")
30 string(COMPARE NOTEQUAL ${_err} 0 _erg)
33 file(STRINGS "${PARAMS_DIR}/filterCheckWarnings" ignoreRegexp)
34 # Split lyxerr into lines
35 string(REGEX REPLACE "[\n]+" ";" foundErrors ${lyxerr})
36 foreach(_l ${foundErrors})
37 message(STATUS "Checking line: \"${_l}\"")
39 foreach(_r ${ignoreRegexp})
40 string(REGEX MATCHALL "${_r}" _match ${_l})
47 # It is error, because the error-line does not match
48 # any ignoring expression
55 # We print here the whole error output, even the ignored part
56 message(FATAL_ERROR "lyx gave warnings/errors:\n${lyxerr}")