]> git.lyx.org Git - lyx.git/blob - development/autotests/lyx2lyxtest.cmake
Cmake build: modify some tests
[lyx.git] / development / autotests / lyx2lyxtest.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 #
6 #
7 # LYX2LYX  = ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
8 # LYXFILE  = xxx
9 #
10 # Script should be called like:
11 # cmake -DLYX2LYX=xxx \
12 #       -DWORKDIR=${BUILD_DIR}/autotests/out-home \
13 #       -DLYXFILE=xxx \
14 #       -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake"
15 #
16
17 message(STATUS "Executing ${LYX2LYX} -e errors -o output ${LYXFILE}")
18 execute_process(
19   COMMAND ${LYX2LYX} -e errors -o output ${LYXFILE}
20   RESULT_VARIABLE _err)
21
22 message(STATUS "Error output of lyx2lyx = ${_err}")
23 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
24
25 # Check file "errors" being empty
26 file(STRINGS "errors" foundErrors)
27 if(foundErrors)
28   set(_erg 1)
29   foreach(_l ${foundErrors})
30     message(STATUS "${_l}")
31   endforeach()
32 endif()
33
34 # Check file "output" being not empty
35 file(STRINGS "output" createdLyx)
36 if(NOT createdLyx)
37   set(_erg 1)
38   message(STATUS "Created file empty")
39 endif()
40
41 if(_erg)
42   message(FATAL_ERROR "lyx2lyx failed")
43 endif()