]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/CMakeLists.txt
Adapt tex2lyx tests to Uwe's changes
[lyx.git] / src / tex2lyx / test / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2012 Kornel Benko, <kornel@lyx.org>
5 #
6
7 project(test)
8
9 #file(GLOB _tex_tests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.ltx" "${CMAKE_CURRENT_SOURCE_DIR}/*.tex")
10 #
11 #list(REMOVE_ITEM _tex_tests DummyDocument.tex)
12
13 set(_tex_tests test.ltx
14                algo2e.tex
15                box-color-size-space-align.tex
16                CJK.tex
17                CJKutf8.tex
18                test-insets-basic.tex
19                test-insets.tex
20                test-memoir.tex
21                test-modules.tex
22                test-refstyle-theorems.tex
23                test-scr.tex
24                test-structure.tex
25                XeTeX-polyglossia.tex)
26
27 set(runtestsScript "${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py")
28 set(scriptDir "${TOP_SRC_DIR}/lib/scripts")
29
30 foreach(_fl ${_tex_tests})
31   set(fl ${_fl})
32   add_test(NAME tex2lyx/roundtrip/${_fl}
33     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
34     COMMAND ${CMAKE_COMMAND}
35       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
36       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
37       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
38       -DPY_SCRIPT=${runtestsScript}
39       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
40       -DSCRIPT_DIR=${scriptDir}
41       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
42       -DTESTFILE=${fl}
43       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
44   set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip")
45   add_test(NAME tex2lyx/cmplyx/${_fl}
46     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
47     COMMAND ${CMAKE_COMMAND}
48       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
49       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
50       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
51       -DPY_SCRIPT=${runtestsScript}
52       -DFIRST_PARAM=uselyx2lyx
53       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
54       -DSCRIPT_DIR=${scriptDir}
55       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
56       -DTESTFILE=${fl}
57       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
58   set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx")
59 endforeach()
60
61 add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
62
63 add_custom_command(
64   OUTPUT LyxTestFiles
65   COMMAND ${CMAKE_COMMAND} -E touch LyxTestFiles
66   COMMAND env LYX_USERDIR_VER=${LYX_USERDIR_VER} 
67     ${LYX_PYTHON_EXECUTABLE} "${runtestsScript}" $<TARGET_FILE:${_tex2lyx}> "${scriptDir}" "${CMAKE_CURRENT_SOURCE_DIR}"
68   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
69   DEPENDS ${_tex2lyx} ${_lyx}
70 )
71
72 add_custom_target(updatetex2lyxtests DEPENDS LyxTestFiles)