Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Tests/CTestLimitDashJ/CMakeLists.txt
3148 views
1
cmake_minimum_required(VERSION 3.10)
2
project(CTestLimitDashJ NONE)
3
4
# This file demonstrates https://gitlab.kitware.com/cmake/cmake/-/issues/12904
5
# when configured with CMake 2.8.10.2 and earlier, and when running
6
# "ctest -j 4" in the resulting build tree. This example is hard-coded
7
# to assume -j 4 just to reproduce the issue easily. Adjust the
8
# FAIL_REGULAR_EXPRESSION and PROCESSORS values to reproduce this problem
9
# with a different ctest -j value...
10
11
if(EXISTS "${CMAKE_BINARY_DIR}/Testing/Temporary/CTestCostData.txt")
12
message(STATUS "Removing CTestCostData.txt to force ordering by COST PROPERTY value rather than prior run data")
13
file(REMOVE "${CMAKE_BINARY_DIR}/Testing/Temporary/CTestCostData.txt")
14
endif()
15
16
include(CTest)
17
18
configure_file(
19
${CMAKE_CURRENT_SOURCE_DIR}/CreateSleepDelete.cmake
20
${CMAKE_CURRENT_BINARY_DIR}/CreateSleepDelete.cmake
21
@ONLY
22
)
23
24
foreach(n RANGE 1 100)
25
add_test(NAME t${n}
26
COMMAND ${CMAKE_CTEST_COMMAND}
27
-D basefilename=f${n}
28
-S ${CMAKE_CURRENT_BINARY_DIR}/CreateSleepDelete.cmake
29
)
30
set_property(TEST t${n} PROPERTY FAIL_REGULAR_EXPRESSION "(c='[5-9]'|c='[1-9][0-9]+')")
31
endforeach()
32
33
set_property(TEST t1 PROPERTY RUN_SERIAL 1)
34
set_property(TEST t1 PROPERTY PROCESSORS 4)
35
36
set_property(TEST t51 PROPERTY RUN_SERIAL 1)
37
set_property(TEST t51 PROPERTY PROCESSORS 4)
38
39
foreach(n RANGE 2 50)
40
set_property(TEST t${n} PROPERTY DEPENDS t1)
41
endforeach()
42
set_property(TEST t1 PROPERTY DEPENDS t51)
43
set_property(TEST t51 PROPERTY DEPENDS t100)
44
45
foreach(n 50)
46
set_property(TEST t${n} PROPERTY COST 6)
47
endforeach()
48
foreach(n RANGE 52 99)
49
set_property(TEST t${n} PROPERTY COST 3)
50
endforeach()
51
52