]> git.lyx.org Git - features.git/blobdiff - src/tex2lyx/test/CMakeLists.txt
Fix indentation fix.
[features.git] / src / tex2lyx / test / CMakeLists.txt
index 304e1623f3023a48dc635b3428bb68226da0529b..e620e067c4bef34364e06cef0e0f7eb2224a5ab1 100644 (file)
@@ -4,7 +4,7 @@
 # Copyright (c) 2012 Kornel Benko, <kornel@lyx.org>
 #
 
-project(test)
+project(testTex2lyx)
 
 #file(GLOB _tex_tests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.ltx" "${CMAKE_CURRENT_SOURCE_DIR}/*.tex")
 #
@@ -12,12 +12,16 @@ project(test)
 
 set(_tex_tests test.ltx
                algo2e.tex
+               beamer.tex
                box-color-size-space-align.tex
                CJK.tex
                CJKutf8.tex
+               listpreamble.tex
+               tabular-x-test.tex
                test-insets-basic.tex
                test-insets.tex
                test-memoir.tex
+               test-minted.tex
                test-modules.tex
                test-refstyle-theorems.tex
                test-scr.tex
@@ -42,7 +46,7 @@ foreach(_fl ${_tex_tests})
       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
       -DTESTFILE=${fl}
       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
-  set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip")
+  set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip:tex2lyx")
   add_test(NAME tex2lyx/cmplyx/${_fl}
     WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
     COMMAND ${CMAKE_COMMAND}
@@ -56,22 +60,48 @@ foreach(_fl ${_tex_tests})
       -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
       -DTESTFILE=${fl}
       -P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
-  set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx")
+  set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx:tex2lyx")
 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
+  OUTPUT Tex2lyxFilesUpdated
   COMMAND ${CMAKE_COMMAND}
-    -DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}"
-    -DCOMMAND="${LYX_PYTHON_EXECUTABLE}"
-    -DPARAMS="${runtestsScript}'$<TARGET_FILE:${_tex2lyx}>'${scriptDir}'${CMAKE_CURRENT_SOURCE_DIR}"
-    -P ${TOP_SRC_DIR}/src/tex2lyx/test/env_custom_command.cmake
+  -DCOMMAND="${LYX_PYTHON_EXECUTABLE}"
+  -DENVIRON="${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR}"
+  -DPARAMS="${runtestsScript}'$<TARGET_FILE:${_tex2lyx}>'${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 LyxTestFiles)
+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(cleanupdatetex2lyxtests DEPENDS UpdateFilesRemoved)
+set_target_properties(cleanupdatetex2lyxtests PROPERTIES FOLDER "tests/tex2lyx")