Browse Source

CTest: Rename hardware -> resources for RunCMake tests

Also includes variants like hw -> res
Craig Scott 6 years ago
parent
commit
eb9d945f14
84 changed files with 287 additions and 287 deletions
  1. 12 12
      Tests/RunCMake/CMakeLists.txt
  2. 0 23
      Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake
  3. 0 167
      Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake
  4. 0 1
      Tests/RunCMake/CTestHardwareAllocation/checkfree1-ctest-s-hw-check.cmake
  5. 0 7
      Tests/RunCMake/CTestHardwareAllocation/checkfree1.cmake
  6. 0 1
      Tests/RunCMake/CTestHardwareAllocation/checkfree2-ctest-s-hw-check.cmake
  7. 0 8
      Tests/RunCMake/CTestHardwareAllocation/checkfree2.cmake
  8. 0 6
      Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good2-check.cmake
  9. 0 1
      Tests/RunCMake/CTestHardwareAllocation/lotsoftests-ctest-s-hw-check.cmake
  10. 0 16
      Tests/RunCMake/CTestHardwareAllocation/lotsoftests.cmake
  11. 0 3
      Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-check.cmake
  12. 0 4
      Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-stderr.txt
  13. 0 5
      Tests/RunCMake/CTestHardwareAllocation/notenough1.cmake
  14. 0 3
      Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-check.cmake
  15. 0 4
      Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-stderr.txt
  16. 0 5
      Tests/RunCMake/CTestHardwareAllocation/notenough2.cmake
  17. 0 1
      Tests/RunCMake/CTestHardwareAllocation/process_count-ctest-s-hw-check.cmake
  18. 0 5
      Tests/RunCMake/CTestHardwareAllocation/process_count.cmake
  19. 1 1
      Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in
  20. 23 0
      Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake
  21. 167 0
      Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
  22. 1 0
      Tests/RunCMake/CTestResourceAllocation/checkfree1-ctest-s-res-check.cmake
  23. 7 0
      Tests/RunCMake/CTestResourceAllocation/checkfree1.cmake
  24. 1 0
      Tests/RunCMake/CTestResourceAllocation/checkfree2-ctest-s-res-check.cmake
  25. 8 0
      Tests/RunCMake/CTestResourceAllocation/checkfree2.cmake
  26. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc-result.txt
  27. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc.log
  28. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1-result.txt
  29. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1.log
  30. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2-result.txt
  31. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2.log
  32. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3-result.txt
  33. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3.log
  34. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4-result.txt
  35. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4.log
  36. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5-result.txt
  37. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5.log
  38. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good1.log
  39. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good2.log
  40. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak-result.txt
  41. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak.log
  42. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin-result.txt
  43. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin.log
  44. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend-result.txt
  45. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend.log
  46. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid-result.txt
  47. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid.log
  48. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nolog-result.txt
  49. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores-result.txt
  50. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores.log
  51. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough-result.txt
  52. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough.log
  53. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-noproc-count-result.txt
  54. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badcount-result.txt
  55. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badres-result.txt
  56. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets1-result.txt
  57. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets2-result.txt
  58. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets3-result.txt
  59. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets4-result.txt
  60. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets5-result.txt
  61. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets6-result.txt
  62. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets7-result.txt
  63. 3 3
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good1-check.cmake
  64. 6 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good2-check.cmake
  65. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nocount-result.txt
  66. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nores-result.txt
  67. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nowidgets-result.txt
  68. 0 0
      Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx
  69. 3 3
      Tests/RunCMake/CTestResourceAllocation/ensure_parallel-ctest-s-res-check.cmake
  70. 4 4
      Tests/RunCMake/CTestResourceAllocation/ensure_parallel.cmake
  71. 1 0
      Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake
  72. 16 0
      Tests/RunCMake/CTestResourceAllocation/lotsoftests.cmake
  73. 3 0
      Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-check.cmake
  74. 0 0
      Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-result.txt
  75. 4 0
      Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-stderr.txt
  76. 5 0
      Tests/RunCMake/CTestResourceAllocation/notenough1.cmake
  77. 3 0
      Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-check.cmake
  78. 0 0
      Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-result.txt
  79. 4 0
      Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-stderr.txt
  80. 5 0
      Tests/RunCMake/CTestResourceAllocation/notenough2.cmake
  81. 1 0
      Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake
  82. 5 0
      Tests/RunCMake/CTestResourceAllocation/process_count.cmake
  83. 0 0
      Tests/RunCMake/CTestResourceAllocation/resspec.json
  84. 4 4
      Tests/RunCMake/CTestResourceAllocation/test.cmake.in

+ 12 - 12
Tests/RunCMake/CMakeLists.txt

@@ -335,7 +335,7 @@ add_RunCMake_test(no_install_prefix)
 add_RunCMake_test(configure_file)
 add_RunCMake_test(CTestTimeoutAfterMatch)
 
-# cthwalloc links against CMakeLib and CTestLib, which means it can't be built
+# ctresalloc links against CMakeLib and CTestLib, which means it can't be built
 # if CMake_TEST_EXTERNAL_CMAKE is activated (the compiler might be different.)
 # So, it has to be provided in the original build tree.
 if(CMake_TEST_EXTERNAL_CMAKE)
