2013-08-22 22:31:54 +00:00
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2013 Kornel Benko kornel@lyx.org
|
|
|
|
# Copyright (c) 2013 Scott Kostyshak skotysh@lyx.org
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# LYXFILE = xxx
|
|
|
|
# lyx =
|
|
|
|
#
|
|
|
|
# Script should be called like:
|
|
|
|
# cmake -DWORKDIR=${BUILD_DIR}/autotests/out-home \
|
2013-08-25 09:41:10 +00:00
|
|
|
# -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
|
2013-08-22 22:31:54 +00:00
|
|
|
# -DLYXFILE=xxx \
|
|
|
|
# -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
|
|
|
|
# -DPARAMS_DIR="${TOP_SRC_DIR}/development/autotests" \
|
|
|
|
# -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake"
|
|
|
|
#
|
|
|
|
|
2014-01-05 09:02:29 +00:00
|
|
|
message(STATUS "Executing ${lyx} -batch -userdir \"${LYX_TESTS_USERDIR}\" ${LYXFILE}")
|
2013-08-25 09:41:10 +00:00
|
|
|
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
2013-08-22 22:31:54 +00:00
|
|
|
set(ENV{LANG} "en") # to get all error-messages in english
|
|
|
|
|
|
|
|
execute_process(
|
2013-08-25 09:41:10 +00:00
|
|
|
COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${LYXFILE}
|
2013-08-22 22:31:54 +00:00
|
|
|
RESULT_VARIABLE _err
|
|
|
|
ERROR_VARIABLE lyxerr)
|
|
|
|
|
|
|
|
message(STATUS "Error code of lyx = ${_err}")
|
|
|
|
string(COMPARE NOTEQUAL ${_err} 0 _erg)
|
|
|
|
|
2013-12-26 09:29:34 +00:00
|
|
|
#
|
|
|
|
# Ignore messages between "reconfiguring user directory" and "LyX: Done!"
|
|
|
|
# (Reconfigure-messages are not symptom of an error)
|
2013-08-22 22:31:54 +00:00
|
|
|
if(lyxerr)
|
2013-12-26 09:29:34 +00:00
|
|
|
set(ConfigureOutput 0)
|
2013-08-22 22:31:54 +00:00
|
|
|
file(STRINGS "${PARAMS_DIR}/filterCheckWarnings" ignoreRegexp)
|
|
|
|
# Split lyxerr into lines
|
|
|
|
string(REGEX REPLACE "[\n]+" ";" foundErrors ${lyxerr})
|
|
|
|
foreach(_l ${foundErrors})
|
2013-12-26 09:29:34 +00:00
|
|
|
if(ConfigureOutput)
|
2014-01-05 09:02:29 +00:00
|
|
|
if(_l MATCHES "LyX: Done!")
|
2013-12-26 09:29:34 +00:00
|
|
|
set(ConfigureOutput 0)
|
|
|
|
endif()
|
|
|
|
else()
|
2014-01-05 09:02:29 +00:00
|
|
|
if(_l MATCHES "reconfiguring user directory")
|
2013-12-26 09:29:34 +00:00
|
|
|
set(ConfigureOutput 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(NOT ConfigureOutput)
|
|
|
|
set(found 0)
|
|
|
|
foreach(_r ${ignoreRegexp})
|
2014-01-05 09:02:29 +00:00
|
|
|
if(_l MATCHES "${_r}")
|
2013-12-26 09:29:34 +00:00
|
|
|
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)
|
2013-08-22 22:31:54 +00:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_erg)
|
|
|
|
# We print here the whole error output, even the ignored part
|
|
|
|
message(FATAL_ERROR "lyx gave warnings/errors:\n${lyxerr}")
|
|
|
|
endif()
|