MCPcopy Create free account
hub / github.com/Kitware/CMake / CheckGeneratedResourceSpec

Method CheckGeneratedResourceSpec

Source/CTest/cmCTestMultiProcessHandler.cxx:1602–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1600}
1601
1602bool cmCTestMultiProcessHandler::CheckGeneratedResourceSpec()
1603{
1604 for (auto& test : this->Properties) {
1605 if (!test.second->GeneratedResourceSpecFile.empty()) {
1606 if (this->ResourceSpecSetupTest) {
1607 cmCTestLog(
1608 this->CTest, ERROR_MESSAGE,
1609 "Only one test may define the GENERATED_RESOURCE_SPEC_FILE property"
1610 << std::endl);
1611 return false;
1612 }
1613
1614 if (test.second->FixturesSetup.size() != 1) {
1615 cmCTestLog(this->CTest, ERROR_MESSAGE,
1616 "Test that defines GENERATED_RESOURCE_SPEC_FILE must have "
1617 "exactly one FIXTURES_SETUP"
1618 << std::endl);
1619 return false;
1620 }
1621
1622 if (!cmSystemTools::FileIsFullPath(
1623 test.second->GeneratedResourceSpecFile)) {
1624 cmCTestLog(this->CTest, ERROR_MESSAGE,
1625 "GENERATED_RESOURCE_SPEC_FILE must be an absolute path"
1626 << std::endl);
1627 return false;
1628 }
1629
1630 this->ResourceSpecSetupTest = test.first;
1631 this->ResourceSpecSetupFixture = *test.second->FixturesSetup.begin();
1632 }
1633 }
1634
1635 if (!this->ResourceSpecSetupFixture.empty()) {
1636 for (auto& test : this->Properties) {
1637 if (!test.second->ResourceGroups.empty() &&
1638 !test.second->FixturesRequired.count(
1639 this->ResourceSpecSetupFixture)) {
1640 cmCTestLog(this->CTest, ERROR_MESSAGE,
1641 "All tests that have RESOURCE_GROUPS must include the "
1642 "resource spec generator fixture in their FIXTURES_REQUIRED"
1643 << std::endl);
1644 return false;
1645 }
1646 }
1647 }
1648
1649 if (!this->ResourceSpecFile.empty()) {
1650 if (this->ResourceSpecSetupTest) {
1651 cmCTestLog(this->CTest, ERROR_MESSAGE,
1652 "GENERATED_RESOURCE_SPEC_FILE test property cannot be used "
1653 "in conjunction with ResourceSpecFile option"
1654 << std::endl);
1655 return false;
1656 }
1657 std::string error;
1658 if (!this->InitResourceAllocator(error)) {
1659 cmCTestLog(this->CTest, ERROR_MESSAGE, error << std::endl);

Callers 1

SetTestsMethod · 0.95

Calls 5

InitResourceAllocatorMethod · 0.95
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected