]> git.lyx.org Git - lyx.git/blob - development/autotests/check_load.cmake
ctests: log a waste and a success
[lyx.git] / development / autotests / check_load.cmake
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
5 # Copyright (c) 2013 Scott Kostyshak skotysh@lyx.org
6 #
7 #
8 # LYXFILE  = xxx
9 # lyx      =
10 #
11 # Script should be called like:
12 # cmake -DWORKDIR=${BUILD_DIR}/autotests/out-home \
13 #       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
14 #       -DLYXFILE=xxx \
15 #       -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
16 #       -DPARAMS_DIR="${TOP_SRC_DIR}/development/autotests" \
17 #       -Dinverted=${inverted}
18 #       -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake"
19 #
20
21 message(STATUS "Executing ${lyx} -batch -userdir \"${LYX_TESTS_USERDIR}\" ${LYXFILE}")
22 set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
23 set(ENV{LANG} "en") # to get all error-messages in english
24
25 execute_process(
26   COMMAND ${lyx} -batch -userdir "${LYX_TESTS_USERDIR}" ${LYXFILE}
27   RESULT_VARIABLE _err
28   ERROR_VARIABLE lyxerr)
29
30 message(STATUS "Error code of lyx = ${_err}")
31
32 #
33 # Ignore messages between "reconfiguring user directory" and "LyX: Done!"
34 # (Reconfigure-messages are not symptom of an error)
35 include(${PARAMS_DIR}/CheckLoadErrors.cmake)
36 if (NOT _err)
37   CheckLoadErrors(lyxerr "${PARAMS_DIR}" _err)
38 endif()
39
40 if(inverted)
41   string(COMPARE EQUAL  ${_err} 0 _erg)
42 else()
43   string(COMPARE NOTEQUAL  ${_err} 0 _erg)
44 endif()
45 if(_erg)
46   # We print here the whole error output, even the ignored part
47   message(FATAL_ERROR "lyx gave warnings/errors:\n${lyxerr}")
48 endif()