]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/runtests.cmake
Copyright
[lyx.git] / src / tex2lyx / test / runtests.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 #           (c) 2013 Scott Kostyshak <skotysh@lyx.org>
6 #
7 # Script should be called like:
8 # COMMAND ${CMAKE_COMMAND} \
9 #     -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
10 #     -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
11 #     -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE} \
12 #     -DPY_SCRIPT=${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py \
13 #     -DFIRST_PARAM=
14 #     -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}> \
15 #     -DSCRIPT_DIR=${TOP_SRC_DIR}/lib/scripts \
16 #     -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR} \
17 #     -DTESTFILE=${fl} \
18 #     -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake
19
20 set(ENV{${LYX_USERDIR_VER}} ${LYX_TESTS_USERDIR})
21 message(STATUS "SCRIPT_DIR = ${SCRIPT_DIR}")
22
23 execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} ${PY_SCRIPT} ${FIRST_PARAM}
24   ${TEX2LYX_EXE} ${SCRIPT_DIR} ${WORKDIR} ${TESTFILE}
25   RESULT_VARIABLE _err
26   OUTPUT_VARIABLE _out)
27
28 message(STATUS ${_out})
29 message(STATUS "Error output of ${PY_SCRIPT} = ${_err}")
30 string(COMPARE NOTEQUAL  ${_err} 0 _erg)
31
32 if(_erg)
33   message(FATAL_ERROR "${PY_SCRIPT} failed")
34 endif()
35
36