mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Cmake build tests: Threadsafety and test-labeling
The tests are now more robust if ctest uses '-j' (number of threads) parameter. a.) keytests are running in sequence and in one thread only, no other thread running b.) tex2lyx tests are locking in respect to each other c.) Test gets one or more labels, so that we can select ctest -L url to run tests labeled url d.) New macro settestlabel() to add labels to a test
This commit is contained in:
parent
1a96a9cf72
commit
f2553ebf6c
@ -95,6 +95,8 @@ if(Q_WS_X11)
|
|||||||
-DPACKAGE=${PACKAGE}
|
-DPACKAGE=${PACKAGE}
|
||||||
-DLOCALE_DIR=${LOCALE_DIR}
|
-DLOCALE_DIR=${LOCALE_DIR}
|
||||||
-P ${TOP_SRC_DIR}/development/autotests/single-test.cmake)
|
-P ${TOP_SRC_DIR}/development/autotests/single-test.cmake)
|
||||||
|
settestlabel(keytest/${_t} "key")
|
||||||
|
set_tests_properties(keytest/${_t} PROPERTIES RUN_SERIAL ON)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -181,6 +183,7 @@ foreach(libsubfolder doc examples templates)
|
|||||||
-Dfile=${f}
|
-Dfile=${f}
|
||||||
-Dreverted=${reverted}
|
-Dreverted=${reverted}
|
||||||
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
||||||
|
setmarkedtestlabel(${TestName} ${reverted} "export")
|
||||||
endif()
|
endif()
|
||||||
set(TestName "lyx2lyx/${libsubfolder}/${f}")
|
set(TestName "lyx2lyx/${libsubfolder}/${f}")
|
||||||
maketestname(TestName reverted revertedTests ignoredTests)
|
maketestname(TestName reverted revertedTests ignoredTests)
|
||||||
@ -191,6 +194,7 @@ foreach(libsubfolder doc examples templates)
|
|||||||
-DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
|
-DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
|
||||||
-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
|
-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
|
||||||
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
|
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
|
||||||
|
setmarkedtestlabel(${TestName} ${reverted} "export")
|
||||||
endif()
|
endif()
|
||||||
set(TestName "check_load/${libsubfolder}/${f}")
|
set(TestName "check_load/${libsubfolder}/${f}")
|
||||||
maketestname(TestName reverted revertedTests ignoredTests)
|
maketestname(TestName reverted revertedTests ignoredTests)
|
||||||
@ -203,6 +207,7 @@ foreach(libsubfolder doc examples templates)
|
|||||||
-DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests
|
-DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests
|
||||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
|
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
|
||||||
-P "${TOP_SRC_DIR}/development/autotests/check_load.cmake")
|
-P "${TOP_SRC_DIR}/development/autotests/check_load.cmake")
|
||||||
|
setmarkedtestlabel(${TestName} ${reverted} "load")
|
||||||
endif()
|
endif()
|
||||||
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
|
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
|
||||||
foreach(format ${formatlist})
|
foreach(format ${formatlist})
|
||||||
@ -220,6 +225,7 @@ foreach(libsubfolder doc examples templates)
|
|||||||
-Dfile=${f}
|
-Dfile=${f}
|
||||||
-Dreverted=${reverted}
|
-Dreverted=${reverted}
|
||||||
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
|
||||||
|
setmarkedtestlabel(${TestName} ${reverted} "export")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -75,7 +75,7 @@ endif()
|
|||||||
# Environments needed by keytest.py
|
# Environments needed by keytest.py
|
||||||
set(ENV{PACKAGE} ${PACKAGE})
|
set(ENV{PACKAGE} ${PACKAGE})
|
||||||
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
|
set(ENV{LOCALE_DIR} ${LOCALE_DIR})
|
||||||
set(ENV{LYX_LOCALEDIR} "${WORKDIR}/../locale")
|
set(ENV{LYX_LOCALEDIR} "${LOCALE_DIR}")
|
||||||
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
|
||||||
set(ENV{LYX_PID} ${pidres})
|
set(ENV{LYX_PID} ${pidres})
|
||||||
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
|
set(ENV{LYX_WINDOW_NAME} ${LYX_WINDOW_NAME})
|
||||||
|
@ -48,4 +48,8 @@ add_test(NAME "check_invalid_urls"
|
|||||||
"extraURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
|
"extraURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS"
|
||||||
"revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS")
|
"revertedURLS=${CMAKE_CURRENT_SOURCE_DIR}/knownInvalidURLS")
|
||||||
|
|
||||||
|
set_tests_properties("check_accessible_urls" "check_inaccessible_urls" "check_invalid_urls"
|
||||||
|
PROPERTIES RESOURCE_LOCK "url.lock" LABELS "url")
|
||||||
|
|
||||||
|
settestlabel("check_inaccessible_urls" "reverted")
|
||||||
|
settestlabel("check_invalid_urls" "reverted")
|
||||||
|
@ -290,3 +290,23 @@ macro(lyx_find_info_files group files)
|
|||||||
file(GLOB _filelist ${files})
|
file(GLOB _filelist ${files})
|
||||||
lyx_add_info_files(${group} ${_filelist})
|
lyx_add_info_files(${group} ${_filelist})
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(settestlabel testname)
|
||||||
|
get_property(_lab_list TEST ${testname} PROPERTY LABELS)
|
||||||
|
if(_lab_list)
|
||||||
|
list(APPEND _lab_list "${ARGN}")
|
||||||
|
else()
|
||||||
|
set(_lab_list "${ARGN}")
|
||||||
|
endif()
|
||||||
|
list(REMOVE_DUPLICATES _lab_list)
|
||||||
|
set_tests_properties(${testname} PROPERTIES LABELS "${_lab_list}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(setmarkedtestlabel testname reverted)
|
||||||
|
if(reverted)
|
||||||
|
settestlabel(${testname} "reverted" ${ARGN})
|
||||||
|
else()
|
||||||
|
settestlabel(${testname} ${ARGN})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ foreach(_fl ${_tex_tests})
|
|||||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||||
-DTESTFILE=${fl}
|
-DTESTFILE=${fl}
|
||||||
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
||||||
|
set_tests_properties(tex2lyx/roundtrip/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "roundtrip")
|
||||||
add_test(NAME tex2lyx/cmplyx/${_fl}
|
add_test(NAME tex2lyx/cmplyx/${_fl}
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
@ -48,6 +49,7 @@ foreach(_fl ${_tex_tests})
|
|||||||
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||||
-DTESTFILE=${fl}
|
-DTESTFILE=${fl}
|
||||||
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
-P ${TOP_SRC_DIR}/src/tex2lyx/test/runtests.cmake)
|
||||||
|
set_tests_properties(tex2lyx/cmplyx/${_fl} PROPERTIES RESOURCE_LOCK "runtests.lock" LABELS "cmplyx")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
|
add_dependencies(lyx_run_tests ${_tex2lyx} ${_lyx})
|
||||||
|
Loading…
Reference in New Issue
Block a user