@@ -343,7 +343,7 @@ if(CMake_TEST_EXTERNAL_CMAKE)
   if(NOT CMAKE_VERSION VERSION_LESS 3.12)
     set(no_package_root_path NO_PACKAGE_ROOT_PATH)
   endif()
-  find_program(cthwalloc cthwalloc PATHS ${CMake_TEST_EXTERNAL_CMAKE}
+  find_program(ctresalloc ctresalloc PATHS ${CMake_TEST_EXTERNAL_CMAKE}
     NO_DEFAULT_PATH
     ${no_package_root_path}
     NO_CMAKE_PATH
@@ -352,25 +352,25 @@ if(CMake_TEST_EXTERNAL_CMAKE)
     NO_CMAKE_SYSTEM_PATH
     NO_CMAKE_FIND_ROOT_PATH
     )
-  if(cthwalloc)
-    add_executable(cthwalloc IMPORTED)
-    set_property(TARGET cthwalloc PROPERTY IMPORTED_LOCATION ${cthwalloc})
+  if(ctresalloc)
+    add_executable(ctresalloc IMPORTED)
+    set_property(TARGET ctresalloc PROPERTY IMPORTED_LOCATION ${ctresalloc})
   endif()
 else()
-  add_executable(cthwalloc CTestHardwareAllocation/cthwalloc.cxx)
-  target_link_libraries(cthwalloc CTestLib)
-  target_include_directories(cthwalloc PRIVATE
+  add_executable(ctresalloc CTestResourceAllocation/ctresalloc.cxx)
+  target_link_libraries(ctresalloc CTestLib)
+  target_include_directories(ctresalloc PRIVATE
     ${CMake_BINARY_DIR}/Source
     ${CMake_SOURCE_DIR}/Source
     ${CMake_SOURCE_DIR}/Source/CTest
     )
-  set_property(TARGET cthwalloc PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMake_BIN_DIR})
+  set_property(TARGET ctresalloc PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMake_BIN_DIR})
 endif()
 
-if(TARGET cthwalloc)
-  add_RunCMake_test(CTestHardwareAllocation -DCTHWALLOC_COMMAND=$<TARGET_FILE:cthwalloc>)
+if(TARGET ctresalloc)
+  add_RunCMake_test(CTestResourceAllocation -DCTRESALLOC_COMMAND=$<TARGET_FILE:ctresalloc>)
 else()
-  message(WARNING "Could not find or build cthwalloc")
+  message(WARNING "Could not find or build ctresalloc")
 endif()
 
 find_package(Qt4 QUIET)

+ 0 - 23
Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake

@@ -1,23 +0,0 @@
-function(setup_hardware_tests)
-  if(CTEST_HARDWARE_ALLOC_ENABLED)
-    add_test(NAME HardwareSetup COMMAND "${CMAKE_COMMAND}" -E remove -f "${CMAKE_BINARY_DIR}/cthwalloc.log")
-  endif()
-endfunction()
-
-function(add_hardware_test name sleep_time proc)
-  if(CTEST_HARDWARE_ALLOC_ENABLED)
-    add_test(NAME "${name}" COMMAND "${CTHWALLOC_COMMAND}" write "${CMAKE_BINARY_DIR}/cthwalloc.log" "${name}" "${sleep_time}" "${proc}")
-    set_property(TEST "${name}" PROPERTY DEPENDS HardwareSetup)
-  else()
-    add_test(NAME "${name}" COMMAND "${CTHWALLOC_COMMAND}" write "${CMAKE_BINARY_DIR}/cthwalloc.log" "${name}" "${sleep_time}")
-  endif()
-  set_property(TEST "${name}" PROPERTY RESOURCE_GROUPS "${proc}")
-  list(APPEND HARDWARE_TESTS "${name}")
-  set(HARDWARE_TESTS "${HARDWARE_TESTS}" PARENT_SCOPE)
-endfunction()
-
-function(cleanup_hardware_tests)
-  if(CTEST_HARDWARE_ALLOC_ENABLED)
-    file(WRITE "${CMAKE_BINARY_DIR}/hwtests.txt" "${HARDWARE_TESTS}")
-  endif()
-endfunction()

+ 0 - 167
Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake

@@ -1,167 +0,0 @@
-include(RunCMake)
-include(RunCTest)
-
-###############################################################################
-# Test cthwalloc itself - we want to make sure it's not just rubber-stamping
-# the test results
-###############################################################################
-
-function(cthwalloc_verify_log expected_contents)
-  if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log")
-    string(APPEND RunCMake_TEST_FAILED "Log file was not written\n")
-    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
-    return()
-  endif()
-  file(READ "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log" actual_contents)
-  if(NOT actual_contents STREQUAL expected_contents)
-    string(APPEND RunCMake_TEST_FAILED "Actual log did not match expected log\n")
-    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
-  endif()
-endfunction()
-
-function(run_cthwalloc_write_proc name proc)
-  file(REMOVE "${RunCMake_BINARY_DIR}/${name}-build/cthwalloc.log")
-  run_cthwalloc_write_proc_nodel("${name}" "${proc}" "${ARGN}")
-endfunction()
-
-function(run_cthwalloc_write_proc_nodel name proc)
-  string(REPLACE ";" "\\;" proc "${proc}")
-  run_cmake_command(${name} "${CMAKE_COMMAND}" -E env "${ARGN}" "${CTHWALLOC_COMMAND}" write "${RunCMake_BINARY_DIR}/${name}-build/cthwalloc.log" "${name}" 0 "${proc}")
-endfunction()
-
-function(run_cthwalloc_write_noproc name)
-  run_cmake_command(${name} "${CMAKE_COMMAND}" -E env "${ARGN}" "${CTHWALLOC_COMMAND}" write "${RunCMake_BINARY_DIR}/${name}-build/cthwalloc.log" "${name}" 0)
-endfunction()
-
-function(run_cthwalloc_verify name tests)
-  string(REPLACE ";" "\\;" tests "${tests}")
-  run_cmake_command(${name} "${CTHWALLOC_COMMAND}" verify "${RunCMake_SOURCE_DIR}/${name}.log" "${CMAKE_CURRENT_LIST_DIR}/hwspec.json" "${tests}")
-endfunction()
-
-unset(ENV{CTEST_RESOURCE_GROUP_COUNT})
-set(RunCMake_TEST_NO_CLEAN 1)
-file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/cthwalloc-write-proc-good1-build")
-file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/cthwalloc-write-proc-good1-build")
-file(WRITE "${RunCMake_BINARY_DIR}/cthwalloc-write-proc-good1-build/cthwalloc.log"
-[[begin test1
-alloc widgets 0 1
-dealloc widgets 0 1
-end test1
-]])
-run_cthwalloc_write_proc_nodel(cthwalloc-write-proc-good1 "1,widgets:2,transmogrifiers:1;2,widgets:1,widgets:2"
-  CTEST_RESOURCE_GROUP_COUNT=3
-  CTEST_RESOURCE_GROUP_0=widgets,transmogrifiers
-  CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2
-  CTEST_RESOURCE_GROUP_0_TRANSMOGRIFIERS=id:calvin,slots:1
-  CTEST_RESOURCE_GROUP_1=widgets
-  "CTEST_RESOURCE_GROUP_1_WIDGETS=id:0,slots:1\\;id:2,slots:2"
-  CTEST_RESOURCE_GROUP_2=widgets
-  "CTEST_RESOURCE_GROUP_2_WIDGETS=id:0,slots:1\\;id:2,slots:2"
-  )
-set(RunCMake_TEST_NO_CLEAN 0)
-run_cthwalloc_write_proc(cthwalloc-write-proc-good2 "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:8
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-nocount "widgets:8")
-run_cthwalloc_write_proc(cthwalloc-write-proc-badcount "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=2
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-nores "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badres "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets,transmogrifiers
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-nowidgets "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets1 "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  CTEST_RESOURCE_GROUP_0_WIDGETS=
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets2 "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:8\\;id:0,slots:1"
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets3 "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:7
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets4 "widgets:8"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  CTEST_RESOURCE_GROUP_0_WIDGETS=invalid
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets5 "widgets:2,widgets:2"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets6 "widgets:2"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
-  )
-run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets7 "widgets:2,widgets:2"
-  CTEST_RESOURCE_GROUP_COUNT=1
-  CTEST_RESOURCE_GROUP_0=widgets
-  CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2
-  )
-
-run_cthwalloc_write_noproc(cthwalloc-write-noproc-good1)
-run_cthwalloc_write_noproc(cthwalloc-write-noproc-count
-  CTEST_RESOURCE_GROUP_COUNT=1
-  )
-
-run_cthwalloc_verify(cthwalloc-verify-good1 "test1;test2")
-run_cthwalloc_verify(cthwalloc-verify-good2 "")
-run_cthwalloc_verify(cthwalloc-verify-nolog "")
-run_cthwalloc_verify(cthwalloc-verify-nores "")
-run_cthwalloc_verify(cthwalloc-verify-noid "")
-run_cthwalloc_verify(cthwalloc-verify-notenough "")
-run_cthwalloc_verify(cthwalloc-verify-baddealloc "")
-run_cthwalloc_verify(cthwalloc-verify-leak "")
-run_cthwalloc_verify(cthwalloc-verify-badtest1 "")
-run_cthwalloc_verify(cthwalloc-verify-badtest2 "test1")
-run_cthwalloc_verify(cthwalloc-verify-badtest3 "test1")
-run_cthwalloc_verify(cthwalloc-verify-badtest4 "test1")
-run_cthwalloc_verify(cthwalloc-verify-badtest5 "test1")
-run_cthwalloc_verify(cthwalloc-verify-nobegin "test1")
-run_cthwalloc_verify(cthwalloc-verify-noend "test1")
-
-###############################################################################
-# Now test the hardware allocation feature of CTest
-###############################################################################
-
-function(run_ctest_hardware name parallel random)
-  run_ctest("${name}-ctest-s-hw" "-DCTEST_HARDWARE_ALLOC_ENABLED=1" "-DCTHWALLOC_COMMAND=${CTHWALLOC_COMMAND}" "-DCTEST_PARALLEL=${parallel}" "-DCTEST_RANDOM=${random}")
-  run_ctest("${name}-ctest-s-nohw" "-DCTEST_HARDWARE_ALLOC_ENABLED=0" "-DCTHWALLOC_COMMAND=${CTHWALLOC_COMMAND}" "-DCTEST_PARALLEL=${parallel}" "-DCTEST_RANDOM=${random}")
-endfunction()
-
-function(verify_ctest_hardware)
-  file(READ "${RunCMake_TEST_BINARY_DIR}/hwtests.txt" hwtests)
-  execute_process(COMMAND "${CTHWALLOC_COMMAND}" verify "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log" "${CMAKE_CURRENT_LIST_DIR}/hwspec.json" "${hwtests}"
-    OUTPUT_VARIABLE output ERROR_QUIET RESULT_VARIABLE result)
-  if(result)
-    string(APPEND RunCMake_TEST_FAILED "${output}")
-    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
-  endif()
-endfunction()
-
-run_ctest_hardware(lotsoftests 10 1)
-run_ctest_hardware(checkfree1 2 0)
-run_ctest_hardware(checkfree2 1 0)
-run_ctest_hardware(notenough1 1 0)
-run_ctest_hardware(notenough2 1 0)
-run_ctest_hardware(ensure_parallel 2 0)
-
-set(ENV{CTEST_RESOURCE_GROUP_COUNT} 2)
-run_ctest_hardware(process_count 1 0)
-unset(ENV{CTEST_RESOURCE_GROUP_COUNT})

+ 0 - 1
Tests/RunCMake/CTestHardwareAllocation/checkfree1-ctest-s-hw-check.cmake

@@ -1 +0,0 @@
-verify_ctest_hardware()

+ 0 - 7
Tests/RunCMake/CTestHardwareAllocation/checkfree1.cmake

@@ -1,7 +0,0 @@
-setup_hardware_tests()
-
-add_hardware_test(Test1 1 "widgets:8")
-add_hardware_test(Test2 1 "fluxcapacitors:50;fluxcapacitors:50,widgets:8")
-add_hardware_test(Test3 1 "fluxcapacitors:121")
-
-cleanup_hardware_tests()

+ 0 - 1
Tests/RunCMake/CTestHardwareAllocation/checkfree2-ctest-s-hw-check.cmake

@@ -1 +0,0 @@
-verify_ctest_hardware()

+ 0 - 8
Tests/RunCMake/CTestHardwareAllocation/checkfree2.cmake

@@ -1,8 +0,0 @@
-setup_hardware_tests()
-
-# This test is an attack on the hardware scheduling algorithm. It has been
-# carefully crafted to fool the algorithm into thinking there isn't sufficient
-# hardware for it.
-add_hardware_test(Test1 1 "widgets:2;4,widgets:4")
-
-cleanup_hardware_tests()

+ 0 - 6
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good2-check.cmake

@@ -1,6 +0,0 @@
-cthwalloc_verify_log(
-[[begin cthwalloc-write-proc-good2
-alloc widgets 3 8
-dealloc widgets 3 8
-end cthwalloc-write-proc-good2
-]])

+ 0 - 1
Tests/RunCMake/CTestHardwareAllocation/lotsoftests-ctest-s-hw-check.cmake

@@ -1 +0,0 @@
-verify_ctest_hardware()

+ 0 - 16
Tests/RunCMake/CTestHardwareAllocation/lotsoftests.cmake

@@ -1,16 +0,0 @@
-setup_hardware_tests()
-
-add_hardware_test(Test1 2 "widgets:8;2,widgets:2")
-add_hardware_test(Test2 5 "fluxcapacitors:40")
-add_hardware_test(Test3 1 "10,widgets:1,fluxcapacitors:2")
-add_hardware_test(Test4 4 "fluxcapacitors:121")
-
-foreach(i RANGE 5 50)
-  add_hardware_test(Test${i} 1 "2,widgets:1")
-endforeach()
-
-foreach(i RANGE 51 100)
-  add_hardware_test(Test${i} 1 "2,transmogrifiers:2")
-endforeach()
-
-cleanup_hardware_tests()

+ 0 - 3
Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-check.cmake

@@ -1,3 +0,0 @@
-if(EXISTS "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log")
-  set(RunCMake_TEST_FAILED "cthwalloc.log should not exist")
-endif()

+ 0 - 4
Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-stderr.txt

@@ -1,4 +0,0 @@
-^Insufficient resources
-CMake Error at [^
-]*/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw/test\.cmake:[0-9]+ \(message\):
-  Tests did not pass$

+ 0 - 5
Tests/RunCMake/CTestHardwareAllocation/notenough1.cmake

@@ -1,5 +0,0 @@
-setup_hardware_tests()
-
-add_hardware_test(Test1 1 "fluxcapacitors:200")
-
-cleanup_hardware_tests()

+ 0 - 3
Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-check.cmake

@@ -1,3 +0,0 @@
-if(EXISTS "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log")
-  set(RunCMake_TEST_FAILED "cthwalloc.log should not exist")
-endif()

+ 0 - 4
Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-stderr.txt

@@ -1,4 +0,0 @@
-^Insufficient resources
-CMake Error at [^
-]*/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw/test\.cmake:[0-9]+ \(message\):
-  Tests did not pass$

+ 0 - 5
Tests/RunCMake/CTestHardwareAllocation/notenough2.cmake

@@ -1,5 +0,0 @@
-setup_hardware_tests()
-
-add_hardware_test(Test1 1 "terminators:2")
-
-cleanup_hardware_tests()

+ 0 - 1
Tests/RunCMake/CTestHardwareAllocation/process_count-ctest-s-hw-check.cmake

@@ -1 +0,0 @@
-verify_ctest_hardware()

+ 0 - 5
Tests/RunCMake/CTestHardwareAllocation/process_count.cmake

@@ -1,5 +0,0 @@
-setup_hardware_tests()
-
-add_hardware_test(Test1 1 "widgets:1")
-
-cleanup_hardware_tests()

+ 1 - 1
Tests/RunCMake/CTestHardwareAllocation/CMakeLists.txt.in → Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in

@@ -4,6 +4,6 @@ if(CASE_NAME MATCHES "^(.*)-ctest-s")
   set(projname "${CMAKE_MATCH_1}")
   project(${projname} NONE)
   include(CTest)
-  include("@RunCMake_SOURCE_DIR@/HardwareCommon.cmake")
+  include("@RunCMake_SOURCE_DIR@/ResourceCommon.cmake")
   include("@RunCMake_SOURCE_DIR@/${projname}.cmake")
 endif()

+ 23 - 0
Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake

@@ -0,0 +1,23 @@
+function(setup_resource_tests)
+  if(CTEST_RESOURCE_ALLOC_ENABLED)
+    add_test(NAME ResourceSetup COMMAND "${CMAKE_COMMAND}" -E remove -f "${CMAKE_BINARY_DIR}/ctresalloc.log")
+  endif()
+endfunction()
+
+function(add_resource_test name sleep_time proc)
+  if(CTEST_RESOURCE_ALLOC_ENABLED)
+    add_test(NAME "${name}" COMMAND "${CTRESALLOC_COMMAND}" write "${CMAKE_BINARY_DIR}/ctresalloc.log" "${name}" "${sleep_time}" "${proc}")
+    set_property(TEST "${name}" PROPERTY DEPENDS ResourceSetup)
+  else()
+    add_test(NAME "${name}" COMMAND "${CTRESALLOC_COMMAND}" write "${CMAKE_BINARY_DIR}/ctresalloc.log" "${name}" "${sleep_time}")
+  endif()
+  set_property(TEST "${name}" PROPERTY RESOURCE_GROUPS "${proc}")
+  list(APPEND RESOURCE_TESTS "${name}")
+  set(RESOURCE_TESTS "${RESOURCE_TESTS}" PARENT_SCOPE)
+endfunction()
+
+function(cleanup_resource_tests)
+  if(CTEST_RESOURCE_ALLOC_ENABLED)
+    file(WRITE "${CMAKE_BINARY_DIR}/restests.txt" "${RESOURCE_TESTS}")
+  endif()
+endfunction()

+ 167 - 0
Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake

@@ -0,0 +1,167 @@
+include(RunCMake)
+include(RunCTest)
+
+###############################################################################
+# Test ctresalloc itself - we want to make sure it's not just rubber-stamping
+# the test results
+###############################################################################
+
+function(ctresalloc_verify_log expected_contents)
+  if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log")
+    string(APPEND RunCMake_TEST_FAILED "Log file was not written\n")
+    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+    return()
+  endif()
+  file(READ "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log" actual_contents)
+  if(NOT actual_contents STREQUAL expected_contents)
+    string(APPEND RunCMake_TEST_FAILED "Actual log did not match expected log\n")
+    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+  endif()
+endfunction()
+
+function(run_ctresalloc_write_proc name proc)
+  file(REMOVE "${RunCMake_BINARY_DIR}/${name}-build/ctresalloc.log")
+  run_ctresalloc_write_proc_nodel("${name}" "${proc}" "${ARGN}")
+endfunction()
+
+function(run_ctresalloc_write_proc_nodel name proc)
+  string(REPLACE ";" "\\;" proc "${proc}")
+  run_cmake_command(${name} "${CMAKE_COMMAND}" -E env "${ARGN}" "${CTRESALLOC_COMMAND}" write "${RunCMake_BINARY_DIR}/${name}-build/ctresalloc.log" "${name}" 0 "${proc}")
+endfunction()
+
+function(run_ctresalloc_write_noproc name)
+  run_cmake_command(${name} "${CMAKE_COMMAND}" -E env "${ARGN}" "${CTRESALLOC_COMMAND}" write "${RunCMake_BINARY_DIR}/${name}-build/ctresalloc.log" "${name}" 0)
+endfunction()
+
+function(run_ctresalloc_verify name tests)
+  string(REPLACE ";" "\\;" tests "${tests}")
+  run_cmake_command(${name} "${CTRESALLOC_COMMAND}" verify "${RunCMake_SOURCE_DIR}/${name}.log" "${CMAKE_CURRENT_LIST_DIR}/resspec.json" "${tests}")
+endfunction()
+
+unset(ENV{CTEST_RESOURCE_GROUP_COUNT})
+set(RunCMake_TEST_NO_CLEAN 1)
+file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/ctresalloc-write-proc-good1-build")
+file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ctresalloc-write-proc-good1-build")
+file(WRITE "${RunCMake_BINARY_DIR}/ctresalloc-write-proc-good1-build/ctresalloc.log"
+[[begin test1
+alloc widgets 0 1
+dealloc widgets 0 1
+end test1
+]])
+run_ctresalloc_write_proc_nodel(ctresalloc-write-proc-good1 "1,widgets:2,transmogrifiers:1;2,widgets:1,widgets:2"
+  CTEST_RESOURCE_GROUP_COUNT=3
+  CTEST_RESOURCE_GROUP_0=widgets,transmogrifiers
+  CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2
+  CTEST_RESOURCE_GROUP_0_TRANSMOGRIFIERS=id:calvin,slots:1
+  CTEST_RESOURCE_GROUP_1=widgets
+  "CTEST_RESOURCE_GROUP_1_WIDGETS=id:0,slots:1\\;id:2,slots:2"
+  CTEST_RESOURCE_GROUP_2=widgets
+  "CTEST_RESOURCE_GROUP_2_WIDGETS=id:0,slots:1\\;id:2,slots:2"
+  )
+set(RunCMake_TEST_NO_CLEAN 0)
+run_ctresalloc_write_proc(ctresalloc-write-proc-good2 "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:8
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-nocount "widgets:8")
+run_ctresalloc_write_proc(ctresalloc-write-proc-badcount "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=2
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-nores "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badres "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets,transmogrifiers
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-nowidgets "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets1 "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  CTEST_RESOURCE_GROUP_0_WIDGETS=
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets2 "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:8\\;id:0,slots:1"
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets3 "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  CTEST_RESOURCE_GROUP_0_WIDGETS=id:3,slots:7
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets4 "widgets:8"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  CTEST_RESOURCE_GROUP_0_WIDGETS=invalid
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets5 "widgets:2,widgets:2"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets6 "widgets:2"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  "CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
+  )
+run_ctresalloc_write_proc(ctresalloc-write-proc-badwidgets7 "widgets:2,widgets:2"
+  CTEST_RESOURCE_GROUP_COUNT=1
+  CTEST_RESOURCE_GROUP_0=widgets
+  CTEST_RESOURCE_GROUP_0_WIDGETS=id:0,slots:2
+  )
+
+run_ctresalloc_write_noproc(ctresalloc-write-noproc-good1)
+run_ctresalloc_write_noproc(ctresalloc-write-noproc-count
+  CTEST_RESOURCE_GROUP_COUNT=1
+  )
+
+run_ctresalloc_verify(ctresalloc-verify-good1 "test1;test2")
+run_ctresalloc_verify(ctresalloc-verify-good2 "")
+run_ctresalloc_verify(ctresalloc-verify-nolog "")
+run_ctresalloc_verify(ctresalloc-verify-nores "")
+run_ctresalloc_verify(ctresalloc-verify-noid "")
+run_ctresalloc_verify(ctresalloc-verify-notenough "")
+run_ctresalloc_verify(ctresalloc-verify-baddealloc "")
+run_ctresalloc_verify(ctresalloc-verify-leak "")
+run_ctresalloc_verify(ctresalloc-verify-badtest1 "")
+run_ctresalloc_verify(ctresalloc-verify-badtest2 "test1")
+run_ctresalloc_verify(ctresalloc-verify-badtest3 "test1")
+run_ctresalloc_verify(ctresalloc-verify-badtest4 "test1")
+run_ctresalloc_verify(ctresalloc-verify-badtest5 "test1")
+run_ctresalloc_verify(ctresalloc-verify-nobegin "test1")
+run_ctresalloc_verify(ctresalloc-verify-noend "test1")
+
+###############################################################################
+# Now test the resource allocation feature of CTest
+###############################################################################
+
+function(run_ctest_resource name parallel random)
+  run_ctest("${name}-ctest-s-res" "-DCTEST_RESOURCE_ALLOC_ENABLED=1" "-DCTRESALLOC_COMMAND=${CTRESALLOC_COMMAND}" "-DCTEST_PARALLEL=${parallel}" "-DCTEST_RANDOM=${random}")
+  run_ctest("${name}-ctest-s-nores" "-DCTEST_RESOURCE_ALLOC_ENABLED=0" "-DCTRESALLOC_COMMAND=${CTRESALLOC_COMMAND}" "-DCTEST_PARALLEL=${parallel}" "-DCTEST_RANDOM=${random}")
+endfunction()
+
+function(verify_ctest_resources)
+  file(READ "${RunCMake_TEST_BINARY_DIR}/restests.txt" restests)
+  execute_process(COMMAND "${CTRESALLOC_COMMAND}" verify "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log" "${CMAKE_CURRENT_LIST_DIR}/resspec.json" "${restests}"
+    OUTPUT_VARIABLE output ERROR_QUIET RESULT_VARIABLE result)
+  if(result)
+    string(APPEND RunCMake_TEST_FAILED "${output}")
+    set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+  endif()
+endfunction()
+
+run_ctest_resource(lotsoftests 10 1)
+run_ctest_resource(checkfree1 2 0)
+run_ctest_resource(checkfree2 1 0)
+run_ctest_resource(notenough1 1 0)
+run_ctest_resource(notenough2 1 0)
+run_ctest_resource(ensure_parallel 2 0)
+
+set(ENV{CTEST_RESOURCE_GROUP_COUNT} 2)
+run_ctest_resource(process_count 1 0)
+unset(ENV{CTEST_RESOURCE_GROUP_COUNT})

