]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/CMakeLists.txt
cmake: Put updatetex2lyxtests in an appropriate folder
[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                verbatim.tex
26                XeTeX-polyglossia.tex)
27
28 set(runtestsScript "${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py")
29 set(scriptDir "${TOP_SRC_DIR}/lib/scripts")
30
31 foreach(_fl ${_tex_tests})
32   set(fl ${_fl})
33   add_test(NAME tex2lyx/roundtrip/${_fl}
34     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
35     COMMAND ${CMAKE_COMMAND}
36       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
37       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
38       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
39       -DPY_SCRIPT=${runtestsScript}
40       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
41       -DSCRIPT_DIR=${scriptDir}
42       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
43       -DTESTFILE=${fl}
44       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
45   set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip")
46   add_test(NAME tex2lyx/cmplyx/${_fl}
47     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
48     COMMAND ${CMAKE_COMMAND}
49       -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
50       -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
51       -DLYX_PYTHON_EXECUTABLE=${LYX_PYTHON_EXECUTABLE}
52       -DPY_SCRIPT=${runtestsScript}
53       -DFIRST_PARAM=uselyx2lyx
54       -DTEX2LYX_EXE=$<TARGET_FILE:${_tex2lyx}>
55       -DSCRIPT_DIR=${scriptDir}
56       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
57       -DTESTFILE=${fl}
58       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
59   set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx")
60 endforeach()
61
62 add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
63
64 add_custom_command(
65   OUTPUT LyxTestFiles
66   COMMAND ${CMAKE_COMMAND} -E touch LyxTestFiles
67   COMMAND env LYX_USERDIR_VER=${LYX_USERDIR_VER} 
68     ${LYX_PYTHON_EXECUTABLE} "${runtestsScript}" $<TARGET_FILE:${_tex2lyx}> "${scriptDir}" "${CMAKE_CURRENT_SOURCE_DIR}"
69   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
70   DEPENDS ${_tex2lyx} ${_lyx}
71 )
72
73 add_custom_target(updatetex2lyxtests DEPENDS LyxTestFiles)
74 set_target_properties(updatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx")