CMakeLists.txt 1.6 KB

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