+ 1 - 0
Tests/RunCMake/CTestResourceAllocation/checkfree1-ctest-s-res-check.cmake

@@ -0,0 +1 @@
+verify_ctest_resources()

+ 7 - 0
Tests/RunCMake/CTestResourceAllocation/checkfree1.cmake

@@ -0,0 +1,7 @@
+setup_resource_tests()
+
+add_resource_test(Test1 1 "widgets:8")
+add_resource_test(Test2 1 "fluxcapacitors:50;fluxcapacitors:50,widgets:8")
+add_resource_test(Test3 1 "fluxcapacitors:121")
+
+cleanup_resource_tests()

+ 1 - 0
Tests/RunCMake/CTestResourceAllocation/checkfree2-ctest-s-res-check.cmake

@@ -0,0 +1 @@
+verify_ctest_resources()

+ 8 - 0
Tests/RunCMake/CTestResourceAllocation/checkfree2.cmake

@@ -0,0 +1,8 @@
+setup_resource_tests()
+
+# This test is an attack on the resource scheduling algorithm. It has been
+# carefully crafted to fool the algorithm into thinking there aren't sufficient
+# resources for it.
+add_resource_test(Test1 1 "widgets:2;4,widgets:4")
+
+cleanup_resource_tests()

+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good1.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good1.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good2.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good2.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nolog-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nolog-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough.log → Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough.log


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-noproc-count-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-noproc-count-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badcount-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badcount-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badres-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badres-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets1-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets1-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets2-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets2-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets3-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets3-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets4-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets4-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets5-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets5-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets6-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets6-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets7-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets7-result.txt


+ 3 - 3
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good1-check.cmake → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good1-check.cmake

