diff options
Diffstat (limited to 'Tests')
324 files changed, 1425 insertions, 663 deletions
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index bc2079f..976c924 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 + testCTestResourceAllocator.cxx + testCTestResourceSpec.cxx + testCTestResourceGroups.cxx testGeneratedFileStream.cxx testRST.cxx testRange.cxx @@ -25,6 +25,7 @@ set(CMakeLib_TESTS testUVProcessChain.cxx testUVRAII.cxx testUVStreambuf.cxx + testCMExtMemory.cxx ) add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx) @@ -32,7 +33,7 @@ add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx) set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>) set(testUVStreambuf_ARGS $<TARGET_FILE:cmake>) -set(testCTestHardwareSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) +set(testCTestResourceSpec_ARGS ${CMAKE_CURRENT_SOURCE_DIR}) if(WIN32) list(APPEND CMakeLib_TESTS diff --git a/Tests/CMakeLib/testCMExtMemory.cxx b/Tests/CMakeLib/testCMExtMemory.cxx new file mode 100644 index 0000000..6663c17 --- /dev/null +++ b/Tests/CMakeLib/testCMExtMemory.cxx @@ -0,0 +1,65 @@ +#include <iostream> +#include <memory> + +#include <cmext/memory> + +namespace { +class Base +{ +public: + virtual ~Base() = default; +}; + +class Derived : public Base +{ +public: + ~Derived() = default; + + void method() {} +}; + +template <typename T> +class Wrapper +{ +public: + Wrapper(T* v) + : value(v) + { + } + ~Wrapper() { delete value; } + + T* get() const { return value; } + +private: + T* value; +}; + +bool testReferenceCast() +{ + std::cout << "testReferenceCast()" << std::endl; + + std::unique_ptr<Base> u(new Derived); + cm::static_reference_cast<Derived>(u).method(); + cm::dynamic_reference_cast<Derived>(u).method(); + + std::shared_ptr<Base> s(new Derived); + cm::static_reference_cast<Derived>(s).method(); + cm::dynamic_reference_cast<Derived>(s).method(); + + // can also be used with custom wrappers + Wrapper<Base> w(new Derived); + cm::static_reference_cast<Derived>(w).method(); + cm::dynamic_reference_cast<Derived>(w).method(); + + return true; +} +} + +int testCMExtMemory(int /*unused*/, char* /*unused*/ []) +{ + if (!testReferenceCast()) { + return 1; + } + + return 0; +} diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx index 62ea55b..6f09af2 100644 --- a/Tests/CMakeLib/testCTestBinPacker.cxx +++ b/Tests/CMakeLib/testCTestBinPacker.cxx @@ -5,12 +5,12 @@ #include <vector> #include "cmCTestBinPacker.h" -#include "cmCTestHardwareAllocator.h" +#include "cmCTestResourceAllocator.h" struct ExpectedPackResult { std::vector<int> SlotsNeeded; - std::map<std::string, cmCTestHardwareAllocator::Resource> Hardware; + std::map<std::string, cmCTestResourceAllocator::Resource> Resources; bool ExpectedReturnValue; std::vector<cmCTestBinPackerAllocation> ExpectedRoundRobinAllocations; std::vector<cmCTestBinPackerAllocation> ExpectedBlockAllocations; @@ -233,18 +233,18 @@ bool TestExpectedPackResult(const ExpectedPackResult& expected) roundRobinAllocations.push_back({ index++, n, "" }); } - bool roundRobinResult = cmAllocateCTestHardwareRoundRobin( - expected.Hardware, roundRobinAllocations); + bool roundRobinResult = cmAllocateCTestResourcesRoundRobin( + expected.Resources, roundRobinAllocations); if (roundRobinResult != expected.ExpectedReturnValue) { std::cout - << "cmAllocateCTestHardwareRoundRobin did not return expected value" + << "cmAllocateCTestResourcesRoundRobin did not return expected value" << std::endl; return false; } if (roundRobinResult && roundRobinAllocations != expected.ExpectedRoundRobinAllocations) { - std::cout << "cmAllocateCTestHardwareRoundRobin did not return expected " + std::cout << "cmAllocateCTestResourcesRoundRobin did not return expected " "allocations" << std::endl; return false; @@ -258,15 +258,15 @@ bool TestExpectedPackResult(const ExpectedPackResult& expected) } bool blockResult = - cmAllocateCTestHardwareBlock(expected.Hardware, blockAllocations); + cmAllocateCTestResourcesBlock(expected.Resources, blockAllocations); if (blockResult != expected.ExpectedReturnValue) { - std::cout << "cmAllocateCTestHardwareBlock did not return expected value" + std::cout << "cmAllocateCTestResourcesBlock did not return expected value" << std::endl; return false; } if (blockResult && blockAllocations != expected.ExpectedBlockAllocations) { - std::cout << "cmAllocateCTestHardwareBlock did not return expected" + std::cout << "cmAllocateCTestResourcesBlock did not return expected" " allocations" << std::endl; return false; diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec3.json b/Tests/CMakeLib/testCTestHardwareSpec_data/spec3.json deleted file mode 100644 index 82453ec..0000000 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "local": [ - { - }, - { - } - ] -} diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec4.json b/Tests/CMakeLib/testCTestHardwareSpec_data/spec4.json deleted file mode 100644 index 05e73d7..0000000 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec4.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "local": { - } -} diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec5.json b/Tests/CMakeLib/testCTestHardwareSpec_data/spec5.json deleted file mode 100644 index 2c63c08..0000000 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec5.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/Tests/CMakeLib/testCTestHardwareAllocator.cxx b/Tests/CMakeLib/testCTestResourceAllocator.cxx index 6f05d03..33d6b91 100644 --- a/Tests/CMakeLib/testCTestHardwareAllocator.cxx +++ b/Tests/CMakeLib/testCTestResourceAllocator.cxx @@ -3,24 +3,24 @@ #include <string> #include <vector> -#include "cmCTestHardwareAllocator.h" -#include "cmCTestHardwareSpec.h" +#include "cmCTestResourceAllocator.h" +#include "cmCTestResourceSpec.h" -static const cmCTestHardwareSpec spec{ { { +static const cmCTestResourceSpec spec{ { { /* clang-format off */ { "gpus", { { "0", 4 }, { "1", 8 }, { "2", 0 }, { "3", 8 } } }, /* clang-format on */ } } }; -bool testInitializeFromHardwareSpec() +bool testInitializeFromResourceSpec() { bool retval = true; - cmCTestHardwareAllocator allocator; - allocator.InitializeFromHardwareSpec(spec); + cmCTestResourceAllocator allocator; + allocator.InitializeFromResourceSpec(spec); static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected{ /* clang-format off */ { "gpus", { @@ -43,11 +43,11 @@ bool testAllocateResource() { bool retval = true; - cmCTestHardwareAllocator allocator; - allocator.InitializeFromHardwareSpec(spec); + cmCTestResourceAllocator allocator; + allocator.InitializeFromResourceSpec(spec); static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected1{ /* clang-format off */ { "gpus", { @@ -70,7 +70,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected2{ /* clang-format off */ { "gpus", { @@ -93,7 +93,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected3{ /* clang-format off */ { "gpus", { @@ -116,7 +116,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected4{ /* clang-format off */ { "gpus", { @@ -145,7 +145,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected5{ /* clang-format off */ { "gpus", { @@ -168,7 +168,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected6{ /* clang-format off */ { "gpus", { @@ -191,7 +191,7 @@ bool testAllocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected7{ /* clang-format off */ { "gpus", { @@ -220,11 +220,11 @@ bool testDeallocateResource() { bool retval = true; - cmCTestHardwareAllocator allocator; - allocator.InitializeFromHardwareSpec(spec); + cmCTestResourceAllocator allocator; + allocator.InitializeFromResourceSpec(spec); static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected1{ /* clang-format off */ { "gpus", { @@ -253,7 +253,7 @@ bool testDeallocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected2{ /* clang-format off */ { "gpus", { @@ -276,7 +276,7 @@ bool testDeallocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected3{ /* clang-format off */ { "gpus", { @@ -299,7 +299,7 @@ bool testDeallocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected4{ /* clang-format off */ { "gpus", { @@ -322,7 +322,7 @@ bool testDeallocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected5{ /* clang-format off */ { "gpus", { @@ -345,7 +345,7 @@ bool testDeallocateResource() } static const std::map< - std::string, std::map<std::string, cmCTestHardwareAllocator::Resource>> + std::string, std::map<std::string, cmCTestResourceAllocator::Resource>> expected6{ /* clang-format off */ { "gpus", { @@ -374,23 +374,23 @@ bool testResourceFree() { bool retval = true; - const cmCTestHardwareAllocator::Resource r1{ 5, 0 }; + const cmCTestResourceAllocator::Resource r1{ 5, 0 }; if (r1.Free() != 5) { - std::cout << "cmCTestHardwareAllocator::Resource::Free() did not return " + std::cout << "cmCTestResourceAllocator::Resource::Free() did not return " "expected value for { 5, 0 }\n"; retval = false; } - const cmCTestHardwareAllocator::Resource r2{ 3, 2 }; + const cmCTestResourceAllocator::Resource r2{ 3, 2 }; if (r2.Free() != 1) { - std::cout << "cmCTestHardwareAllocator::Resource::Free() did not return " + std::cout << "cmCTestResourceAllocator::Resource::Free() did not return " "expected value for { 3, 2 }\n"; retval = false; } - const cmCTestHardwareAllocator::Resource r3{ 4, 4 }; + const cmCTestResourceAllocator::Resource r3{ 4, 4 }; if (r3.Free() != 0) { - std::cout << "cmCTestHardwareAllocator::Resource::Free() did not return " + std::cout << "cmCTestResourceAllocator::Resource::Free() did not return " "expected value for { 4, 4 }\n"; retval = false; } @@ -398,12 +398,12 @@ bool testResourceFree() return retval; } -int testCTestHardwareAllocator(int, char** const) +int testCTestResourceAllocator(int, char** const) { int retval = 0; - if (!testInitializeFromHardwareSpec()) { - std::cout << "in testInitializeFromHardwareSpec()\n"; + if (!testInitializeFromResourceSpec()) { + std::cout << "in testInitializeFromResourceSpec()\n"; retval = -1; } diff --git a/Tests/CMakeLib/testCTestProcesses.cxx b/Tests/CMakeLib/testCTestResourceGroups.cxx index acf4f67..c3532a6 100644 --- a/Tests/CMakeLib/testCTestProcesses.cxx +++ b/Tests/CMakeLib/testCTestResourceGroups.cxx @@ -74,6 +74,9 @@ static const std::vector<ExpectedParseResult> expectedResults{ { "1,threads:1,", true, { { { "threads", 1, 1 } }, } }, + { "threads:1,threads:1", true, { + { { "threads", 1, 1 }, { "threads", 1, 1 } }, + } }, { "threads:1;;threads:2", true, { { { "threads", 1, 1 } }, { { "threads", 2, 1 } }, @@ -106,24 +109,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/CMakeLib/testCTestHardwareSpec.cxx b/Tests/CMakeLib/testCTestResourceSpec.cxx index 3e3eccc..b69003d 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec.cxx +++ b/Tests/CMakeLib/testCTestResourceSpec.cxx @@ -2,16 +2,16 @@ #include <string> #include <vector> -#include "cmCTestHardwareSpec.h" +#include "cmCTestResourceSpec.h" struct ExpectedSpec { std::string Path; bool ParseResult; - cmCTestHardwareSpec Expected; + cmCTestResourceSpec Expected; }; -static const std::vector<ExpectedSpec> expectedHardwareSpecs = { +static const std::vector<ExpectedSpec> expectedResourceSpecs = { /* clang-format off */ {"spec1.json", true, {{{ {"gpus", { @@ -39,14 +39,32 @@ static const std::vector<ExpectedSpec> expectedHardwareSpecs = { {"spec16.json", true, {{{}}}}, {"spec17.json", false, {{{}}}}, {"spec18.json", false, {{{}}}}, + {"spec19.json", false, {{{}}}}, + {"spec20.json", true, {{{}}}}, + {"spec21.json", false, {{{}}}}, + {"spec22.json", false, {{{}}}}, + {"spec23.json", false, {{{}}}}, + {"spec24.json", false, {{{}}}}, + {"spec25.json", false, {{{}}}}, + {"spec26.json", false, {{{}}}}, + {"spec27.json", false, {{{}}}}, + {"spec28.json", false, {{{}}}}, + {"spec29.json", false, {{{}}}}, + {"spec30.json", false, {{{}}}}, + {"spec31.json", false, {{{}}}}, + {"spec32.json", false, {{{}}}}, + {"spec33.json", false, {{{}}}}, + {"spec34.json", false, {{{}}}}, + {"spec35.json", false, {{{}}}}, + {"spec36.json", false, {{{}}}}, {"noexist.json", false, {{{}}}}, /* clang-format on */ }; static bool testSpec(const std::string& path, bool expectedResult, - const cmCTestHardwareSpec& expected) + const cmCTestResourceSpec& expected) { - cmCTestHardwareSpec actual; + cmCTestResourceSpec actual; bool result = actual.ReadFromJSONFile(path); if (result != expectedResult) { std::cout << "ReadFromJSONFile(\"" << path << "\") returned " << result @@ -63,7 +81,7 @@ static bool testSpec(const std::string& path, bool expectedResult, return true; } -int testCTestHardwareSpec(int argc, char** const argv) +int testCTestResourceSpec(int argc, char** const argv) { if (argc < 2) { std::cout << "Invalid arguments.\n"; @@ -71,9 +89,9 @@ int testCTestHardwareSpec(int argc, char** const argv) } int retval = 0; - for (auto const& spec : expectedHardwareSpecs) { + for (auto const& spec : expectedResourceSpecs) { std::string path = argv[1]; - path += "/testCTestHardwareSpec_data/"; + path += "/testCTestResourceSpec_data/"; path += spec.Path; if (!testSpec(path, spec.ParseResult, spec.Expected)) { retval = -1; diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec1.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec1.json index ee3d0ce..b01aa6b 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec1.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec1.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec10.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec10.json index 22105d7..8764907 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec10.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec10.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec11.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec11.json index 1e37ef5..7551ea2 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec11.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec11.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec12.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec12.json index fe51488..fe51488 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec12.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec12.json diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec13.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec13.json index 6b7a9f4..6b7a9f4 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec13.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec13.json diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec14.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec14.json index ce708c7..83f480c 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec14.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec14.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "0": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec15.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec15.json index 78b6990..10fe2e3 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec15.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec15.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "-": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec16.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec16.json index 95c7d26..8546759 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec16.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec16.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "A": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec17.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec17.json index 1b6ab4b..e4cdfc9 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec17.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec17.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec18.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec18.json index 1a17df7..26a7c70 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec18.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec18.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec6.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec19.json index 93c790d..3067f0c 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec6.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec19.json @@ -1,5 +1,5 @@ { + "version": 1, "local": [ - [] ] } diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec2.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec2.json new file mode 100644 index 0000000..df49390 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec2.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec20.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec20.json new file mode 100644 index 0000000..df49390 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec20.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec21.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec21.json new file mode 100644 index 0000000..7459ff2 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec21.json @@ -0,0 +1,5 @@ +{ + "version": [1, 0], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec22.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec22.json new file mode 100644 index 0000000..23c57d8 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec22.json @@ -0,0 +1,5 @@ +{ + "version": 2, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec23.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec23.json new file mode 100644 index 0000000..a3d0a27 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec23.json @@ -0,0 +1,7 @@ +{ + "version": { + "major": 1 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec24.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec24.json new file mode 100644 index 0000000..d5f6b08 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec24.json @@ -0,0 +1,7 @@ +{ + "version": { + "minor": 0 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec25.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec25.json new file mode 100644 index 0000000..914da4b --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec25.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 1, + "minor": 1 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec26.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec26.json new file mode 100644 index 0000000..c06de22 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec26.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 2, + "minor": 0 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec27.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec27.json new file mode 100644 index 0000000..9e2b6c3 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec27.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": "1", + "minor": 0 + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec28.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec28.json new file mode 100644 index 0000000..ce3b76a --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec28.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 1, + "minor": "0" + }, + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec29.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec29.json new file mode 100644 index 0000000..58afd2b --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec29.json @@ -0,0 +1,5 @@ +{ + "version": [1, 0, 0], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec3.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec3.json new file mode 100644 index 0000000..2f1045f --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec3.json @@ -0,0 +1,12 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": [ + { + }, + { + } + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec30.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec30.json new file mode 100644 index 0000000..9e13ff0 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec30.json @@ -0,0 +1,5 @@ +{ + "version": [1], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec31.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec31.json new file mode 100644 index 0000000..c0ef7f4 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec31.json @@ -0,0 +1,5 @@ +{ + "version": [1, 1], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec32.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec32.json new file mode 100644 index 0000000..abe977e --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec32.json @@ -0,0 +1,5 @@ +{ + "version": [2, 0], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec33.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec33.json new file mode 100644 index 0000000..c6ca749 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec33.json @@ -0,0 +1,5 @@ +{ + "version": ["1", 0], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec34.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec34.json new file mode 100644 index 0000000..be258f1 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec34.json @@ -0,0 +1,5 @@ +{ + "version": [1, "0"], + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec35.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec35.json new file mode 100644 index 0000000..137648c --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec35.json @@ -0,0 +1,5 @@ +{ + "version": "1", + "local": [ + ] +} diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec2.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec36.json index 6175b1a..6175b1a 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec2.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec36.json diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec4.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec4.json new file mode 100644 index 0000000..17349bd --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec4.json @@ -0,0 +1,8 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": { + } +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec5.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec5.json new file mode 100644 index 0000000..f6e6cb4 --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec5.json @@ -0,0 +1,6 @@ +{ + "version": { + "major": 1, + "minor": 0 + } +} diff --git a/Tests/CMakeLib/testCTestResourceSpec_data/spec6.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec6.json new file mode 100644 index 0000000..eb8b14c --- /dev/null +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec6.json @@ -0,0 +1,9 @@ +{ + "version": { + "major": 1, + "minor": 0 + }, + "local": [ + [] + ] +} diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec7.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec7.json index 28b6a4f..0447981 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec7.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec7.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": { diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec8.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec8.json index 79bd224..ee7a9c2 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec8.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec8.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testCTestHardwareSpec_data/spec9.json b/Tests/CMakeLib/testCTestResourceSpec_data/spec9.json index 6bb1def..ae1117b 100644 --- a/Tests/CMakeLib/testCTestHardwareSpec_data/spec9.json +++ b/Tests/CMakeLib/testCTestResourceSpec_data/spec9.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "gpus": [ diff --git a/Tests/CMakeLib/testOptional.cxx b/Tests/CMakeLib/testOptional.cxx index 3050332..c6bc9c2 100644 --- a/Tests/CMakeLib/testOptional.cxx +++ b/Tests/CMakeLib/testOptional.cxx @@ -240,7 +240,7 @@ static bool testMoveConstruct(std::vector<Event>& expected) expected = { { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, - { Event::MOVE_CONSTRUCT, &*o2, &o1.value(), 4 }, + { Event::MOVE_CONSTRUCT, &*o2, &*o1, 4 }, { Event::DESTRUCT, &*o2, nullptr, 4 }, { Event::DESTRUCT, &*o1, nullptr, 4 }, }; @@ -250,13 +250,14 @@ static bool testMoveConstruct(std::vector<Event>& expected) static bool testNulloptAssign(std::vector<Event>& expected) { cm::optional<EventLogger> o1{ 4 }; + auto const* v1 = &*o1; o1 = cm::nullopt; cm::optional<EventLogger> o2{}; o2 = cm::nullopt; expected = { - { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, - { Event::DESTRUCT, &*o1, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v1, nullptr, 4 }, + { Event::DESTRUCT, v1, nullptr, 4 }, }; return true; } @@ -265,8 +266,11 @@ static bool testCopyAssign(std::vector<Event>& expected) { cm::optional<EventLogger> o1{}; const cm::optional<EventLogger> o2{ 4 }; + auto const* v2 = &*o2; o1 = o2; + auto const* v1 = &*o1; const cm::optional<EventLogger> o3{ 5 }; + auto const* v3 = &*o3; o1 = o3; const cm::optional<EventLogger> o4{}; o1 = o4; @@ -274,13 +278,13 @@ static bool testCopyAssign(std::vector<Event>& expected) // an empty optional expected = { - { Event::VALUE_CONSTRUCT, &*o2, nullptr, 4 }, - { Event::COPY_CONSTRUCT, &*o1, &*o2, 4 }, - { Event::VALUE_CONSTRUCT, &*o3, nullptr, 5 }, - { Event::COPY_ASSIGN, &*o1, &*o3, 5 }, - { Event::DESTRUCT, &*o1, nullptr, 5 }, - { Event::DESTRUCT, &o3.value(), nullptr, 5 }, - { Event::DESTRUCT, &o2.value(), nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v2, nullptr, 4 }, + { Event::COPY_CONSTRUCT, v1, v2, 4 }, + { Event::VALUE_CONSTRUCT, v3, nullptr, 5 }, + { Event::COPY_ASSIGN, v1, v3, 5 }, + { Event::DESTRUCT, v1, nullptr, 5 }, + { Event::DESTRUCT, v3, nullptr, 5 }, + { Event::DESTRUCT, v2, nullptr, 4 }, }; return true; } @@ -289,20 +293,23 @@ static bool testMoveAssign(std::vector<Event>& expected) { cm::optional<EventLogger> o1{}; cm::optional<EventLogger> o2{ 4 }; + auto const* v2 = &*o2; o1 = std::move(o2); + auto const* v1 = &*o1; cm::optional<EventLogger> o3{ 5 }; + auto const* v3 = &*o3; o1 = std::move(o3); cm::optional<EventLogger> o4{}; o1 = std::move(o4); expected = { - { Event::VALUE_CONSTRUCT, &*o2, nullptr, 4 }, - { Event::MOVE_CONSTRUCT, &*o1, &*o2, 4 }, - { Event::VALUE_CONSTRUCT, &*o3, nullptr, 5 }, - { Event::MOVE_ASSIGN, &*o1, &*o3, 5 }, - { Event::DESTRUCT, &*o1, nullptr, 5 }, - { Event::DESTRUCT, &*o3, nullptr, 5 }, - { Event::DESTRUCT, &*o2, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v2, nullptr, 4 }, + { Event::MOVE_CONSTRUCT, v1, v2, 4 }, + { Event::VALUE_CONSTRUCT, v3, nullptr, 5 }, + { Event::MOVE_ASSIGN, v1, v3, 5 }, + { Event::DESTRUCT, v1, nullptr, 5 }, + { Event::DESTRUCT, v3, nullptr, 5 }, + { Event::DESTRUCT, v2, nullptr, 4 }, }; return true; } @@ -333,7 +340,9 @@ static bool testPointer(std::vector<Event>& expected) static bool testDereference(std::vector<Event>& expected) { cm::optional<EventLogger> o1{ 4 }; + auto const* v1 = &*o1; const cm::optional<EventLogger> o2{ 5 }; + auto const* v2 = &*o2; (*o1).Reference(); (*o2).Reference(); @@ -343,16 +352,16 @@ static bool testDereference(std::vector<Event>& expected) #endif expected = { - { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, - { Event::VALUE_CONSTRUCT, &*o2, nullptr, 5 }, - { Event::REFERENCE, &*o1, nullptr, 4 }, - { Event::CONST_REFERENCE, &*o2, nullptr, 5 }, - { Event::RVALUE_REFERENCE, &*o1, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v1, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v2, nullptr, 5 }, + { Event::REFERENCE, v1, nullptr, 4 }, + { Event::CONST_REFERENCE, v2, nullptr, 5 }, + { Event::RVALUE_REFERENCE, v1, nullptr, 4 }, #ifdef ALLOW_CONST_RVALUE - { Event::CONST_RVALUE_REFERENCE, &*o2, nullptr, 5 }, + { Event::CONST_RVALUE_REFERENCE, v2, nullptr, 5 }, #endif - { Event::DESTRUCT, &*o2, nullptr, 5 }, - { Event::DESTRUCT, &*o1, nullptr, 4 }, + { Event::DESTRUCT, v2, nullptr, 5 }, + { Event::DESTRUCT, v1, nullptr, 4 }, }; return true; } @@ -479,9 +488,11 @@ static bool testSwap(std::vector<Event>& expected) bool retval = true; cm::optional<EventLogger> o1{ 4 }; + auto const* v1 = &*o1; cm::optional<EventLogger> o2{}; o1.swap(o2); + auto const* v2 = &*o2; if (o1.has_value()) { std::cout << "o1 should not have value" << std::endl; @@ -545,15 +556,15 @@ static bool testSwap(std::vector<Event>& expected) } expected = { - { Event::VALUE_CONSTRUCT, &*o1, nullptr, 4 }, - { Event::MOVE_CONSTRUCT, &*o2, &*o1, 4 }, - { Event::DESTRUCT, &*o1, nullptr, 4 }, - { Event::MOVE_CONSTRUCT, &*o1, &*o2, 4 }, - { Event::DESTRUCT, &*o2, nullptr, 4 }, - { Event::VALUE_CONSTRUCT, &*o2, nullptr, 5 }, - { Event::SWAP, &*o1, &*o2, 5 }, - { Event::DESTRUCT, &*o1, nullptr, 5 }, - { Event::DESTRUCT, &*o2, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v1, nullptr, 4 }, + { Event::MOVE_CONSTRUCT, v2, v1, 4 }, + { Event::DESTRUCT, v1, nullptr, 4 }, + { Event::MOVE_CONSTRUCT, v1, v2, 4 }, + { Event::DESTRUCT, v2, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v2, nullptr, 5 }, + { Event::SWAP, v1, v2, 5 }, + { Event::DESTRUCT, v1, nullptr, 5 }, + { Event::DESTRUCT, v2, nullptr, 4 }, }; return retval; } @@ -563,6 +574,7 @@ static bool testReset(std::vector<Event>& expected) bool retval = true; cm::optional<EventLogger> o{ 4 }; + auto const* v = &*o; o.reset(); @@ -574,8 +586,8 @@ static bool testReset(std::vector<Event>& expected) o.reset(); expected = { - { Event::VALUE_CONSTRUCT, &*o, nullptr, 4 }, - { Event::DESTRUCT, &*o, nullptr, 4 }, + { Event::VALUE_CONSTRUCT, v, nullptr, 4 }, + { Event::DESTRUCT, v, nullptr, 4 }, }; return retval; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 185401f..0d9e43f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1405,6 +1405,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH ICU JPEG JsonCpp + LibArchive LibLZMA LibRHash Libinput @@ -2331,92 +2332,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest") - ADD_TEST_MACRO(ObjC++ ObjC++) - - add_test(Objective-C.simple-build-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C/simple-build-test" - "${CMake_BINARY_DIR}/Tests/Objective-C/simple-build-test" - --build-two-config - ${build_generator_args} - --build-project simple-build-test - --build-options ${build_options} - --test-command simple-build-test - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/simple-build-test") - - add_test(Objective-C.c-file-extension-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C/c-file-extension-test" - "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test" - --build-two-config - ${build_generator_args} - --build-project c-file-extension-test - --build-options ${build_options} - --test-command c-file-extension-test - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test") - - add_test(Objective-C.cxx-file-extension-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C/cxx-file-extension-test" - "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test" - --build-two-config - ${build_generator_args} - --build-project cxx-file-extension-test - --build-options ${build_options} - --test-command cxx-file-extension-test - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test") - - add_test(Objective-C.objc-file-extension-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C/objc-file-extension-test" - "${CMake_BINARY_DIR}/Tests/Objective-C/objc-file-extension-test" - --build-two-config - ${build_generator_args} - --build-project objc-file-extension-test - --build-options ${build_options} - --test-command objc-file-extension-test - ) - list(APPEND TEST_BUILD_DIRS "${CMAKE_BINARY_DIR}/Tests/Objective-C/objc-file-extension-test") - - add_test(Objective-CXX.simple-build-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C++/simple-build-test" - "${CMake_BINARY_DIR}/Tests/Objective-C++/simple-build-test" - --build-two-config - ${build_generator_args} - --build-project simple-build-test - --build-options ${build_options} - --test-command simple-build-test - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C++/simple-build-test") - - add_test(Objective-CXX.cxx-file-extension-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C++/cxx-file-extension-test" - "${CMake_BINARY_DIR}/Tests/Objective-C++/cxx-file-extension-test" - --build-two-config - ${build_generator_args} - --build-project cxx-file-extension-test - --build-options ${build_options} - --test-command cxx-file-extension-test - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C++/cxx-file-extension-test") - - add_test(Objective-CXX.objcxx-file-extension-test ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Objective-C++/objcxx-file-extension-test" - "${CMake_BINARY_DIR}/Tests/Objective-C++/objcxx-file-extension-test" - --build-two-config - ${build_generator_args} - --build-project objcxx-file-extension-test - --build-options ${build_options} - --test-command objcxx-file-extension-test - ) - list(APPEND TEST_BUILD_DIRS "${CMAKE_BINARY_DIR}/Tests/Objective-C++/objcxx-file-extension-test") - + add_subdirectory(ObjC) + add_subdirectory(ObjCXX) endif () endif () diff --git a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake index 9632664..a79bfcb 100644 --- a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake +++ b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake @@ -21,11 +21,11 @@ set(N 7) # First setup source and binary trees: # -execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory +execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ${dir}/Source ) -execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory +execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ${dir}/Build ) @@ -69,7 +69,7 @@ foreach(i RANGE 1 ${N}) # Save this iteration of the Build directory: # - execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory + execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ${dir}/b${i} ) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt index bc5b6a9..4363f1b 100644 --- a/Tests/CPackComponentsDEB/CMakeLists.txt +++ b/Tests/CPackComponentsDEB/CMakeLists.txt @@ -104,7 +104,7 @@ install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest COMPONENT applications) if(EXISTS "./dirtest") - execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest) + execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ./dirtest) endif() # NOTE: directory left empty on purpose execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 2e41754..9fd85be 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -324,7 +324,7 @@ if (WIN32) ${file} "[${hkey}]" DOC "Registry_Test_Path") exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") + exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"") endif () endif () diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index 64f6dc8..df874ef 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -131,7 +131,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) # Custom target to try preprocessing invocation. add_custom_target(test_preprocess ${MAYBE_ALL} - COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i + COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/create_file.dir/create_file.i COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 628cd4e..28b73af 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -281,7 +281,7 @@ if (WIN32) ${file} "[${hkey}]" DOC "Registry_Test_Path") exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"") - exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"") + exec_program(${CMAKE_COMMAND} ARGS "-E rm -f \"${dir}/${file}\"") endif () endif () diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index 64f6dc8..df874ef 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -131,7 +131,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) # Custom target to try preprocessing invocation. add_custom_target(test_preprocess ${MAYBE_ALL} - COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/create_file.dir/create_file.i + COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/create_file.dir/create_file.i COMMAND ${CMAKE_MAKE_PROGRAM} create_file.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index e9a9f52..e4b50d0 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -70,7 +70,7 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc1.h APPEND COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc1temp.h ${PROJECT_BINARY_DIR}/doc1.h COMMAND ${CMAKE_COMMAND} -E echo " Removing doc1temp.h." - COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/doc1temp.h + COMMAND ${CMAKE_COMMAND} -E rm -f ${PROJECT_BINARY_DIR}/doc1temp.h ) # Add custom command to generate foo.h. @@ -412,7 +412,7 @@ add_custom_target(do_check_command_line ALL add_dependencies(do_check_command_line check_command_line) add_custom_target(pre_check_command_line - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt + COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt ) add_dependencies(do_check_command_line pre_check_command_line) diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index dc621eb..d88eb11 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -7,7 +7,7 @@ endif() # Wipe out the install tree to make sure the exporter works. add_custom_command( OUTPUT ${ExportImport_BINARY_DIR}/CleanupProject - COMMAND ${CMAKE_COMMAND} -E remove_directory ${ExportImport_BINARY_DIR}/Root + COMMAND ${CMAKE_COMMAND} -E rm -rf ${ExportImport_BINARY_DIR}/Root ) add_custom_target(CleanupTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/CleanupProject) set_property( diff --git a/Tests/ExportImport/Import/Interface/pch_iface_test.cpp b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp index a460d0d..a18bbde 100644 --- a/Tests/ExportImport/Import/Interface/pch_iface_test.cpp +++ b/Tests/ExportImport/Import/Interface/pch_iface_test.cpp @@ -3,7 +3,7 @@ # ifndef PCH_PCH_H_INCLUDED # error "Expected PCH_PCH_H_INCLUDED." # endif -#elif defined(__PGIC__) || defined(__ibmxl__) +#elif defined(__PGIC__) || defined(__ibmxl__) || defined(_CRAYC) // No PCH expected but these compilers define macros below. #elif defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER) || \ defined(_MSC_VER) diff --git a/Tests/FindLibArchive/CMakeLists.txt b/Tests/FindLibArchive/CMakeLists.txt new file mode 100644 index 0000000..f532ef2 --- /dev/null +++ b/Tests/FindLibArchive/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLibArchive.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLibArchive/Test" + "${CMake_BINARY_DIR}/Tests/FindLibArchive/Test" + ${build_generator_args} + --build-project TestFindLibArchive + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLibArchive/Test/CMakeLists.txt b/Tests/FindLibArchive/Test/CMakeLists.txt new file mode 100644 index 0000000..35843bb --- /dev/null +++ b/Tests/FindLibArchive/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.12) +project(TestFindLibArchive C) +include(CTest) + +find_package(LibArchive REQUIRED) + +add_executable(test_libarchive_tgt main.c) +target_link_libraries(test_libarchive_tgt LibArchive::LibArchive) +add_test(NAME test_libarchive_tgt COMMAND test_libarchive_tgt) + +add_executable(test_libarchive_var main.c) +target_include_directories(test_libarchive_var PRIVATE ${LibArchive_INCLUDE_DIRS}) +target_link_libraries(test_libarchive_var PRIVATE ${LibArchive_LIBRARIES}) +add_test(NAME test_libarchive_var COMMAND test_libarchive_var) diff --git a/Tests/FindLibArchive/Test/main.c b/Tests/FindLibArchive/Test/main.c new file mode 100644 index 0000000..03e7ece --- /dev/null +++ b/Tests/FindLibArchive/Test/main.c @@ -0,0 +1,7 @@ +#include <archive.h> + +int main(void) +{ + archive_read_free(archive_read_new()); + return 0; +} diff --git a/Tests/FortranOnly/CMakeLists.txt b/Tests/FortranOnly/CMakeLists.txt index de887fa..d945375 100644 --- a/Tests/FortranOnly/CMakeLists.txt +++ b/Tests/FortranOnly/CMakeLists.txt @@ -103,11 +103,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND CMAKE_MAKE_PROGRAM) # Custom target to try preprocessing invocation. add_custom_target(test_preprocess ${MAYBE_ALL} - COMMAND ${CMAKE_COMMAND} -E remove CMakeFiles/preprocess.dir/preprocess.F.i + COMMAND ${CMAKE_COMMAND} -E rm -f CMakeFiles/preprocess.dir/preprocess.F.i COMMAND ${CMAKE_MAKE_PROGRAM} preprocess.i COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/test_preprocess.cmake # Remove bogus file some compilers leave behind. - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.s + COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_CURRENT_SOURCE_DIR}/preprocess.s WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) endif() diff --git a/Tests/JavaExportImport/CMakeLists.txt b/Tests/JavaExportImport/CMakeLists.txt index c70704a..7a2d020 100644 --- a/Tests/JavaExportImport/CMakeLists.txt +++ b/Tests/JavaExportImport/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(Java COMPONENTS Development) # Wipe out the install tree to make sure the exporter works. add_custom_command( OUTPUT ${JavaExportImport_BINARY_DIR}/CleanupProject - COMMAND ${CMAKE_COMMAND} -E remove_directory ${JavaExportImport_BINARY_DIR}/Root + COMMAND ${CMAKE_COMMAND} -E rm -rf ${JavaExportImport_BINARY_DIR}/Root ) add_custom_target(CleanupTarget ALL DEPENDS ${JavaExportImport_BINARY_DIR}/CleanupProject) set_property( diff --git a/Tests/LinkDirectory/CMakeLists.txt b/Tests/LinkDirectory/CMakeLists.txt index c60de84..c7a2700 100644 --- a/Tests/LinkDirectory/CMakeLists.txt +++ b/Tests/LinkDirectory/CMakeLists.txt @@ -33,7 +33,7 @@ ExternalProject_Add(ExternalTarget # directly because it does not know the full paths to the libraries. # (The purpose of this test is to check that link_directories works.) ExternalProject_Add_Step(ExternalTarget cleanup - COMMAND ${CMAKE_COMMAND} -E remove_directory ${LinkDirectory_BINARY_DIR}/bin + COMMAND ${CMAKE_COMMAND} -E rm -rf ${LinkDirectory_BINARY_DIR}/bin DEPENDEES download DEPENDERS configure DEPENDS mylibA mylibB diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt index a3c6fd9..9f1bf1a 100644 --- a/Tests/MacRuntimePath/CMakeLists.txt +++ b/Tests/MacRuntimePath/CMakeLists.txt @@ -7,7 +7,7 @@ endif() # Wipe out the install tree to make sure the exporter works. add_custom_command( OUTPUT ${MacRuntimePath_BINARY_DIR}/CleanupProject - COMMAND ${CMAKE_COMMAND} -E remove_directory ${MacRuntimePath_BINARY_DIR}/Root + COMMAND ${CMAKE_COMMAND} -E rm -rf ${MacRuntimePath_BINARY_DIR}/Root ) add_custom_target(CleanupTarget ALL DEPENDS ${MacRuntimePath_BINARY_DIR}/CleanupProject) set_property( diff --git a/Tests/ObjC/CMakeLists.txt b/Tests/ObjC/CMakeLists.txt new file mode 100644 index 0000000..ce3033c --- /dev/null +++ b/Tests/ObjC/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_TEST_MACRO(ObjC.simple-build-test simple-build-test) +ADD_TEST_MACRO(ObjC.c-file-extension-test c-file-extension-test) +ADD_TEST_MACRO(ObjC.cxx-file-extension-test cxx-file-extension-test) +ADD_TEST_MACRO(ObjC.objc-file-extension-test objc-file-extension-test) diff --git a/Tests/Objective-C/c-file-extension-test/CMakeLists.txt b/Tests/ObjC/c-file-extension-test/CMakeLists.txt index e091448..e091448 100644 --- a/Tests/Objective-C/c-file-extension-test/CMakeLists.txt +++ b/Tests/ObjC/c-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/ObjC/c-file-extension-test/main.m index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C/cxx-file-extension-test/main.m +++ b/Tests/ObjC/c-file-extension-test/main.m diff --git a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt index eb065e4..eb065e4 100644 --- a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt +++ b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C/c-file-extension-test/main.m b/Tests/ObjC/cxx-file-extension-test/main.m index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C/c-file-extension-test/main.m +++ b/Tests/ObjC/cxx-file-extension-test/main.m diff --git a/Tests/Objective-C/objc-file-extension-test/CMakeLists.txt b/Tests/ObjC/objc-file-extension-test/CMakeLists.txt index 27e88be..27e88be 100644 --- a/Tests/Objective-C/objc-file-extension-test/CMakeLists.txt +++ b/Tests/ObjC/objc-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C/objc-file-extension-test/main.m b/Tests/ObjC/objc-file-extension-test/main.m index 2ec3917..2ec3917 100644 --- a/Tests/Objective-C/objc-file-extension-test/main.m +++ b/Tests/ObjC/objc-file-extension-test/main.m diff --git a/Tests/Objective-C/simple-build-test/CMakeLists.txt b/Tests/ObjC/simple-build-test/CMakeLists.txt index 5ab46ac..5ab46ac 100644 --- a/Tests/Objective-C/simple-build-test/CMakeLists.txt +++ b/Tests/ObjC/simple-build-test/CMakeLists.txt diff --git a/Tests/Objective-C/simple-build-test/foo.h b/Tests/ObjC/simple-build-test/foo.h index b3fb084..b3fb084 100644 --- a/Tests/Objective-C/simple-build-test/foo.h +++ b/Tests/ObjC/simple-build-test/foo.h diff --git a/Tests/Objective-C/simple-build-test/foo.m b/Tests/ObjC/simple-build-test/foo.m index 2d452a8..2d452a8 100644 --- a/Tests/Objective-C/simple-build-test/foo.m +++ b/Tests/ObjC/simple-build-test/foo.m diff --git a/Tests/Objective-C/simple-build-test/main.m b/Tests/ObjC/simple-build-test/main.m index 970d554..970d554 100644 --- a/Tests/Objective-C/simple-build-test/main.m +++ b/Tests/ObjC/simple-build-test/main.m diff --git a/Tests/ObjCXX/CMakeLists.txt b/Tests/ObjCXX/CMakeLists.txt new file mode 100644 index 0000000..a2a907a --- /dev/null +++ b/Tests/ObjCXX/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_TEST_MACRO(ObjCXX.ObjC++ ObjC++) +ADD_TEST_MACRO(ObjCXX.simple-build-test simple-build-test) +ADD_TEST_MACRO(ObjCXX.cxx-file-extension-test cxx-file-extension-test) +ADD_TEST_MACRO(ObjCXX.objcxx-file-extension-test objcxx-file-extension-test) diff --git a/Tests/ObjC++/CMakeLists.txt b/Tests/ObjCXX/ObjC++/CMakeLists.txt index 8b1563e..5ba5db2 100644 --- a/Tests/ObjC++/CMakeLists.txt +++ b/Tests/ObjCXX/ObjC++/CMakeLists.txt @@ -3,4 +3,3 @@ project (ObjC++) add_executable (ObjC++ objc++.mm) target_link_libraries(ObjC++ "-framework Cocoa") - diff --git a/Tests/ObjC++/objc++.mm b/Tests/ObjCXX/ObjC++/objc++.mm index 258ebaa..258ebaa 100644 --- a/Tests/ObjC++/objc++.mm +++ b/Tests/ObjCXX/ObjC++/objc++.mm diff --git a/Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt b/Tests/ObjCXX/cxx-file-extension-test/CMakeLists.txt index 0b33875..0b33875 100644 --- a/Tests/Objective-C++/cxx-file-extension-test/CMakeLists.txt +++ b/Tests/ObjCXX/cxx-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C++/cxx-file-extension-test/main.mm b/Tests/ObjCXX/cxx-file-extension-test/main.mm index 1c159a9..1c159a9 100644 --- a/Tests/Objective-C++/cxx-file-extension-test/main.mm +++ b/Tests/ObjCXX/cxx-file-extension-test/main.mm diff --git a/Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt b/Tests/ObjCXX/objcxx-file-extension-test/CMakeLists.txt index eda7bba..eda7bba 100644 --- a/Tests/Objective-C++/objcxx-file-extension-test/CMakeLists.txt +++ b/Tests/ObjCXX/objcxx-file-extension-test/CMakeLists.txt diff --git a/Tests/Objective-C++/objcxx-file-extension-test/main.mm b/Tests/ObjCXX/objcxx-file-extension-test/main.mm index d4aa1bb..d4aa1bb 100644 --- a/Tests/Objective-C++/objcxx-file-extension-test/main.mm +++ b/Tests/ObjCXX/objcxx-file-extension-test/main.mm diff --git a/Tests/Objective-C++/simple-build-test/CMakeLists.txt b/Tests/ObjCXX/simple-build-test/CMakeLists.txt index cf27683..cf27683 100644 --- a/Tests/Objective-C++/simple-build-test/CMakeLists.txt +++ b/Tests/ObjCXX/simple-build-test/CMakeLists.txt diff --git a/Tests/Objective-C++/simple-build-test/foo.h b/Tests/ObjCXX/simple-build-test/foo.h index b3fb084..b3fb084 100644 --- a/Tests/Objective-C++/simple-build-test/foo.h +++ b/Tests/ObjCXX/simple-build-test/foo.h diff --git a/Tests/Objective-C++/simple-build-test/foo.mm b/Tests/ObjCXX/simple-build-test/foo.mm index 2d452a8..2d452a8 100644 --- a/Tests/Objective-C++/simple-build-test/foo.mm +++ b/Tests/ObjCXX/simple-build-test/foo.mm diff --git a/Tests/Objective-C++/simple-build-test/main.mm b/Tests/ObjCXX/simple-build-test/main.mm index 7c85551..7c85551 100644 --- a/Tests/Objective-C++/simple-build-test/main.mm +++ b/Tests/ObjCXX/simple-build-test/main.mm diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 4490751..1b3577f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -279,6 +279,7 @@ add_RunCMake_test(include) add_RunCMake_test(include_directories) add_RunCMake_test(include_guard) add_RunCMake_test(list) +add_RunCMake_test(load_cache) add_RunCMake_test(math) add_RunCMake_test(message) add_RunCMake_test(option) @@ -317,6 +318,8 @@ function(add_RunCMake_test_try_compile) CMAKE_CXX_COMPILER_VERSION CMAKE_CXX_STANDARD_DEFAULT CMake_TEST_CUDA + CMAKE_OBJC_STANDARD_DEFAULT + CMAKE_OBJCXX_STANDARD_DEFAULT ) if(DEFINED ${var}) list(APPEND try_compile_ARGS -D${var}=${${var}}) @@ -339,7 +342,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) @@ -347,7 +350,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 @@ -356,25 +359,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) @@ -443,7 +446,7 @@ add_RunCMake_test(target_include_directories) add_RunCMake_test(target_sources) add_RunCMake_test(CheckModules) add_RunCMake_test(CheckIPOSupported) -add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) +add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN}) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b0b7a99..b154c79 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -36,9 +36,6 @@ run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(CPACK_INSTALL_SCRIPTS "singular;plural;both" "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT") run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT") -if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") - run_cpack_test(CPACK_INSTALL_CMAKE_CONFIGURATIONS "ZIP" false "MONOLITHIC") -endif() run_cpack_test_subtests( DEB_DESCRIPTION "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE" diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake deleted file mode 100644 index 34c7f8a..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(EXPECTED_FILES_COUNT "1") - -set(EXPECTED_FILE_CONTENT_1_LIST "foo;foo/debug.txt;foo/release.txt") diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt deleted file mode 100644 index 2a3aa9e..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt +++ /dev/null @@ -1,3 +0,0 @@ -CPack: Install projects -CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Debug\] -CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Release\] diff --git a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake b/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake deleted file mode 100644 index 4f562cf..0000000 --- a/Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set(CMAKE_CONFIGURATION_TYPES Debug Release) - -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" "debug content") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/release.txt" "release content") - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" DESTINATION "foo" CONFIGURATIONS Debug) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/release.txt" DESTINATION "foo" CONFIGURATIONS Release) - -set(CPACK_INSTALL_CMAKE_CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES}) diff --git a/Tests/RunCMake/CPackCommandLine/CMakeLists.txt b/Tests/RunCMake/CPackCommandLine/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt b/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt new file mode 100644 index 0000000..f2ae844 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig-check-stdout.txt @@ -0,0 +1,4 @@ +MultiConfig-0\.1\.1-[^/ +]*/lib/(lib|)foo_dbg\.(a|lib) +MultiConfig-0\.1\.1-[^/ +]*/lib/(lib|)foo_rel\.(a|lib) diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt b/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt new file mode 100644 index 0000000..4fb8181 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig-package-stdout.txt @@ -0,0 +1,8 @@ +^CPack: Create package using ZIP +CPack: Install projects +CPack: - Install project: MultiConfig \[Debug\] +CPack: - Install project: MultiConfig \[Release\] +CPack: Create package +CPack: - package: [^ +]*/Tests/RunCMake/CPackCommandLine/MultiConfig-build/MultiConfig-0.1.1-[^ +]*.zip generated.$ diff --git a/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake b/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake new file mode 100644 index 0000000..71fd189 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/MultiConfig.cmake @@ -0,0 +1,9 @@ +enable_language(C) + +include(CPack) + +add_library(foo foo.c) +set_property(TARGET foo PROPERTY DEBUG_POSTFIX _dbg) +set_property(TARGET foo PROPERTY RELEASE_POSTFIX _rel) + +install(TARGETS foo) diff --git a/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake index 991146c..53f4e4f 100644 --- a/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake @@ -8,3 +8,26 @@ set(CPACK_PACKAGE_VERSION "1") set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(NotAGenerator ${CMAKE_CPACK_COMMAND} -G NotAGenerator) unset(RunCMake_TEST_NO_CLEAN) + +function(run_MultiConfig) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/MultiConfig-build") + run_cmake(MultiConfig) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(MultiConfig-build-dbg ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(MultiConfig-build-rel ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(MultiConfig-package ${CMAKE_CPACK_COMMAND} -G ZIP -C "Debug\;Release") + set(zip_glob "${RunCMake_TEST_BINARY_DIR}/MultiConfig-0.1.1-*.zip") + file(GLOB zips "${zip_glob}") + set(zip_found 0) + foreach(zip IN LISTS zips) + set(zip_found 1) + run_cmake_command(MultiConfig-check ${CMAKE_COMMAND} -E tar tf "${zip}") + endforeach() + if(NOT zip_found) + message(SEND_ERROR "No package file found at\n ${zip_glob}") + endif() +endfunction() + +if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") + run_MultiConfig() +endif() diff --git a/Tests/RunCMake/CPackCommandLine/foo.c b/Tests/RunCMake/CPackCommandLine/foo.c new file mode 100644 index 0000000..c83d856 --- /dev/null +++ b/Tests/RunCMake/CPackCommandLine/foo.c @@ -0,0 +1,4 @@ +int foo(void) +{ + return 0; +} diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index d7f4133..0953504 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -4,14 +4,26 @@ set(RunCMake_TEST_TIMEOUT 60) unset(ENV{CTEST_PARALLEL_LEVEL}) unset(ENV{CTEST_OUTPUT_ON_FAILURE}) -run_cmake_command(repeat-until-pass-bad1 - ${CMAKE_CTEST_COMMAND} --repeat-until-pass +run_cmake_command(repeat-opt-bad1 + ${CMAKE_CTEST_COMMAND} --repeat until-pass ) -run_cmake_command(repeat-until-pass-bad2 - ${CMAKE_CTEST_COMMAND} --repeat-until-pass foo +run_cmake_command(repeat-opt-bad2 + ${CMAKE_CTEST_COMMAND} --repeat until-pass:foo ) -run_cmake_command(repeat-until-pass-good - ${CMAKE_CTEST_COMMAND} --repeat-until-pass 2 +run_cmake_command(repeat-opt-bad3 + ${CMAKE_CTEST_COMMAND} --repeat until-fail:2 --repeat-until-fail 2 + ) +run_cmake_command(repeat-opt-bad4 + ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 --repeat until-fail:2 + ) +run_cmake_command(repeat-opt-until-pass + ${CMAKE_CTEST_COMMAND} --repeat until-pass:2 + ) +run_cmake_command(repeat-opt-until-fail + ${CMAKE_CTEST_COMMAND} --repeat until-fail:2 + ) +run_cmake_command(repeat-opt-after-timeout + ${CMAKE_CTEST_COMMAND} --repeat after-timeout:2 ) run_cmake_command(repeat-until-fail-bad1 @@ -24,33 +36,13 @@ run_cmake_command(repeat-until-fail-good ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 ) -run_cmake_command(repeat-after-timeout-bad1 - ${CMAKE_CTEST_COMMAND} --repeat-after-timeout - ) -run_cmake_command(repeat-after-timeout-bad2 - ${CMAKE_CTEST_COMMAND} --repeat-after-timeout foo - ) -run_cmake_command(repeat-after-timeout-good - ${CMAKE_CTEST_COMMAND} --repeat-after-timeout 2 - ) - -run_cmake_command(repeat-until-pass-and-fail - ${CMAKE_CTEST_COMMAND} --repeat-until-pass 2 --repeat-until-fail 2 - ) -run_cmake_command(repeat-until-fail-and-pass - ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 --repeat-until-pass 2 - ) -run_cmake_command(repeat-until-fail-and-timeout - ${CMAKE_CTEST_COMMAND} --repeat-until-fail 2 --repeat-after-timeout 2 - ) - function(run_repeat_until_pass_tests) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/repeat-until-pass-build) run_cmake(repeat-until-pass-cmake) set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(repeat-until-pass-ctest - ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-pass 3 + ${CMAKE_CTEST_COMMAND} -C Debug --repeat until-pass:3 ) endfunction() run_repeat_until_pass_tests() @@ -61,7 +53,7 @@ function(run_repeat_after_timeout_tests) run_cmake(repeat-after-timeout-cmake) set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(repeat-after-timeout-ctest - ${CMAKE_CTEST_COMMAND} -C Debug --repeat-after-timeout 3 + ${CMAKE_CTEST_COMMAND} -C Debug --repeat after-timeout:3 ) endfunction() run_repeat_after_timeout_tests() @@ -72,10 +64,11 @@ function(run_repeat_until_fail_tests) run_cmake(repeat-until-fail-cmake) set(RunCMake_TEST_NO_CLEAN 1) run_cmake_command(repeat-until-fail-ctest - ${CMAKE_CTEST_COMMAND} -C Debug --repeat-until-fail 3 + ${CMAKE_CTEST_COMMAND} -C Debug ${ARGN} ) endfunction() -run_repeat_until_fail_tests() +run_repeat_until_fail_tests(--repeat-until-fail 3) +run_repeat_until_fail_tests(--repeat until-fail:3) function(run_BadCTestTestfile) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BadCTestTestfile) @@ -307,7 +300,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/repeat-after-timeout-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-stderr.txt deleted file mode 100644 index aea92b8..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: '--repeat-after-timeout' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt deleted file mode 100644 index c5db55b..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: '--repeat-after-timeout' given non-integer value 'foo'$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-after-timeout-stderr.txt index a7c4b11..a7c4b11 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-good-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-after-timeout-stderr.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nowidgets-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nowidgets-result.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad1-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-opt-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad1-stderr.txt new file mode 100644 index 0000000..f6f3241 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad1-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat' given invalid value 'until-pass'$ diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nores-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nores-result.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad2-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-opt-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad2-stderr.txt new file mode 100644 index 0000000..2f9f32a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad2-stderr.txt @@ -0,0 +1 @@ +^CMake Error: '--repeat' given invalid value 'until-pass:foo'$ diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nocount-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad3-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-nocount-result.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad3-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-opt-bad3-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad3-stderr.txt new file mode 100644 index 0000000..de4e11b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad3-stderr.txt @@ -0,0 +1 @@ +^CMake Error: At most one '--repeat' option may be used\.$ diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets7-result.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad4-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets7-result.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad4-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-opt-bad4-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad4-stderr.txt new file mode 100644 index 0000000..de4e11b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-bad4-stderr.txt @@ -0,0 +1 @@ +^CMake Error: At most one '--repeat' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-good-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-until-fail-stderr.txt index a7c4b11..a7c4b11 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-good-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-until-fail-stderr.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-opt-until-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-opt-until-pass-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/repeat-opt-until-pass-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt deleted file mode 100644 index 15ee3a9..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt deleted file mode 100644 index 15ee3a9..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt deleted file mode 100644 index 15ee3a9..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: At most one '--repeat-\*' option may be used\.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt deleted file mode 100644 index c6afb1d..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: '--repeat-until-pass' requires an argument$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt deleted file mode 100644 index cc3aed5..0000000 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -^CMake Error: '--repeat-until-pass' given non-integer value 'foo'$ 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 deleted file mode 100644 index 3893d40..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/HardwareCommon.cmake +++ /dev/null @@ -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 PROCESSES "${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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake deleted file mode 100644 index d666922..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/RunCMakeTest.cmake +++ /dev/null @@ -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_PROCESS_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_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" - ) -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 - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-nocount "widgets:8") -run_cthwalloc_write_proc(cthwalloc-write-proc-badcount "widgets:8" - CTEST_PROCESS_COUNT=2 - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-nores "widgets:8" - CTEST_PROCESS_COUNT=1 - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-badres "widgets:8" - CTEST_PROCESS_COUNT=1 - CTEST_PROCESS_0=widgets,transmogrifiers - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-nowidgets "widgets:8" - CTEST_PROCESS_COUNT=1 - CTEST_PROCESS_0=widgets - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets1 "widgets:8" - CTEST_PROCESS_COUNT=1 - CTEST_PROCESS_0=widgets - CTEST_PROCESS_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" - ) -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 - ) -run_cthwalloc_write_proc(cthwalloc-write-proc-badwidgets4 "widgets:8" - CTEST_PROCESS_COUNT=1 - CTEST_PROCESS_0=widgets - CTEST_PROCESS_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" - ) -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" - ) -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 - ) - -run_cthwalloc_write_noproc(cthwalloc-write-noproc-good1) -run_cthwalloc_write_noproc(cthwalloc-write-noproc-count - CTEST_PROCESS_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_PROCESS_COUNT} 2) -run_ctest_hardware(process_count 1 0) -unset(ENV{CTEST_PROCESS_COUNT}) diff --git a/Tests/RunCMake/CTestHardwareAllocation/checkfree1-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/checkfree1-ctest-s-hw-check.cmake deleted file mode 100644 index 94b1fa7..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/checkfree1-ctest-s-hw-check.cmake +++ /dev/null @@ -1 +0,0 @@ -verify_ctest_hardware() diff --git a/Tests/RunCMake/CTestHardwareAllocation/checkfree1.cmake b/Tests/RunCMake/CTestHardwareAllocation/checkfree1.cmake deleted file mode 100644 index 0e997b5..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/checkfree1.cmake +++ /dev/null @@ -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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/checkfree2-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/checkfree2-ctest-s-hw-check.cmake deleted file mode 100644 index 94b1fa7..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/checkfree2-ctest-s-hw-check.cmake +++ /dev/null @@ -1 +0,0 @@ -verify_ctest_hardware() diff --git a/Tests/RunCMake/CTestHardwareAllocation/checkfree2.cmake b/Tests/RunCMake/CTestHardwareAllocation/checkfree2.cmake deleted file mode 100644 index 3c2b666..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/checkfree2.cmake +++ /dev/null @@ -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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good2-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good2-check.cmake deleted file mode 100644 index ca0c6b8..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good2-check.cmake +++ /dev/null @@ -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 -]]) diff --git a/Tests/RunCMake/CTestHardwareAllocation/lotsoftests-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/lotsoftests-ctest-s-hw-check.cmake deleted file mode 100644 index 94b1fa7..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/lotsoftests-ctest-s-hw-check.cmake +++ /dev/null @@ -1 +0,0 @@ -verify_ctest_hardware() diff --git a/Tests/RunCMake/CTestHardwareAllocation/lotsoftests.cmake b/Tests/RunCMake/CTestHardwareAllocation/lotsoftests.cmake deleted file mode 100644 index c684434..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/lotsoftests.cmake +++ /dev/null @@ -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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-check.cmake deleted file mode 100644 index 9c730be..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-check.cmake +++ /dev/null @@ -1,3 +0,0 @@ -if(EXISTS "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log") - set(RunCMake_TEST_FAILED "cthwalloc.log should not exist") -endif() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-stderr.txt b/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-stderr.txt deleted file mode 100644 index d465cd3..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^Insufficient hardware -CMake Error at [^ -]*/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw/test\.cmake:[0-9]+ \(message\): - Tests did not pass$ diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough1.cmake b/Tests/RunCMake/CTestHardwareAllocation/notenough1.cmake deleted file mode 100644 index 3e1f620..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough1.cmake +++ /dev/null @@ -1,5 +0,0 @@ -setup_hardware_tests() - -add_hardware_test(Test1 1 "fluxcapacitors:200") - -cleanup_hardware_tests() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-check.cmake deleted file mode 100644 index 9c730be..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-check.cmake +++ /dev/null @@ -1,3 +0,0 @@ -if(EXISTS "${RunCMake_TEST_BINARY_DIR}/cthwalloc.log") - set(RunCMake_TEST_FAILED "cthwalloc.log should not exist") -endif() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-stderr.txt b/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-stderr.txt deleted file mode 100644 index 912f0fb..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^Insufficient hardware -CMake Error at [^ -]*/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw/test\.cmake:[0-9]+ \(message\): - Tests did not pass$ diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough2.cmake b/Tests/RunCMake/CTestHardwareAllocation/notenough2.cmake deleted file mode 100644 index 8205c95..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough2.cmake +++ /dev/null @@ -1,5 +0,0 @@ -setup_hardware_tests() - -add_hardware_test(Test1 1 "terminators:2") - -cleanup_hardware_tests() diff --git a/Tests/RunCMake/CTestHardwareAllocation/process_count-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestHardwareAllocation/process_count-ctest-s-hw-check.cmake deleted file mode 100644 index 94b1fa7..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/process_count-ctest-s-hw-check.cmake +++ /dev/null @@ -1 +0,0 @@ -verify_ctest_hardware() diff --git a/Tests/RunCMake/CTestHardwareAllocation/process_count.cmake b/Tests/RunCMake/CTestHardwareAllocation/process_count.cmake deleted file mode 100644 index c969648..0000000 --- a/Tests/RunCMake/CTestHardwareAllocation/process_count.cmake +++ /dev/null @@ -1,5 +0,0 @@ -setup_hardware_tests() - -add_hardware_test(Test1 1 "widgets:1") - -cleanup_hardware_tests() diff --git a/Tests/RunCMake/CTestHardwareAllocation/CMakeLists.txt.in b/Tests/RunCMake/CTestResourceAllocation/CMakeLists.txt.in index d6cff63..9984421 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/CMakeLists.txt.in +++ b/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() diff --git a/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake b/Tests/RunCMake/CTestResourceAllocation/ResourceCommon.cmake new file mode 100644 index 0000000..ef79dce --- /dev/null +++ b/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 rm -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() diff --git a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake new file mode 100644 index 0000000..8584786 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake @@ -0,0 +1,169 @@ +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(notenough3 1 0) +run_ctest_resource(combine 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}) diff --git a/Tests/RunCMake/CTestResourceAllocation/checkfree1-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/checkfree1-ctest-s-res-check.cmake new file mode 100644 index 0000000..ceda72e --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/checkfree1-ctest-s-res-check.cmake @@ -0,0 +1 @@ +verify_ctest_resources() diff --git a/Tests/RunCMake/CTestResourceAllocation/checkfree1.cmake b/Tests/RunCMake/CTestResourceAllocation/checkfree1.cmake new file mode 100644 index 0000000..45cbf20 --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/CTestResourceAllocation/checkfree2-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/checkfree2-ctest-s-res-check.cmake new file mode 100644 index 0000000..ceda72e --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/checkfree2-ctest-s-res-check.cmake @@ -0,0 +1 @@ +verify_ctest_resources() diff --git a/Tests/RunCMake/CTestResourceAllocation/checkfree2.cmake b/Tests/RunCMake/CTestResourceAllocation/checkfree2.cmake new file mode 100644 index 0000000..03b737c --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/CTestResourceAllocation/combine.cmake b/Tests/RunCMake/CTestResourceAllocation/combine.cmake new file mode 100644 index 0000000..ed5b251 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/combine.cmake @@ -0,0 +1,5 @@ +setup_resource_tests() + +add_resource_test(Test1 0 "widgets:8,widgets:4") + +cleanup_resource_tests() diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets6-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets6-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc.log index abd6bad..abd6bad 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-baddealloc.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets5-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets5-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1.log index 605104b..605104b 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest1.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets4-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets4-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2.log index 1ff1b0d..1ff1b0d 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest2.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets3-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets3-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3.log index 1925e6a..1925e6a 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest3.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets2-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets2-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4.log index 3fe7da1..3fe7da1 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest4.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets1-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badwidgets1-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5.log index 3a2e7e3..3a2e7e3 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-badtest5.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good1.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good1.log index 2cca0c3..2cca0c3 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good1.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good1.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good2.log index e69de29..e69de29 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-good2.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badres-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badres-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak.log index b900d86..b900d86 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-leak.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badcount-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-badcount-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good2.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin.log index e69de29..e69de29 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-good2.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nobegin.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-noproc-count-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-noproc-count-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend.log index 605104b..605104b 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noend.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid.log index c718975..c718975 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-noid.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nolog-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nolog-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nolog-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nolog-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores.log index a18202b..a18202b 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nores.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-nores.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noid-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough.log b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough.log index ac78d5a..ac78d5a 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-notenough.log +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-verify-notenough.log diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-noproc-count-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-noend-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-noproc-count-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badcount-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-nobegin-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badcount-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badres-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-leak-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badres-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets1-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest5-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets1-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets2-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest4-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets2-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets3-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest3-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets3-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets4-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest2-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets4-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets5-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-badtest1-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets5-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets6-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-verify-baddealloc-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets6-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets7-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad2-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-badwidgets7-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good1-check.cmake b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good1-check.cmake index 949d2d7..40144c8 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc-write-proc-good1-check.cmake +++ b/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 ]]) diff --git a/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good2-check.cmake b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-good2-check.cmake new file mode 100644 index 0000000..4545466 --- /dev/null +++ b/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 +]]) diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nocount-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-bad1-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nocount-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nores-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-pass-and-fail-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nores-result.txt diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-result.txt b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nowidgets-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-timeout-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc-write-proc-nowidgets-result.txt diff --git a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx index eee2c7f..27644af 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/cthwalloc.cxx +++ b/Tests/RunCMake/CTestResourceAllocation/ctresalloc.cxx @@ -13,9 +13,9 @@ #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" -#include "cmCTestHardwareAllocator.h" -#include "cmCTestHardwareSpec.h" #include "cmCTestMultiProcessHandler.h" +#include "cmCTestResourceAllocator.h" +#include "cmCTestResourceSpec.h" #include "cmCTestTestHandler.h" #include "cmFileLock.h" #include "cmFileLockResult.h" @@ -23,15 +23,15 @@ #include "cmSystemTools.h" /* - * This helper program is used to verify that the CTest hardware allocation + * This helper program is used to verify that the CTest resource 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. - * 2) verify - This stage compares the log file with the hardware spec file to + * 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 resource 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; } @@ -54,7 +54,7 @@ static int usageWrite(const char* argv0) static int usageVerify(const char* argv0) { std::cout << "Usage: " << argv0 - << " verify <log-file> <hardware-spec-file> [<test-names>]" + << " verify <log-file> <resource-spec-file> [<test-names>]" << std::endl; return 1; } @@ -68,31 +68,33 @@ static int doWrite(int argc, char const* const* argv) std::string testName = argv[3]; unsigned int sleepTime = std::atoi(argv[4]); std::vector<std::map< - std::string, std::vector<cmCTestMultiProcessHandler::HardwareAllocation>>> - hardware; + std::string, std::vector<cmCTestMultiProcessHandler::ResourceAllocation>>> + resources; 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) { @@ -144,10 +146,10 @@ static int doWrite(int argc, char const* const* argv) // Verify that we got what we asked for and write it to the log prefix += '_'; std::map<std::string, - std::vector<cmCTestMultiProcessHandler::HardwareAllocation>> - hwEntry; + std::vector<cmCTestMultiProcessHandler::ResourceAllocation>> + resEntry; 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; @@ -192,13 +194,13 @@ static int doWrite(int argc, char const* const* argv) fout << "alloc " << type << " " << id << " " << amount << std::endl; - hwEntry[type].push_back({ id, amount }); + resEntry[type].push_back({ id, amount }); } bool ended = false; while (it->ResourceType != type || it->UnitsNeeded == 0) { ++it; - if (it == process.end()) { + if (it == resourceGroup.end()) { ended = true; break; } @@ -210,7 +212,7 @@ static int doWrite(int argc, char const* const* argv) return 1; } } - hardware.push_back(hwEntry); + resources.push_back(resEntry); ++i; } catch (...) { @@ -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 : resources) { + for (auto const& it : group) { for (auto const& it2 : it.second) { fout << "dealloc " << it.first << " " << it2.Id << " " << it2.Slots << std::endl; @@ -273,7 +276,7 @@ static int doVerify(int argc, char const* const* argv) return usageVerify(argv[0]); } std::string logFile = argv[2]; - std::string hwFile = argv[3]; + std::string resFile = argv[3]; std::string testNames; if (argc == 5) { testNames = argv[4]; @@ -281,14 +284,14 @@ static int doVerify(int argc, char const* const* argv) auto testNameList = cmExpandedList(testNames, false); std::set<std::string> testNameSet(testNameList.begin(), testNameList.end()); - cmCTestHardwareSpec spec; - if (!spec.ReadFromJSONFile(hwFile)) { - std::cout << "Could not read hardware spec " << hwFile << std::endl; + cmCTestResourceSpec spec; + if (!spec.ReadFromJSONFile(resFile)) { + std::cout << "Could not read resource spec " << resFile << std::endl; return 1; } - cmCTestHardwareAllocator allocator; - allocator.InitializeFromHardwareSpec(spec); + cmCTestResourceAllocator allocator; + allocator.InitializeFromResourceSpec(spec); cmsys::ifstream fin(logFile.c_str(), std::ios::in); if (!fin) { diff --git a/Tests/RunCMake/CTestHardwareAllocation/ensure_parallel-ctest-s-hw-check.cmake b/Tests/RunCMake/CTestResourceAllocation/ensure_parallel-ctest-s-res-check.cmake index e5f6828..d842a76 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/ensure_parallel-ctest-s-hw-check.cmake +++ b/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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/ensure_parallel.cmake b/Tests/RunCMake/CTestResourceAllocation/ensure_parallel.cmake index 1dafb8f..562d05a 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/ensure_parallel.cmake +++ b/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() diff --git a/Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake new file mode 100644 index 0000000..ceda72e --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake @@ -0,0 +1 @@ +verify_ctest_resources() diff --git a/Tests/RunCMake/CTestResourceAllocation/lotsoftests.cmake b/Tests/RunCMake/CTestResourceAllocation/lotsoftests.cmake new file mode 100644 index 0000000..4c0a7a5 --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-check.cmake new file mode 100644 index 0000000..321e9a2 --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-result.txt b/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-result.txt index b57e2de..b57e2de 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough2-ctest-s-hw-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-result.txt diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-stderr.txt new file mode 100644 index 0000000..41df5af --- /dev/null +++ b/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$ diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough1.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough1.cmake new file mode 100644 index 0000000..f820c37 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough1.cmake @@ -0,0 +1,5 @@ +setup_resource_tests() + +add_resource_test(Test1 0 "fluxcapacitors:200") + +cleanup_resource_tests() diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-check.cmake new file mode 100644 index 0000000..321e9a2 --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-result.txt b/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-result.txt index b57e2de..b57e2de 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/notenough1-ctest-s-hw-result.txt +++ b/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-result.txt diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/notenough2-ctest-s-res-stderr.txt new file mode 100644 index 0000000..6c2f554 --- /dev/null +++ b/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$ diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough2.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough2.cmake new file mode 100644 index 0000000..5b81776 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough2.cmake @@ -0,0 +1,5 @@ +setup_resource_tests() + +add_resource_test(Test1 0 "terminators:2") + +cleanup_resource_tests() diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-check.cmake new file mode 100644 index 0000000..321e9a2 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough3-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() diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-result.txt b/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-stderr.txt new file mode 100644 index 0000000..82dfdef --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res-stderr.txt @@ -0,0 +1,4 @@ +^Insufficient resources +CMake Error at [^ +]*/Tests/RunCMake/CTestResourceAllocation/notenough3-ctest-s-res/test\.cmake:[0-9]+ \(message\): + Tests did not pass$ diff --git a/Tests/RunCMake/CTestResourceAllocation/notenough3.cmake b/Tests/RunCMake/CTestResourceAllocation/notenough3.cmake new file mode 100644 index 0000000..ddf3a9c --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/notenough3.cmake @@ -0,0 +1,5 @@ +setup_resource_tests() + +add_resource_test(Test1 0 "widgets:12") + +cleanup_resource_tests() diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake new file mode 100644 index 0000000..ceda72e --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/process_count-ctest-s-res-check.cmake @@ -0,0 +1 @@ +verify_ctest_resources() diff --git a/Tests/RunCMake/CTestResourceAllocation/process_count.cmake b/Tests/RunCMake/CTestResourceAllocation/process_count.cmake new file mode 100644 index 0000000..1457f89 --- /dev/null +++ b/Tests/RunCMake/CTestResourceAllocation/process_count.cmake @@ -0,0 +1,5 @@ +setup_resource_tests() + +add_resource_test(Test1 1 "widgets:1") + +cleanup_resource_tests() diff --git a/Tests/RunCMake/CTestHardwareAllocation/hwspec.json b/Tests/RunCMake/CTestResourceAllocation/resspec.json index c67fcca..48321ec 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/hwspec.json +++ b/Tests/RunCMake/CTestResourceAllocation/resspec.json @@ -1,4 +1,8 @@ { + "version": { + "major": 1, + "minor": 0 + }, "local": [ { "widgets": [ diff --git a/Tests/RunCMake/CTestHardwareAllocation/test.cmake.in b/Tests/RunCMake/CTestResourceAllocation/test.cmake.in index 5ba3587..4b426f1 100644 --- a/Tests/RunCMake/CTestHardwareAllocation/test.cmake.in +++ b/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 HARDWARE_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() diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-result.txt b/Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-and-pass-result.txt +++ b/Tests/RunCMake/CommandLine/E_rm_bad_argument-result.txt diff --git a/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt new file mode 100644 index 0000000..62b963a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_bad_argument-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Unknown -E rm argument: -rd$ diff --git a/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake new file mode 100644 index 0000000..b1a29a2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${out}/dir/existing.txt) + set(RunCMake_TEST_FAILED "${out}/dir/existing.txt should exist (we only removed the link to dir folder)") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_directory_link_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt new file mode 100644 index 0000000..1ac7dba --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Missing file/directory to remove$ diff --git a/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake new file mode 100644 index 0000000..6cd4edd --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_empty_file_specified.cmake @@ -0,0 +1,8 @@ +execute_process( + COMMAND ${CMAKE_COMMAND} -E rm "" + RESULT_VARIABLE actual_result + ) + +if(NOT "${actual_result}" EQUAL "1") + message(SEND_ERROR "cmake -E rm \"\" should have returned 1, got ${actual_result}") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake new file mode 100644 index 0000000..e28b160 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${out}/existing.txt) + set(RunCMake_TEST_FAILED "${out}/existing.txt not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_force_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_force_non_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake new file mode 100644 index 0000000..a0a9b20 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${out}/existing.txt) + set(RunCMake_TEST_FAILED "${out}/existing.txt should exist (we only removed the link)") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_link_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_link_non_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake new file mode 100644 index 0000000..e28b160 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${out}/existing.txt) + set(RunCMake_TEST_FAILED "${out}/existing.txt not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad2-result.txt +++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-result.txt diff --git a/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt new file mode 100644 index 0000000..05df88a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_non_force_non_existing-stderr.txt @@ -0,0 +1 @@ +^CMake Error: File to remove does not exist and force is not set: .*/rm_tests/not_existing.txt diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake new file mode 100644 index 0000000..e28b160 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${out}/existing.txt) + set(RunCMake_TEST_FAILED "${out}/existing.txt not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-result.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-after-timeout-bad1-result.txt +++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-result.txt diff --git a/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt new file mode 100644 index 0000000..05df88a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_file_recursive_non_existing-stderr.txt @@ -0,0 +1 @@ +^CMake Error: File to remove does not exist and force is not set: .*/rm_tests/not_existing.txt diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake new file mode 100644 index 0000000..1a976cb --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${out}) + set(RunCMake_TEST_FAILED "${out} not removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_directory_with_files-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt b/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_force_recursive_non_existing_file-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt new file mode 100644 index 0000000..1ac7dba --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_no_file_specified-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Missing file/directory to remove$ diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake new file mode 100644 index 0000000..609271e --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${out}/d1 OR NOT EXISTS ${out}/d2) + set(RunCMake_TEST_FAILED "${out}/d1 or ${out}/d2 is removed but should not") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt new file mode 100644 index 0000000..33ea2e3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_non_recursive_directory-two-directories-stderr.txt @@ -0,0 +1,2 @@ +^Error removing directory ".*/rm_tests/d1" without recursive option\. +Error removing directory ".*/rm_tests/d2" without recursive option\.$ diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake new file mode 100644 index 0000000..5282da7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${out}/d1 OR EXISTS ${out}/d2) + set(RunCMake_TEST_FAILED "${out}/d1 or ${out}/d2 should be removed") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory-two-directories-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake new file mode 100644 index 0000000..b1a29a2 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${out}/dir/existing.txt) + set(RunCMake_TEST_FAILED "${out}/dir/existing.txt should exist (we only removed the link to dir folder)") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_directory_link_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake new file mode 100644 index 0000000..a0a9b20 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-check.cmake @@ -0,0 +1,3 @@ +if(NOT EXISTS ${out}/existing.txt) + set(RunCMake_TEST_FAILED "${out}/existing.txt should exist (we only removed the link)") +endif() diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_rm_recursive_file_link_non_existing-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f903c3d..bd368cb 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -388,6 +388,76 @@ endif() unset(out) unset(outfile) +set(out ${RunCMake_BINARY_DIR}/rm_tests) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +file(TOUCH ${out}/existing.txt) +run_cmake_command(E_rm_file_force_existing + ${CMAKE_COMMAND} -E rm -f ${out}/existing.txt) +file(TOUCH ${out}/existing.txt) +run_cmake_command(E_rm_file_non_force_existing + ${CMAKE_COMMAND} -E rm ${out}/existing.txt) +run_cmake_command(E_rm_file_force_non_existing + ${CMAKE_COMMAND} -E rm -f ${out}/not_existing.txt) +run_cmake_command(E_rm_file_non_force_non_existing + ${CMAKE_COMMAND} -E rm ${out}/not_existing.txt) + +file(TOUCH ${out}/existing.txt) +run_cmake_command(E_rm_file_recursive_existing + ${CMAKE_COMMAND} -E rm -r ${out}/existing.txt) +run_cmake_command(E_rm_file_recursive_non_existing + ${CMAKE_COMMAND} -E rm -r ${out}/not_existing.txt) + +file(MAKE_DIRECTORY ${out}/d1 ${out}/d2) +run_cmake_command(E_rm_non_recursive_directory-two-directories + ${CMAKE_COMMAND} -E rm ${out}/d1 ${out}/d2) + +run_cmake_command(E_rm_recursive_directory-two-directories + ${CMAKE_COMMAND} -E rm -R ${out}/d1 ${out}/d2) + +run_cmake_command(E_rm_no_file_specified + ${CMAKE_COMMAND} -E rm -rf) + +run_cmake_command(E_rm_empty_file_specified + ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/E_rm_empty_file_specified.cmake) + +run_cmake_command(E_rm_bad_argument + ${CMAKE_COMMAND} -E rm -rd ${out}/d1 ${out}/d2) + +file(MAKE_DIRECTORY ${out}/d1 ${out}/d2) +file(WRITE ${out}/test.txt "") +run_cmake_command(E_rm_force_recursive_directory_with_files + ${CMAKE_COMMAND} -E rm -rf ${out}/) + +run_cmake_command(E_rm_force_recursive_non_existing_file + ${CMAKE_COMMAND} -E rm -Rf ${out}/test.txt) + +if(NOT WIN32 AND NOT CYGWIN) + file(MAKE_DIRECTORY ${out}) + file(TOUCH ${out}/existing.txt) + file(MAKE_DIRECTORY ${out}/dir) + file(TOUCH ${out}/dir/existing.txt) # add a file in the folder + file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC) + file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC) + file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC) + run_cmake_command(E_rm_file_link_existing + ${CMAKE_COMMAND} -E rm ${out}/existing_file_link.txt) + run_cmake_command(E_rm_directory_link_existing + ${CMAKE_COMMAND} -E rm ${out}/link_dir) + run_cmake_command(E_rm_file_link_non_existing + ${CMAKE_COMMAND} -E rm ${out}/non_existing_file_link.txt) + + file(CREATE_LINK ${out}/dir ${out}/link_dir SYMBOLIC) + file(CREATE_LINK ${out}/existing.txt ${out}/existing_file_link.txt SYMBOLIC) + file(CREATE_LINK ${out}/non_existing.txt ${out}/non_existing_file_link.txt SYMBOLIC) + run_cmake_command(E_rm_recursive_file_link_existing + ${CMAKE_COMMAND} -E rm -R ${out}/existing_file_link.txt) + run_cmake_command(E_rm_recursive_directory_link_existing + ${CMAKE_COMMAND} -E rm -r ${out}/link_dir) + run_cmake_command(E_rm_recursive_file_link_non_existing + ${CMAKE_COMMAND} -E rm -r ${out}/non_existing_file_link.txt) +endif() +unset(out) run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) diff --git a/Tests/RunCMake/CompilerLauncher/C-common.cmake b/Tests/RunCMake/CompilerLauncher/C-common.cmake new file mode 100644 index 0000000..96b004b --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-common.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.c) diff --git a/Tests/RunCMake/CompilerLauncher/C-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-env-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-env-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/C-env-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-env-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/C-env.cmake b/Tests/RunCMake/CompilerLauncher/C-env.cmake new file mode 100644 index 0000000..09b5167 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-env.cmake @@ -0,0 +1 @@ +include(C-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/C-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/C-launch-env.cmake new file mode 100644 index 0000000..68abcb5 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/C-launch-env.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C-env.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/C.cmake b/Tests/RunCMake/CompilerLauncher/C.cmake index 67bf7c4..481e74d 100644 --- a/Tests/RunCMake/CompilerLauncher/C.cmake +++ b/Tests/RunCMake/CompilerLauncher/C.cmake @@ -1,4 +1,2 @@ -enable_language(C) set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") -set(CMAKE_VERBOSE_MAKEFILE TRUE) -add_executable(main main.c) +include(C-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake b/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake new file mode 100644 index 0000000..6f7fc86 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-common.cmake @@ -0,0 +1,3 @@ +enable_language(CUDA) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cu) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CUDA-env-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-env-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CUDA-env-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-env-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-env.cmake b/Tests/RunCMake/CompilerLauncher/CUDA-env.cmake new file mode 100644 index 0000000..cefbe9e --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-env.cmake @@ -0,0 +1 @@ +include(CUDA-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/CUDA-launch-env.cmake new file mode 100644 index 0000000..d0d777a --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CUDA-launch-env.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CUDA-env.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CUDA.cmake b/Tests/RunCMake/CompilerLauncher/CUDA.cmake index fe5560b..7f1652b 100644 --- a/Tests/RunCMake/CompilerLauncher/CUDA.cmake +++ b/Tests/RunCMake/CompilerLauncher/CUDA.cmake @@ -1,4 +1,2 @@ -enable_language(CUDA) set(CMAKE_CUDA_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") -set(CMAKE_VERBOSE_MAKEFILE TRUE) -add_executable(main main.cu) +include(CUDA-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-common.cmake b/Tests/RunCMake/CompilerLauncher/CXX-common.cmake new file mode 100644 index 0000000..3d2ee00 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-common.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-env-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-env-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/CXX-env-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-env-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/CXX-env.cmake b/Tests/RunCMake/CompilerLauncher/CXX-env.cmake new file mode 100644 index 0000000..db36956 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-env.cmake @@ -0,0 +1 @@ +include(CXX-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/CXX-launch-env.cmake new file mode 100644 index 0000000..a65cc89 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/CXX-launch-env.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX-env.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/CXX.cmake b/Tests/RunCMake/CompilerLauncher/CXX.cmake index cdd3478..1f9a12b 100644 --- a/Tests/RunCMake/CompilerLauncher/CXX.cmake +++ b/Tests/RunCMake/CompilerLauncher/CXX.cmake @@ -1,4 +1,2 @@ -enable_language(CXX) set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") -set(CMAKE_VERBOSE_MAKEFILE TRUE) -add_executable(main main.cxx) +include(CXX-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-common.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-common.cmake new file mode 100644 index 0000000..e33c2ca --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-common.cmake @@ -0,0 +1,3 @@ +enable_language(Fortran) +set(CMAKE_VERBOSE_MAKEFILE TRUE) +add_executable(main main.F) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-env-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-env-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-env-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-env-launch-Build-stdout.txt b/Tests/RunCMake/CompilerLauncher/Fortran-env-launch-Build-stdout.txt new file mode 100644 index 0000000..3313e31 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-env-launch-Build-stdout.txt @@ -0,0 +1 @@ +.*-E env USED_LAUNCHER=1.* diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-env.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-env.cmake new file mode 100644 index 0000000..3dc27c3 --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-env.cmake @@ -0,0 +1 @@ +include(Fortran-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran-launch-env.cmake b/Tests/RunCMake/CompilerLauncher/Fortran-launch-env.cmake new file mode 100644 index 0000000..30a196c --- /dev/null +++ b/Tests/RunCMake/CompilerLauncher/Fortran-launch-env.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(Fortran-env.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/Fortran.cmake b/Tests/RunCMake/CompilerLauncher/Fortran.cmake index 72cc03e..dc46173 100644 --- a/Tests/RunCMake/CompilerLauncher/Fortran.cmake +++ b/Tests/RunCMake/CompilerLauncher/Fortran.cmake @@ -1,4 +1,2 @@ -enable_language(Fortran) set(CMAKE_Fortran_COMPILER_LAUNCHER "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") -set(CMAKE_VERBOSE_MAKEFILE TRUE) -add_executable(main main.F) +include(Fortran-common.cmake) diff --git a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake index bb8da03..f86e8ea 100644 --- a/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompilerLauncher/RunCMakeTest.cmake @@ -15,6 +15,13 @@ function(run_compiler_launcher lang) run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args}) endfunction() +function(run_compiler_launcher_env lang) + string(REGEX REPLACE "-.*" "" core_lang "${lang}") + set(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER} "${CMAKE_COMMAND};-E;env;USED_LAUNCHER=1") + run_compiler_launcher(${lang}) + unset(ENV{CMAKE_${core_lang}_COMPILER_LAUNCHER}) +endfunction() + set(langs C CXX) if(CMake_TEST_CUDA) list(APPEND langs CUDA) @@ -25,7 +32,9 @@ endif() foreach(lang ${langs}) run_compiler_launcher(${lang}) + run_compiler_launcher_env(${lang}-env) if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_compiler_launcher(${lang}-launch) + run_compiler_launcher_env(${lang}-launch-env) endif() endforeach() diff --git a/Tests/RunCMake/FileAPI/check_index.py b/Tests/RunCMake/FileAPI/check_index.py index cda7234..23b02e9 100644 --- a/Tests/RunCMake/FileAPI/check_index.py +++ b/Tests/RunCMake/FileAPI/check_index.py @@ -109,10 +109,11 @@ def check_cmake_generator(g): name = g.get("name", None) assert is_string(name) if name.startswith("Visual Studio"): - assert sorted(g.keys()) == ["name", "platform"] + assert sorted(g.keys()) == ["multiConfig", "name", "platform"] assert is_string(g["platform"]) else: - assert sorted(g.keys()) == ["name"] + assert sorted(g.keys()) == ["multiConfig", "name"] + assert is_bool(g["multiConfig"], matches(name, "^(Visual Studio |Xcode$)")) def check_index_object(indexEntry, kind, major, minor, check): assert is_dict(indexEntry) diff --git a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt index 208f3c9..cb1a2e5 100644 --- a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt @@ -4,4 +4,10 @@ Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) + +CMake Error at OwnSources.cmake:[0-9]+ \(add_library\): + The SOURCES of "A" use a generator expression that depends on the SOURCES + themselves. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) ++ CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input index 81e9ee0..b1c4ce0 100644 --- a/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input +++ b/Tests/RunCMake/ParseImplicitData/mingw.org-C-GNU-4.9.3.input @@ -53,7 +53,7 @@ LIBRARY_PATH=c:/DoesNotExist/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/DoesNotExist COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_ab097.dir\CMakeCCompilerABI.c.obj' '-c' '-mtune=generic' '-march=i586' Linking C executable cmTC_ab097.exe "C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_ab097.dir\link.txt --verbose=1 -"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_ab097.dir/objects.a +"C:\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_ab097.dir/objects.a C:\DoesNotExist\MinGW\bin\ar.exe cr CMakeFiles\cmTC_ab097.dir/objects.a @CMakeFiles\cmTC_ab097.dir\objects1.rsp C:\DoesNotExist\MinGW\bin\gcc.exe -v -Wl,--whole-archive CMakeFiles\cmTC_ab097.dir/objects.a -Wl,--no-whole-archive -o cmTC_ab097.exe -Wl,--out-implib,libcmTC_ab097.dll.a -Wl,--major-image-version,0,--minor-image-version,0 Using built-in specs. diff --git a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input index cd77340..aae67bb 100644 --- a/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input +++ b/Tests/RunCMake/ParseImplicitData/mingw.org-CXX-GNU-4.9.3.input @@ -59,7 +59,7 @@ LIBRARY_PATH=c:/DoesNotExist/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/DoesNotExist COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles\cmTC_2b790.dir\CMakeCXXCompilerABI.cpp.obj' '-c' '-shared-libgcc' '-mtune=generic' '-march=i586' Linking CXX executable cmTC_2b790.exe "C:\CMake\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTC_2b790.dir\link.txt --verbose=1 -"C:\CMake\bin\cmake.exe" -E remove -f CMakeFiles\cmTC_2b790.dir/objects.a +"C:\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_2b790.dir/objects.a C:\DoesNotExist\MinGW\bin\ar.exe cr CMakeFiles\cmTC_2b790.dir/objects.a @CMakeFiles\cmTC_2b790.dir\objects1.rsp C:\DoesNotExist\MinGW\bin\g++.exe -v -Wl,--whole-archive CMakeFiles\cmTC_2b790.dir/objects.a -Wl,--no-whole-archive -o cmTC_2b790.exe -Wl,--out-implib,libcmTC_2b790.dll.a -Wl,--major-image-version,0,--minor-image-version,0 Using built-in specs. diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake index 8cf0fc9..494bcf7 100644 --- a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") -else() - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") -endif() +set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") +set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") if (NOT EXISTS ${foo_pch_header}) set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake index caeb22b..4e62b81 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchInterface-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") -else() - set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") - set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") -endif() +set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h") +set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") if (NOT EXISTS ${foo_pch_header}) set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake index e0b753a..cc01ecb 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake @@ -1,10 +1,5 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h") - set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx") -else() - set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") - set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx") -endif() +set(foobar_pch_h_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h") +set(foobar_pch_hxx_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx") if (NOT EXISTS ${foobar_pch_h_header}) set(RunCMake_TEST_FAILED "Generated foobar C pch header ${foobar_pch_h_header} does not exist") diff --git a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake index ba220f3..9018664 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake @@ -1,8 +1,4 @@ -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/CMakeFiles/main.dir/cmake_pch.hxx") -else() - set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx") -endif() +set(main_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx") file(STRINGS ${main_pch_header} main_pch_header_strings) string(REGEX MATCH "#pragma warning\\(push, 0\\).*#include.*pch.h.*#pragma warning\\(pop\\)" matched_code ${main_pch_header_strings}) diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake index 4502456..03a97ed 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake @@ -1,8 +1,12 @@ cmake_minimum_required(VERSION 3.15) project(PchReuseFrom C) +if(CMAKE_C_COMPILE_OPTIONS_USE_PCH) + add_definitions(-DHAVE_PCH_SUPPORT) +endif() + add_library(empty empty.c) -target_precompile_headers(empty PUBLIC +target_precompile_headers(empty PRIVATE <stdio.h> <string.h> ) @@ -12,6 +16,9 @@ add_library(foo foo.c) target_include_directories(foo PUBLIC include) target_precompile_headers(foo REUSE_FROM empty) +# should not cause problems if configured multiple times +target_precompile_headers(foo REUSE_FROM empty) + add_executable(foobar foobar.c) target_link_libraries(foobar foo ) set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM foo) diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed-build-stderr.txt b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed-build-stderr.txt new file mode 100644 index 0000000..8cdcfd9 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed-build-stderr.txt @@ -0,0 +1,2 @@ +^(|Warning #670: precompiled header file [^ +]* was not generated in this directory)$ diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake new file mode 100644 index 0000000..e306d8e --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFromPrefixed.cmake @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15) +project(PchReuseFromPrefixed C) + +if(CMAKE_C_COMPILE_OPTIONS_USE_PCH) + add_definitions(-DHAVE_PCH_SUPPORT) +endif() + +add_library(empty empty.c) +target_precompile_headers(empty PRIVATE + <stdio.h> + <string.h> +) +target_include_directories(empty PUBLIC include) + +add_library(foo foo.c) +target_include_directories(foo PUBLIC include) +target_precompile_headers(foo REUSE_FROM empty) + +# Visual Studio 2017 and greater +if (NOT (CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 19.10)) + set_target_properties(foo PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib") +endif() + +add_executable(foobar foobar.c) +target_link_libraries(foobar foo ) +set_target_properties(foobar PROPERTIES PRECOMPILE_HEADERS_REUSE_FROM empty) + +enable_testing() +add_test(NAME foobar COMMAND foobar) diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake index ec13663..8d2f4f9 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -17,5 +17,6 @@ run_test(PchInterface) run_cmake(PchPrologueEpilogue) run_test(SkipPrecompileHeaders) run_test(PchReuseFrom) +run_test(PchReuseFromPrefixed) run_test(PchReuseFromSubdir) run_cmake(PchMultilanguage) diff --git a/Tests/RunCMake/PrecompileHeaders/foobar.c b/Tests/RunCMake/PrecompileHeaders/foobar.c index 7a135ea..97d465c 100644 --- a/Tests/RunCMake/PrecompileHeaders/foobar.c +++ b/Tests/RunCMake/PrecompileHeaders/foobar.c @@ -4,5 +4,11 @@ int main() { - return foo() + foo2() + bar(); + int zeroSize = 0; + +#ifdef HAVE_PCH_SUPPORT + zeroSize = (int)strlen(""); +#endif + + return foo() + foo2() + bar() + zeroSize; } diff --git a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake index 8e484d0..24daa64 100644 --- a/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake +++ b/Tests/RunCMake/UnityBuild/RunCMakeTest.cmake @@ -21,3 +21,4 @@ function(run_test name) endfunction() run_test(unitybuild_runtest) +run_test(unitybuild_object_library) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_object_library.cmake b/Tests/RunCMake/UnityBuild/unitybuild_object_library.cmake new file mode 100644 index 0000000..b400517 --- /dev/null +++ b/Tests/RunCMake/UnityBuild/unitybuild_object_library.cmake @@ -0,0 +1,13 @@ +project(unitybuild_object_library C) + +set(CMAKE_UNITY_BUILD ON) # This tests that the variable works in addition to the property + +add_library(lib OBJECT func.c) + +add_library(other-lib STATIC func.c) + +add_executable(main main.c) +target_link_libraries(main PRIVATE lib) + +enable_testing() +add_test(NAME main COMMAND main) diff --git a/Tests/RunCMake/UnityBuild/unitybuild_runtest.cmake b/Tests/RunCMake/UnityBuild/unitybuild_runtest.cmake index 8816299..3589cc8 100644 --- a/Tests/RunCMake/UnityBuild/unitybuild_runtest.cmake +++ b/Tests/RunCMake/UnityBuild/unitybuild_runtest.cmake @@ -2,6 +2,7 @@ project(unitybuild_runtest C) set(CMAKE_UNITY_BUILD ON) # This tests that the variable works in addition to the property +add_library(lib main.c func.c) add_executable(main main.c func.c) enable_testing() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake b/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake index 61419d8..fdd45bc 100644 --- a/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake +++ b/Tests/RunCMake/UnityBuild/unitybuild_skip-check.cmake @@ -1,9 +1,9 @@ set(unitybuild_c "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/tgt.dir/Unity/unity_0.c") file(STRINGS ${unitybuild_c} unitybuild_c_strings) -string(REGEX MATCH "\\/s[2-6].c" matched_files_2_6 ${unitybuild_c_strings}) -if(matched_files_2_6) - set(RunCMake_TEST_FAILED "Generated unity contains s2.c -> s6.c which should have been skipped") +string(REGEX MATCH "\\/s[1-6].c" matched_files_1_6 ${unitybuild_c_strings}) +if(matched_files_1_6) + set(RunCMake_TEST_FAILED "Generated unity contains s1.c -> s6.c which should have been skipped") return() endif() diff --git a/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake b/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake index eef8ccc..94e5aa3 100644 --- a/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake +++ b/Tests/RunCMake/UnityBuild/unitybuild_skip.cmake @@ -1,7 +1,7 @@ project(unitybuild_skip C) set(srcs "") -foreach(s RANGE 2 8) +foreach(s RANGE 1 8) set(src "${CMAKE_CURRENT_BINARY_DIR}/s${s}.c") file(WRITE "${src}" "int s${s}(void) { return 0; }\n") list(APPEND srcs "${src}") @@ -11,6 +11,9 @@ add_library(tgt SHARED ${srcs}) set_target_properties(tgt PROPERTIES UNITY_BUILD ON) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/s1.c + PROPERTIES HEADER_FILE_ONLY ON) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/s2.c PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 9e82841..6ecf3f2 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -54,6 +54,20 @@ endfunction() XcodeDependOnZeroCheck() +function(XcodeObjcxxFlags testName) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(${testName}) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + +XcodeObjcxxFlags(XcodeObjcFlags) +XcodeObjcxxFlags(XcodeObjcxxFlags) + # Isolate device tests from host architecture selection. unset(ENV{CMAKE_OSX_ARCHITECTURES}) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake new file mode 100644 index 0000000..4840276 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjcFlags.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(objctest LANGUAGES C OBJC) + +include(CheckOBJCCompilerFlag) +check_objc_compiler_flag(-fobjc-arc HAVE_OBJC_ARC) + +if(HAVE_OBJC_ARC) + add_compile_options(-fobjc-arc) + add_compile_definitions(HAVE_OBJC_ARC) +endif() + +add_library(myfuncs STATIC myfuncs.m) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake b/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake new file mode 100644 index 0000000..0ad942f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjcxxFlags.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(objcxxtest LANGUAGES CXX OBJCXX) + +include(CheckOBJCXXCompilerFlag) +check_objcxx_compiler_flag(-fobjc-arc HAVE_OBJC_ARC) + +if(HAVE_OBJC_ARC) + add_compile_options(-fobjc-arc) + add_compile_definitions(HAVE_OBJC_ARC) +endif() + +add_library(myfuncs STATIC myfuncs.mm) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index 7d83a70..c742f50 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -45,6 +45,7 @@ check_property("ENVIRONMENT" [=[key="FOO"]=]) check_property("ENVIRONMENT" [=[value="foo"]=]) check_property("ENVIRONMENT" [=[key="BAR"]=]) check_property("ENVIRONMENT" [=[value="bar"]=]) +check_property("WORKING_DIRECTORY" [=["/working/dir"]=]) expect_no_schema("NoSchema") diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index be219f4..ce5c0c9 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -35,6 +35,7 @@ endfunction() create_scheme_for_property(EXECUTABLE myExecutable) create_scheme_for_property(ARGUMENTS "--foo;--bar=baz") create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar") +create_scheme_for_property(WORKING_DIRECTORY "/working/dir") add_executable(NoSchema main.cpp) set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF) diff --git a/Tests/RunCMake/XcodeProject/myfuncs.m b/Tests/RunCMake/XcodeProject/myfuncs.m new file mode 100644 index 0000000..742ba8e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/myfuncs.m @@ -0,0 +1,3 @@ +#if defined(HAVE_OBJC_ARC) && ! __has_feature(objc_arc) +#error THIS CODE MUST BE COMPILED WITH ARC ENABLED! +#endif diff --git a/Tests/RunCMake/XcodeProject/myfuncs.mm b/Tests/RunCMake/XcodeProject/myfuncs.mm new file mode 100644 index 0000000..742ba8e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/myfuncs.mm @@ -0,0 +1,3 @@ +#if defined(HAVE_OBJC_ARC) && ! __has_feature(objc_arc) +#error THIS CODE MUST BE COMPILED WITH ARC ENABLED! +#endif diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 6877e6a..84d1d66 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -1,6 +1,9 @@ include(RunCTest) set(RunCMake_TEST_TIMEOUT 60) +unset(ENV{CTEST_PARALLEL_LEVEL}) +unset(ENV{CTEST_OUTPUT_ON_FAILURE}) + set(CASE_CTEST_TEST_ARGS "") set(CASE_CTEST_TEST_LOAD "") @@ -71,7 +74,24 @@ add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput) add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command) ]]) - unset(ENV{CTEST_PARALLEL_LEVEL}) run_ctest(TestOutputSize) endfunction() run_TestOutputSize() + +run_ctest_test(TestRepeatBad1 REPEAT UNKNOWN:3) +run_ctest_test(TestRepeatBad2 REPEAT UNTIL_FAIL:-1) + +function(run_TestRepeat case) + set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion ${ARGN}) + string(CONCAT CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test(NAME testRepeat + COMMAND ${CMAKE_COMMAND} -D COUNT_FILE=${CMAKE_CURRENT_BINARY_DIR}/count.cmake + -P "]] "${RunCMake_SOURCE_DIR}/TestRepeat${case}" [[.cmake") +set_property(TEST testRepeat PROPERTY TIMEOUT 5) + ]]) + + run_ctest(TestRepeat${case}) +endfunction() +run_TestRepeat(UntilFail REPEAT UNTIL_FAIL:3) +run_TestRepeat(UntilPass REPEAT UNTIL_PASS:3) +run_TestRepeat(AfterTimeout REPEAT AFTER_TIMEOUT:3) diff --git a/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout-stdout.txt b/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout-stdout.txt new file mode 100644 index 0000000..17657c5 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout-stdout.txt @@ -0,0 +1,10 @@ +Test project [^ +]*/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout-build + Start 1: testRepeat +1/1 Test #1: testRepeat .......................\*\*\*Timeout +[0-9.]+ sec + Start 1: testRepeat + Test #1: testRepeat ....................... Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout.cmake b/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout.cmake new file mode 100644 index 0000000..abde4f0 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatAfterTimeout.cmake @@ -0,0 +1,10 @@ +include("${COUNT_FILE}" OPTIONAL) +if(NOT COUNT) + set(COUNT 0) +endif() +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${COUNT_FILE}" "set(COUNT ${COUNT})\n") +if(NOT COUNT EQUAL 2) + message("this test times out except on the 2nd run") + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 10) +endif() diff --git a/Tests/RunCMake/ctest_test/TestRepeatBad1-result.txt b/Tests/RunCMake/ctest_test/TestRepeatBad1-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatBad1-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestRepeatBad1-stderr.txt b/Tests/RunCMake/ctest_test/TestRepeatBad1-stderr.txt new file mode 100644 index 0000000..37cffbf --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatBad1-stderr.txt @@ -0,0 +1 @@ +Repeat option invalid value: UNKNOWN:3 diff --git a/Tests/RunCMake/ctest_test/TestRepeatBad2-result.txt b/Tests/RunCMake/ctest_test/TestRepeatBad2-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatBad2-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/TestRepeatBad2-stderr.txt b/Tests/RunCMake/ctest_test/TestRepeatBad2-stderr.txt new file mode 100644 index 0000000..ca5cef7 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatBad2-stderr.txt @@ -0,0 +1 @@ +Repeat option invalid value: UNTIL_FAIL:-1 diff --git a/Tests/RunCMake/ctest_test/TestRepeatUntilFail-stdout.txt b/Tests/RunCMake/ctest_test/TestRepeatUntilFail-stdout.txt new file mode 100644 index 0000000..5f91a67 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatUntilFail-stdout.txt @@ -0,0 +1,13 @@ +Test project [^ +]*/Tests/RunCMake/ctest_test/TestRepeatUntilFail-build + Start 1: testRepeat + Test #1: testRepeat ....................... Passed +[0-9.]+ sec + Start 1: testRepeat + Test #1: testRepeat .......................\*\*\*Failed +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[ ]+1 - testRepeat \(Failed\)$ diff --git a/Tests/RunCMake/ctest_test/TestRepeatUntilFail.cmake b/Tests/RunCMake/ctest_test/TestRepeatUntilFail.cmake new file mode 100644 index 0000000..5eb0d8a --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatUntilFail.cmake @@ -0,0 +1,9 @@ +include("${COUNT_FILE}" OPTIONAL) +if(NOT COUNT) + set(COUNT 0) +endif() +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${COUNT_FILE}" "set(COUNT ${COUNT})\n") +if(COUNT EQUAL 2) + message(FATAL_ERROR "this test fails on the 2nd run") +endif() diff --git a/Tests/RunCMake/ctest_test/TestRepeatUntilPass-stdout.txt b/Tests/RunCMake/ctest_test/TestRepeatUntilPass-stdout.txt new file mode 100644 index 0000000..bc6939a --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatUntilPass-stdout.txt @@ -0,0 +1,10 @@ +Test project [^ +]*/Tests/RunCMake/ctest_test/TestRepeatUntilPass-build + Start 1: testRepeat +1/1 Test #1: testRepeat .......................\*\*\*Failed +[0-9.]+ sec + Start 1: testRepeat + Test #1: testRepeat ....................... Passed +[0-9.]+ sec ++ +100% tests passed, 0 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec$ diff --git a/Tests/RunCMake/ctest_test/TestRepeatUntilPass.cmake b/Tests/RunCMake/ctest_test/TestRepeatUntilPass.cmake new file mode 100644 index 0000000..0662522 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestRepeatUntilPass.cmake @@ -0,0 +1,9 @@ +include("${COUNT_FILE}" OPTIONAL) +if(NOT COUNT) + set(COUNT 0) +endif() +math(EXPR COUNT "${COUNT} + 1") +file(WRITE "${COUNT_FILE}" "set(COUNT ${COUNT})\n") +if(NOT COUNT EQUAL 2) + message(FATAL_ERROR "this test passes only on the 2nd run") +endif() diff --git a/Tests/RunCMake/load_cache/CMakeLists.txt b/Tests/RunCMake/load_cache/CMakeLists.txt new file mode 100644 index 0000000..2632ffa --- /dev/null +++ b/Tests/RunCMake/load_cache/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/load_cache/NewForm_Project.cmake b/Tests/RunCMake/load_cache/NewForm_Project.cmake new file mode 100644 index 0000000..13a450b --- /dev/null +++ b/Tests/RunCMake/load_cache/NewForm_Project.cmake @@ -0,0 +1,16 @@ +load_cache(${CMAKE_CURRENT_BINARY_DIR}/../test_project READ_WITH_PREFIX LOAD_CACHE_TEST_ + CACHE_STRING + CACHE_BOOL + CACHE_INTERNAL) + +if(NOT LOAD_CACHE_TEST_CACHE_STRING STREQUAL "cache string") + message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache string\"") +endif() + +if(NOT LOAD_CACHE_TEST_CACHE_BOOL) + message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON") +endif() + +if(NOT LOAD_CACHE_TEST_CACHE_INTERNAL STREQUAL "cache internal") + message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache internal\"") +endif() diff --git a/Tests/RunCMake/load_cache/NewForm_Script.cmake b/Tests/RunCMake/load_cache/NewForm_Script.cmake new file mode 100644 index 0000000..f3cee92 --- /dev/null +++ b/Tests/RunCMake/load_cache/NewForm_Script.cmake @@ -0,0 +1,16 @@ +load_cache(${RunCMake_BINARY_DIR}/test_project READ_WITH_PREFIX LOAD_CACHE_TEST_ + CACHE_STRING + CACHE_BOOL + CACHE_INTERNAL) + +if(NOT LOAD_CACHE_TEST_CACHE_STRING STREQUAL "cache string") + message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache string\"") +endif() + +if(NOT LOAD_CACHE_TEST_CACHE_BOOL) + message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON") +endif() + +if(NOT LOAD_CACHE_TEST_CACHE_INTERNAL STREQUAL "cache internal") + message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache internal\"") +endif() diff --git a/Tests/RunCMake/load_cache/OldForm_Script-result.txt b/Tests/RunCMake/load_cache/OldForm_Script-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/load_cache/OldForm_Script-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt b/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt new file mode 100644 index 0000000..9ad5c80 --- /dev/null +++ b/Tests/RunCMake/load_cache/OldForm_Script-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at.*/Tests/RunCMake/load_cache/OldForm_Script.cmake:1 \(load_cache\): + load_cache Only load_cache\(READ_WITH_PREFIX\) may be used in script mode$ diff --git a/Tests/RunCMake/load_cache/OldForm_Script.cmake b/Tests/RunCMake/load_cache/OldForm_Script.cmake new file mode 100644 index 0000000..9560f61 --- /dev/null +++ b/Tests/RunCMake/load_cache/OldForm_Script.cmake @@ -0,0 +1,13 @@ +load_cache(${RunCMake_BINARY_DIR}/test_project INCLUDE_INTERNALS CACHE_INTERNAL) + +if(NOT CACHE_STRING STREQUAL "cache string") + message(FATAL_ERROR "CACHE_STRING: was ${CACHE_STRING}, expected \"cache string\"") +endif() + +if(NOT CACHE_BOOL) + message(FATAL_ERROR "CACHE_BOOL: was falsey, expected ON") +endif() + +if(NOT CACHE_INTERNAL STREQUAL "cache internal") + message(FATAL_ERROR "CACHE_INTERNAL: was ${CACHE_INTENRAL}, expected \"cache internal\"") +endif() diff --git a/Tests/RunCMake/load_cache/RunCMakeTest.cmake b/Tests/RunCMake/load_cache/RunCMakeTest.cmake new file mode 100644 index 0000000..a0d54ea --- /dev/null +++ b/Tests/RunCMake/load_cache/RunCMakeTest.cmake @@ -0,0 +1,13 @@ +include(RunCMake) + +file(WRITE ${RunCMake_BINARY_DIR}/test_project/CMakeCache.txt [[ +CACHE_STRING:STRING=cache string +CACHE_BOOL:BOOL=ON +CACHE_INTERNAL:INTERNAL=cache internal +]]) + +run_cmake(NewForm_Project) +run_cmake_command(NewForm_Script ${CMAKE_COMMAND} -DRunCMake_BINARY_DIR=${RunCMake_BINARY_DIR} + -P "${RunCMake_SOURCE_DIR}/NewForm_Script.cmake") +run_cmake_command(OldForm_Script ${CMAKE_COMMAND} -DRunCMake_BINARY_DIR=${RunCMake_BINARY_DIR} + -P "${RunCMake_SOURCE_DIR}/OldForm_Script.cmake") diff --git a/Tests/RunCMake/try_compile/ObjCStandard-result.txt b/Tests/RunCMake/try_compile/ObjCStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt new file mode 100644 index 0000000..f1b4df9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): + OBJC_STANDARD is set to invalid value '3' ++ +CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\): + Failed to generate test project build system. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake new file mode 100644 index 0000000..b2066f9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake @@ -0,0 +1,7 @@ +enable_language(OBJC) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m + OBJC_STANDARD 3 + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt new file mode 100644 index 0000000..a2f91b4 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt @@ -0,0 +1,7 @@ +^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\): + OBJCXX_STANDARD is set to invalid value '3' ++ +CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\): + Failed to generate test project build system. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake new file mode 100644 index 0000000..1221805 --- /dev/null +++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake @@ -0,0 +1,7 @@ +enable_language(OBJCXX) +try_compile(result ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm + OBJCXX_STANDARD 3 + OUTPUT_VARIABLE out + ) +message("try_compile output:\n${out}") diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 77fb7a0..91f014e 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -37,11 +37,17 @@ if(CMAKE_C_STANDARD_DEFAULT) elseif(DEFINED CMAKE_C_STANDARD_DEFAULT) run_cmake(CStandardNoDefault) endif() +if(CMAKE_OBJC_STANDARD_DEFAULT) + run_cmake(ObjCStandard) +endif() if(CMAKE_CXX_STANDARD_DEFAULT) run_cmake(CxxStandard) elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT) run_cmake(CxxStandardNoDefault) endif() +if(CMAKE_OBJCXX_STANDARD_DEFAULT) + run_cmake(ObjCxxStandard) +endif() if(CMake_TEST_CUDA) if(CMAKE_HOST_WIN32) run_cmake(CudaStandardNoDefault) diff --git a/Tests/RunCMake/try_compile/src.m b/Tests/RunCMake/try_compile/src.m new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/try_compile/src.m @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/src.mm b/Tests/RunCMake/try_compile/src.mm new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/try_compile/src.mm @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/StagingPrefix/CMakeLists.txt b/Tests/StagingPrefix/CMakeLists.txt index 8d2519e..9ed5c12 100644 --- a/Tests/StagingPrefix/CMakeLists.txt +++ b/Tests/StagingPrefix/CMakeLists.txt @@ -5,7 +5,7 @@ project(StagingPrefix) # Wipe out the install tree add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/CleanupProject - COMMAND ${CMAKE_COMMAND} -E remove_directory + COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/ConsumerBuild ${CMAKE_BINARY_DIR}/ProducerBuild ${CMAKE_BINARY_DIR}/stage diff --git a/Tests/SubDir/Examples/example1/CMakeLists.txt b/Tests/SubDir/Examples/example1/CMakeLists.txt index 20d065e..8ec1c02 100644 --- a/Tests/SubDir/Examples/example1/CMakeLists.txt +++ b/Tests/SubDir/Examples/example1/CMakeLists.txt @@ -3,5 +3,5 @@ project(example1) add_executable(example1 example1.cxx) add_custom_command(TARGET example1 POST_BUILD - COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere + COMMAND "${CMAKE_COMMAND}" ARGS -E rm -f ${SUBDIR_BINARY_DIR}/ShouldBeHere COMMENT "Remove marker file that should exist because this should not be run") diff --git a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt index 20d065e..8ec1c02 100644 --- a/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt +++ b/Tests/SubDirSpaces/Some Examples/example1/CMakeLists.txt @@ -3,5 +3,5 @@ project(example1) add_executable(example1 example1.cxx) add_custom_command(TARGET example1 POST_BUILD - COMMAND "${CMAKE_COMMAND}" ARGS -E remove ${SUBDIR_BINARY_DIR}/ShouldBeHere + COMMAND "${CMAKE_COMMAND}" ARGS -E rm -f ${SUBDIR_BINARY_DIR}/ShouldBeHere COMMENT "Remove marker file that should exist because this should not be run") diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 498e556..9ec9b70 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -365,6 +365,25 @@ if (APPLE) TEST_ASSERT(SIMPLE_OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") TEST_FAIL(OBJCXX_RUN_SHOULD_FAIL "CHECK_OBJCXX_SOURCE_RUNS() succeeds, but should have failed") TEST_ASSERT(OBJCXX_RUN_SHOULD_WORK "CHECK_OBJCXX_SOURCE_RUNS() failed, but should have succeeded") + + # try to compile a file that should compile + try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/pass.m + OUTPUT_VARIABLE TRY_OUT) + if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") + endif() + + # try to compile a file that should not compile + try_compile(SHOULD_FAIL + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/fail.m + OUTPUT_VARIABLE TRY_OUT) + if(SHOULD_FAIL) + message(SEND_ERROR "Should fail passed ${TRY_OUT}") + endif() + endif() ####################################################################### diff --git a/Tests/TryCompile/fail.m b/Tests/TryCompile/fail.m new file mode 100644 index 0000000..b915ebe --- /dev/null +++ b/Tests/TryCompile/fail.m @@ -0,0 +1 @@ +asdflkjasdlj diff --git a/Tests/TryCompile/pass.m b/Tests/TryCompile/pass.m new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/TryCompile/pass.m @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/VSMidl/CMakeLists.txt b/Tests/VSMidl/CMakeLists.txt index 432506c..3ff7c27 100644 --- a/Tests/VSMidl/CMakeLists.txt +++ b/Tests/VSMidl/CMakeLists.txt @@ -56,8 +56,8 @@ set(source_dir "${base_dir}/src") # ExternalProject_Add(clean-${PROJECT_NAME} DOWNLOAD_COMMAND "" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${source_dir}" - BUILD_COMMAND ${CMAKE_COMMAND} -E remove_directory "${binary_dir}" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E rm -rf "${source_dir}" + BUILD_COMMAND ${CMAKE_COMMAND} -E rm -rf "${binary_dir}" INSTALL_COMMAND "" ) |