summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-04 21:11:11 (GMT)
committerBrad King <brad.king@kitware.com>2019-11-05 17:08:01 (GMT)
commitaf9ed543b0f9d032158f91cdce7ad6908ff9365b (patch)
tree35440e92b200965f0be878b37226ca0663bdf0a2 /Tests
parentc1d5d5eb11e0260ffadda0851ac844ab46b6b179 (diff)
downloadCMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.zip
CMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.tar.gz
CMake-af9ed543b0f9d032158f91cdce7ad6908ff9365b.tar.bz2
CTest: Rename PROCESSES test property to RESOURCE_GROUPS
The `PROCESSES` test property name added for CMake 3.16 is too close to the existing `PROCESSORS` test property. Furthermore, the property in principle specifies groups of resources organized in a way that is meaningful to a particular test. The groups may often correspond to processes but they could have other meanings. Since the property name `PROCESSES` has not been in a final 3.16 release yet, simply rename it to `RESOURCE_GROUPS`. Fixes: #19914
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/CMakeLists.txt2
-rw-r--r--Tests/CMakeLib/testCTestResourceGroups.cxx (renamed from Tests/CMakeLib/testCTestProcesses.cxx)11
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py6
-rw-r--r--Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake2
-rw-r--r--Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake84
-rw-r--r--Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx65
7 files changed, 88 insertions, 84 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index bc2079f..8e11fdf 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -8,9 +8,9 @@ include_directories(
set(CMakeLib_TESTS
testArgumentParser.cxx
testCTestBinPacker.cxx
- testCTestProcesses.cxx
testCTestHardwareAllocator.cxx
testCTestHardwareSpec.cxx
+ testCTestResourceGroups.cxx
testGeneratedFileStream.cxx
testRST.cxx
testRange.cxx
diff --git a/Tests/CMakeLib/testCTestProcesses.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx
index acf4f67..5fd7d4a 100644
--- a/Tests/CMakeLib/testCTestProcesses.cxx
+++ b/Tests/CMakeLib/testCTestResourceGroups.cxx
@@ -106,24 +106,25 @@ bool TestExpectedParseResult(const ExpectedParseResult& expected)
std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
result;
bool retval;
- if ((retval = cmCTestTestHandler::ParseProcessesProperty(
+ if ((retval = cmCTestTestHandler::ParseResourceGroupsProperty(
expected.String, result)) != expected.ExpectedReturnValue) {
- std::cout << "ParseProcessesProperty(\"" << expected.String
+ std::cout << "ParseResourceGroupsProperty(\"" << expected.String
<< "\") returned " << retval << ", should be "
<< expected.ExpectedReturnValue << std::endl;
return false;
}
if (result != expected.ExpectedValue) {
- std::cout << "ParseProcessesProperty(\"" << expected.String
- << "\") did not yield expected set of processes" << std::endl;
+ std::cout << "ParseResourceGroupsProperty(\"" << expected.String
+ << "\") did not yield expected set of resource groups"
+ << std::endl;
return false;
}
return true;
}
-int testCTestProcesses(int /*unused*/, char* /*unused*/ [])
+int testCTestResourceGroups(int /*unused*/, char* /*unused*/ [])
{
int retval = 0;
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index fd2c97f..6b23162 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -258,7 +258,7 @@ function(run_ShowOnly)
add_test(ShowOnly \"${CMAKE_COMMAND}\" -E echo)
set_tests_properties(ShowOnly PROPERTIES
WILL_FAIL true
- PROCESSES \"2,threads:2,gpus:4;gpus:2,threads:4\"
+ RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
)
diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
index 6eb8624..b818650 100644
--- a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
+++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
@@ -80,12 +80,12 @@ def check_willfail_property(p):
assert p["name"] == "WILL_FAIL"
assert p["value"] == True
-def check_processes_property(p):
+def check_resource_groups_property(p):
assert is_dict(p)
assert sorted(p.keys()) == ["name", "value"]
assert is_string(p["name"])
assert is_list(p["value"])
- assert p["name"] == "PROCESSES"
+ assert p["name"] == "RESOURCE_GROUPS"
assert len(p["value"]) == 3
assert is_dict(p["value"][0])
@@ -147,7 +147,7 @@ def check_workingdir_property(p):
def check_properties(p):
assert is_list(p)
assert len(p) == 4
- check_processes_property(p[0])
+ check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_willfail_property(p[2])
check_workingdir_property(p[3])
diff --git a/Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake b/Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake
index 3893d40..3288f35 100644
--- a/Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake
+++ b/Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake
@@ -11,7 +11,7 @@ function(add_hardware_test name sleep_time proc)
else()
add_test(NAME "${name}" COMMAND "${CTHWALLOC_COMMAND}" write "${CMAKE_BINARY_DIR}/cthwalloc.log" "${name}" "${sleep_time}")
endif()
- set_property(TEST "${name}" PROPERTY PROCESSES "${proc}")
+ set_property(TEST "${name}" PROPERTY RESOURCE_GROUPS "${proc}")
list(APPEND HARDWARE_TESTS "${name}")
set(HARDWARE_TESTS "${HARDWARE_TESTS}" PARENT_SCOPE)
endfunction()
diff --git a/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake
index d666922..f69afc7 100644
--- a/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake
@@ -38,7 +38,7 @@ function(run_cthwalloc_verify name tests)
run_cmake_command(${name} "${CTHWALLOC_COMMAND}" verify "${RunCMake_SOURCE_DIR}/${name}.log" "${CMAKE_CURRENT_LIST_DIR}/hwspec.json" "${tests}")
endfunction()
-unset(ENV{CTEST_PROCESS_COUNT})
+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")
@@ -49,75 +49,75 @@ 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_PROCESS_COUNT=3
- CTEST_PROCESS_0=widgets,transmogrifiers
- CTEST_PROCESS_0_WIDGETS=id:0,slots:2
- CTEST_PROCESS_0_TRANSMOGRIFIERS=id:calvin,slots:1
- CTEST_PROCESS_1=widgets
- "CTEST_PROCESS_1_WIDGETS=id:0,slots:1\\;id:2,slots:2"
- CTEST_PROCESS_2=widgets
- "CTEST_PROCESS_2_WIDGETS=id:0,slots:1\\;id:2,slots: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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- CTEST_PROCESS_0_WIDGETS=id:3,slots: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_PROCESS_COUNT=2
+ CTEST_RESOURCE_GROUP_COUNT=2
)
run_cthwalloc_write_proc(cthwalloc-write-proc-nores "widgets:8"
- CTEST_PROCESS_COUNT=1
+ CTEST_RESOURCE_GROUP_COUNT=1
)
run_cthwalloc_write_proc(cthwalloc-write-proc-badres "widgets:8"
- CTEST_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets,transmogrifiers
+ CTEST_RESOURCE_GROUP_COUNT=1
+ CTEST_RESOURCE_GROUP_0=widgets,transmogrifiers
)
run_cthwalloc_write_proc(cthwalloc-write-proc-nowidgets "widgets:8"
- CTEST_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
+ CTEST_RESOURCE_GROUP_COUNT=1
+ CTEST_RESOURCE_GROUP_0=widgets
)
run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets1 "widgets:8"
- CTEST_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- CTEST_PROCESS_0_WIDGETS=
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- "CTEST_PROCESS_0_WIDGETS=id:3,slots:8\\;id:0,slots:1"
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- CTEST_PROCESS_0_WIDGETS=id:3,slots:7
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- CTEST_PROCESS_0_WIDGETS=invalid
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- "CTEST_PROCESS_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- "CTEST_PROCESS_0_WIDGETS=id:0,slots:2\\;id:0,slots:1"
+ 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_PROCESS_COUNT=1
- CTEST_PROCESS_0=widgets
- CTEST_PROCESS_0_WIDGETS=id:0,slots: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_PROCESS_COUNT=1
+ CTEST_RESOURCE_GROUP_COUNT=1
)
run_cthwalloc_verify(cthwalloc-verify-good1 "test1;test2")
@@ -162,6 +162,6 @@ run_ctest_hardware(notenough1 1 0)
run_ctest_hardware(notenough2 1 0)
run_ctest_hardware(ensure_parallel 2 0)
-set(ENV{CTEST_PROCESS_COUNT} 2)
+set(ENV{CTEST_RESOURCE_GROUP_COUNT} 2)
run_ctest_hardware(process_count 1 0)
-unset(ENV{CTEST_PROCESS_COUNT})
+unset(ENV{CTEST_RESOURCE_GROUP_COUNT})
diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx b/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx
index eee2c7f..e5f0283 100644
--- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx
+++ b/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx
@@ -26,11 +26,11 @@
* This helper program is used to verify that the CTest hardware allocation
* feature is working correctly. It consists of two stages:
*
- * 1) write - This stage receives the PROCESSES property of the test and
- * compares it with the values passed in the CTEST_PROCESS_* environment
- * variables. If it received all of the resources it expected, then it
- * writes this information to a log file, which will be read in the verify
- * stage.
+ * 1) write - This stage receives the RESOURCE_GROUPS property of the test and
+ * compares it with the values passed in the CTEST_RESOURCE_GROUP_*
+ * environment variables. If it received all of the resources it expected,
+ * then it writes this information to a log file, which will be read in
+ * the verify stage.
* 2) verify - This stage compares the log file with the hardware spec file to
* make sure that no resources were over-subscribed, deallocated without
* being allocated, or allocated without being deallocated.
@@ -46,7 +46,7 @@ static int usageWrite(const char* argv0)
{
std::cout << "Usage: " << argv0
<< " write <log-file> <test-name> <sleep-time-secs>"
- " [<processes-property>]"
+ " [<resource-groups-property>]"
<< std::endl;
return 1;
}
@@ -71,28 +71,30 @@ static int doWrite(int argc, char const* const* argv)
std::string, std::vector<cmCTestMultiProcessHandler::HardwareAllocation>>>
hardware;
if (argc == 6) {
- // Parse processes property
- std::string processesProperty = argv[5];
+ // Parse RESOURCE_GROUPS property
+ std::string resourceGroupsProperty = argv[5];
std::vector<
std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
- processes;
- bool result =
- cmCTestTestHandler::ParseProcessesProperty(processesProperty, processes);
+ resourceGroups;
+ bool result = cmCTestTestHandler::ParseResourceGroupsProperty(
+ resourceGroupsProperty, resourceGroups);
(void)result;
assert(result);
- // Verify process count
- const char* processCountEnv = cmSystemTools::GetEnv("CTEST_PROCESS_COUNT");
- if (!processCountEnv) {
- std::cout << "CTEST_PROCESS_COUNT should be defined" << std::endl;
+ // Verify group count
+ const char* resourceGroupCountEnv =
+ cmSystemTools::GetEnv("CTEST_RESOURCE_GROUP_COUNT");
+ if (!resourceGroupCountEnv) {
+ std::cout << "CTEST_RESOURCE_GROUP_COUNT should be defined" << std::endl;
return 1;
}
- int processCount = std::atoi(processCountEnv);
- if (processes.size() != std::size_t(processCount)) {
- std::cout << "CTEST_PROCESS_COUNT does not match expected processes"
- << std::endl
- << "Expected: " << processes.size() << std::endl
- << "Actual: " << processCount << std::endl;
+ int resourceGroupCount = std::atoi(resourceGroupCountEnv);
+ if (resourceGroups.size() != std::size_t(resourceGroupCount)) {
+ std::cout
+ << "CTEST_RESOURCE_GROUP_COUNT does not match expected resource groups"
+ << std::endl
+ << "Expected: " << resourceGroups.size() << std::endl
+ << "Actual: " << resourceGroupCount << std::endl;
return 1;
}
@@ -110,15 +112,15 @@ static int doWrite(int argc, char const* const* argv)
std::size_t i = 0;
cmsys::ofstream fout(logFile.c_str(), std::ios::app);
fout << "begin " << testName << std::endl;
- for (auto& process : processes) {
+ for (auto& resourceGroup : resourceGroups) {
try {
// Build and verify set of expected resources
std::set<std::string> expectedResources;
- for (auto const& it : process) {
+ for (auto const& it : resourceGroup) {
expectedResources.insert(it.ResourceType);
}
- std::string prefix = "CTEST_PROCESS_";
+ std::string prefix = "CTEST_RESOURCE_GROUP_";
prefix += std::to_string(i);
const char* actualResourcesCStr = cmSystemTools::GetEnv(prefix);
if (!actualResourcesCStr) {
@@ -147,7 +149,7 @@ static int doWrite(int argc, char const* const* argv)
std::vector<cmCTestMultiProcessHandler::HardwareAllocation>>
hwEntry;
for (auto const& type : actualResources) {
- auto it = process.begin();
+ auto it = resourceGroup.begin();
std::string varName = prefix;
varName += cmSystemTools::UpperCase(type);
@@ -161,7 +163,7 @@ static int doWrite(int argc, char const* const* argv)
for (auto const& r : received) {
while (it->ResourceType != type || it->UnitsNeeded == 0) {
++it;
- if (it == process.end()) {
+ if (it == resourceGroup.end()) {
std::cout << varName << " did not list expected resources"
<< std::endl;
return 1;
@@ -198,7 +200,7 @@ static int doWrite(int argc, char const* const* argv)
bool ended = false;
while (it->ResourceType != type || it->UnitsNeeded == 0) {
++it;
- if (it == process.end()) {
+ if (it == resourceGroup.end()) {
ended = true;
break;
}
@@ -225,8 +227,9 @@ static int doWrite(int argc, char const* const* argv)
return 1;
}
} else {
- if (cmSystemTools::GetEnv("CTEST_PROCESS_COUNT")) {
- std::cout << "CTEST_PROCESS_COUNT should not be defined" << std::endl;
+ if (cmSystemTools::GetEnv("CTEST_RESOURCE_GROUP_COUNT")) {
+ std::cout << "CTEST_RESOURCE_GROUP_COUNT should not be defined"
+ << std::endl;
return 1;
}
}
@@ -246,8 +249,8 @@ static int doWrite(int argc, char const* const* argv)
return 1;
}
cmsys::ofstream fout(logFile.c_str(), std::ios::app);
- for (auto const& process : hardware) {
- for (auto const& it : process) {
+ for (auto const& group : hardware) {
+ for (auto const& it : group) {
for (auto const& it2 : it.second) {
fout << "dealloc " << it.first << " " << it2.Id << " " << it2.Slots
<< std::endl;