@@ -1,9 +1,9 @@
-cthwalloc_verify_log(
+ctresalloc_verify_log(
 [[begin test1
 alloc widgets 0 1
 dealloc widgets 0 1
 end test1
-begin cthwalloc-write-proc-good1
+begin ctresalloc-write-proc-good1
 alloc transmogrifiers calvin 1
 alloc widgets 0 2
 alloc widgets 0 1
@@ -16,5 +16,5 @@ dealloc widgets 0 1
 dealloc widgets 2 2
 dealloc widgets 0 1
 dealloc widgets 2 2
-end cthwalloc-write-proc-good1
+end ctresalloc-write-proc-good1
 ]])

+ 6 - 0
Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good2-check.cmake

@@ -0,0 +1,6 @@
+ctresalloc_verify_log(
+[[begin ctresalloc-write-proc-good2
+alloc widgets 3 8
+dealloc widgets 3 8
+end ctresalloc-write-proc-good2
+]])

+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nocount-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nocount-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nores-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nores-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nowidgets-result.txt → Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nowidgets-result.txt


+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx → Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx


+ 3 - 3
Tests/RunCMake/CTestHardwareAllocation/ensure_parallel-ctest-s-hw-check.cmake → Tests/RunCMake/CTestResourceAllocation/ensure_parallel-ctest-s-res-check.cmake

@@ -1,4 +1,4 @@
-verify_ctest_hardware()
+verify_ctest_resources()
 
 set(expected_contents [[
 begin Test1
@@ -10,7 +10,7 @@ end Test1
 dealloc transmogrifiers hobbes 2
 end Test2
 ]])
-file(READ "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log" actual_contents)
+file(READ "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log" actual_contents)
 if(NOT actual_contents STREQUAL expected_contents)
-  string(APPEND RunCMake_TEST_FAILED "cthwalloc.log contents did not match expected\n")
+  string(APPEND RunCMake_TEST_FAILED "ctresalloc.log contents did not match expected\n")
 endif()

+ 4 - 4
Tests/RunCMake/CTestHardwareAllocation/ensure_parallel.cmake → Tests/RunCMake/CTestResourceAllocation/ensure_parallel.cmake

@@ -1,11 +1,11 @@
-setup_hardware_tests()
+setup_resource_tests()
 
-add_hardware_test(Test1 4 "transmogrifiers:2")
+add_resource_test(Test1 4 "transmogrifiers:2")
 
 # Mitigate possible race conditions to ensure that the events are logged in the
 # exact order we want
 add_test(NAME Test2Sleep COMMAND "${CMAKE_COMMAND}" -E sleep 2)
-add_hardware_test(Test2 4 "transmogrifiers:2")
+add_resource_test(Test2 4 "transmogrifiers:2")
 set_property(TEST Test2 APPEND PROPERTY DEPENDS Test2Sleep)
 
-cleanup_hardware_tests()
+cleanup_resource_tests()

+ 1 - 0
Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake

@@ -0,0 +1 @@
+verify_ctest_resources()

+ 16 - 0
Tests/RunCMake/CTestResourceAllocation/lotsoftests.cmake

@@ -0,0 +1,16 @@
+setup_resource_tests()
+
+add_resource_test(Test1 2 "widgets:8;2,widgets:2")
+add_resource_test(Test2 5 "fluxcapacitors:40")
+add_resource_test(Test3 1 "10,widgets:1,fluxcapacitors:2")
+add_resource_test(Test4 4 "fluxcapacitors:121")
+
+foreach(i RANGE 5 50)
+  add_resource_test(Test${i} 1 "2,widgets:1")
+endforeach()
+
+foreach(i RANGE 51 100)
+  add_resource_test(Test${i} 1 "2,transmogrifiers:2")
+endforeach()
+
+cleanup_resource_tests()

+ 3 - 0
Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-check.cmake

@@ -0,0 +1,3 @@
+if(EXISTS "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log")
+  set(RunCMake_TEST_FAILED "ctresalloc.log should not exist")
+endif()

+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-result.txt → Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-result.txt


+ 4 - 0
Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-stderr.txt

@@ -0,0 +1,4 @@
+^Insufficient resources
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res/test\.cmake:[0-9]+ \(message\):
+  Tests did not pass$

+ 5 - 0
Tests/RunCMake/CTestResourceAllocation/notenough1.cmake

@@ -0,0 +1,5 @@
+setup_resource_tests()
+
+add_resource_test(Test1 1 "fluxcapacitors:200")
+
+cleanup_resource_tests()

+ 3 - 0
Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-check.cmake

@@ -0,0 +1,3 @@
+if(EXISTS "${RunCMake_TEST_BINARY_DIR}/ctresalloc.log")
+  set(RunCMake_TEST_FAILED "ctresalloc.log should not exist")
+endif()

+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-result.txt → Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-result.txt


+ 4 - 0
Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-stderr.txt

@@ -0,0 +1,4 @@
+^Insufficient resources
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res/test\.cmake:[0-9]+ \(message\):
+  Tests did not pass$

+ 5 - 0
Tests/RunCMake/CTestResourceAllocation/notenough2.cmake

@@ -0,0 +1,5 @@
+setup_resource_tests()
+
+add_resource_test(Test1 1 "terminators:2")
+
+cleanup_resource_tests()

+ 1 - 0
Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake

@@ -0,0 +1 @@
+verify_ctest_resources()

+ 5 - 0
Tests/RunCMake/CTestResourceAllocation/process_count.cmake

@@ -0,0 +1,5 @@
+setup_resource_tests()
+
+add_resource_test(Test1 1 "widgets:1")
+
+cleanup_resource_tests()

+ 0 - 0
Tests/RunCMake/CTestHardwareAllocation/hwspec.json → Tests/RunCMake/CTestResourceAllocation/resspec.json


+ 4 - 4
Tests/RunCMake/CTestHardwareAllocation/test.cmake.in → Tests/RunCMake/CTestResourceAllocation/test.cmake.in

@@ -10,14 +10,14 @@ set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
 
 ctest_start(Experimental QUIET)
 ctest_configure(OPTIONS
-  "-DCTEST_HARDWARE_ALLOC_ENABLED=${CTEST_HARDWARE_ALLOC_ENABLED};-DCTHWALLOC_COMMAND=${CTHWALLOC_COMMAND}"
+  "-DCTEST_RESOURCE_ALLOC_ENABLED=${CTEST_RESOURCE_ALLOC_ENABLED};-DCTRESALLOC_COMMAND=${CTRESALLOC_COMMAND}"
   )
 ctest_build()
 
-if(CTEST_HARDWARE_ALLOC_ENABLED)
-  set(hwspec RESOURCE_SPEC_FILE "@RunCMake_SOURCE_DIR@/hwspec.json")
+if(CTEST_RESOURCE_ALLOC_ENABLED)
+  set(resspec RESOURCE_SPEC_FILE "@RunCMake_SOURCE_DIR@/resspec.json")
 endif()
-ctest_test(${hwspec} RETURN_VALUE retval PARALLEL_LEVEL ${CTEST_PARALLEL} SCHEDULE_RANDOM ${CTEST_RANDOM})
+ctest_test(${resspec} RETURN_VALUE retval PARALLEL_LEVEL ${CTEST_PARALLEL} SCHEDULE_RANDOM ${CTEST_RANDOM})
 if(retval)
   message(FATAL_ERROR "Tests did not pass")
 endif()