X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex2lyx%2Ftest%2FCMakeLists.txt;h=55510a43a3de9502b6e091f35db8e0475cd87719;hb=d3c63f97c4fce4e091277ced6c1829473c311231;hp=71626c23b0a16e7c3a56338b2739a3e85f1aee88;hpb=701a100d0bfacaf5a0f943b3c87e7ee4fcb5ebe6;p=lyx.git diff --git a/src/tex2lyx/test/CMakeLists.txt b/src/tex2lyx/test/CMakeLists.txt index 71626c23b0..55510a43a3 100644 --- a/src/tex2lyx/test/CMakeLists.txt +++ b/src/tex2lyx/test/CMakeLists.txt @@ -22,6 +22,7 @@ set(_tex_tests test.ltx test-refstyle-theorems.tex test-scr.tex test-structure.tex + verbatim.tex XeTeX-polyglossia.tex) set(runtestsScript "${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py") @@ -60,13 +61,43 @@ endforeach() add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx}) +set(LyxTestFiles "") # "'" separated test-filenames +set(LyxRemoveFiles) # Extra files created by runtests.py +foreach(_fl ${_tex_tests}) + set(LyxTestFiles "${LyxTestFiles}'${_fl}") + if (_fl MATCHES "^\(.*\)\\.\([^\\.]+)$") + list(APPEND LyxRemoveFiles "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_MATCH_1}.lyx.tex") + endif() +endforeach() +foreach(_lrf "DummyDocument.lyx.tex" "Dummy~Document.lyx.tex" "foo.pdf" "xfigtest.pdf" "xfigtest.pdftex_t") + list(APPEND LyxRemoveFiles "${CMAKE_CURRENT_SOURCE_DIR}/${_lrf}") +endforeach() +list(APPEND LyxRemoveFiles "${TOP_SRC_DIR}/lib/examples/longsheet.tex") + add_custom_command( - OUTPUT LyxTestFiles - COMMAND ${CMAKE_COMMAND} -E touch LyxTestFiles - COMMAND env LYX_USERDIR_VER=${LYX_USERDIR_VER} - ${LYX_PYTHON_EXECUTABLE} "${runtestsScript}" $ "${scriptDir}" "${CMAKE_CURRENT_SOURCE_DIR}" + OUTPUT Tex2lyxFilesUpdated + COMMAND ${CMAKE_COMMAND} + -DCOMMAND="${LYX_PYTHON_EXECUTABLE}" + -DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}" + -DPARAMS="${runtestsScript}'$'${scriptDir}'${CMAKE_CURRENT_SOURCE_DIR}" + -DSINGLEPARLIST="${LyxTestFiles}" + -P ${TOP_SRC_DIR}/src/tex2lyx/test/env_custom_command.cmake + COMMAND ${CMAKE_COMMAND} -E touch Tex2lyxFilesUpdated WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS ${_tex2lyx} ${_lyx} + ) + +add_custom_target(updatetex2lyxtests DEPENDS Tex2lyxFilesUpdated) +set_target_properties(updatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx") + +# In order to not pollute the source directory +# now remove some untracked files created by the target updatetex2lyxtests +add_custom_command( + OUTPUT UpdateFilesRemoved + COMMAND ${CMAKE_COMMAND} -E remove -f ${LyxRemoveFiles} + COMMAND ${CMAKE_COMMAND} -E touch UpdateFilesRemoved + DEPENDS Tex2lyxFilesUpdated ) -add_custom_target(updatetex2lyxtests DEPENDS LyxTestFiles) +add_custom_target(cleanupdatetex2lyxtests DEPENDS UpdateFilesRemoved) +set_target_properties(cleanupdatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx")