diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-05-10 09:36:08 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-05-10 09:36:32 (GMT) |
commit | da30ba3ab836df94ea973b3e33ac2980ff1f47c9 (patch) | |
tree | 31fcf2bdcba7e98cc0a4aaec39f61483e10134ce /Source | |
parent | 5498cb7cdba29fb434208f08bf295c85d0ecc4a0 (diff) | |
parent | 9deaf07597a561047d9b9bd3122b948e060682f7 (diff) | |
download | CMake-da30ba3ab836df94ea973b3e33ac2980ff1f47c9.zip CMake-da30ba3ab836df94ea973b3e33ac2980ff1f47c9.tar.gz CMake-da30ba3ab836df94ea973b3e33ac2980ff1f47c9.tar.bz2 |
Merge topic 'ctest-start-args-rework'
9deaf07597 Help: add release notes for ctest_start() changes
563781099f ctest_start: read model from TAG file
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2036
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 73 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 60 | ||||
-rw-r--r-- | Source/cmCTest.h | 7 |
3 files changed, 105 insertions, 35 deletions
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 38ee623..367616c 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -28,41 +28,41 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, } size_t cnt = 0; - const char* smodel = args[cnt].c_str(); + const char* smodel = nullptr; const char* src_dir = nullptr; const char* bld_dir = nullptr; - cnt++; - - this->CTest->SetSpecificTrack(nullptr); - if (cnt < args.size() - 1) { + while (cnt < args.size()) { if (args[cnt] == "TRACK") { cnt++; + if (cnt >= args.size() || args[cnt] == "APPEND" || + args[cnt] == "QUIET") { + this->SetError("TRACK argument missing track name"); + return false; + } this->CTest->SetSpecificTrack(args[cnt].c_str()); cnt++; - } - } - - if (cnt < args.size()) { - if (args[cnt] == "APPEND") { + } else if (args[cnt] == "APPEND") { cnt++; this->CreateNewTag = false; - } - } - if (cnt < args.size()) { - if (args[cnt] == "QUIET") { + } else if (args[cnt] == "QUIET") { cnt++; this->Quiet = true; - } - } - - if (cnt < args.size()) { - src_dir = args[cnt].c_str(); - cnt++; - if (cnt < args.size()) { + } else if (!smodel) { + smodel = args[cnt].c_str(); + cnt++; + } else if (!src_dir) { + src_dir = args[cnt].c_str(); + cnt++; + } else if (!bld_dir) { bld_dir = args[cnt].c_str(); + cnt++; + } else { + this->SetError("Too many arguments"); + return false; } } + if (!src_dir) { src_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"); } @@ -79,6 +79,11 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, "as an argument or set CTEST_BINARY_DIRECTORY"); return false; } + if (!smodel && this->CreateNewTag) { + this->SetError("no test model specified and APPEND not specified. Specify " + "either a test model or the APPEND argument"); + return false; + } cmSystemTools::AddKeepPath(src_dir); cmSystemTools::AddKeepPath(bld_dir); @@ -92,11 +97,20 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str(), this->Quiet); - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " - << smodel << std::endl - << " Source directory: " << src_dir << std::endl - << " Build directory: " << bld_dir << std::endl, - this->Quiet); + if (smodel) { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model " + << smodel << std::endl + << " Source directory: " << src_dir << std::endl + << " Build directory: " << bld_dir << std::endl, + this->Quiet); + } else { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with " + "to-be-determined model" + << std::endl + << " Source directory: " << src_dir << std::endl + << " Build directory: " << bld_dir << std::endl, + this->Quiet); + } const char* track = this->CTest->GetSpecificTrack(); if (track) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, @@ -128,7 +142,12 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, this->CTest->SetRunCurrentScript(false); this->CTest->SetSuppressUpdatingCTestConfiguration(true); - int model = this->CTest->GetTestModelFromString(smodel); + int model; + if (smodel) { + model = this->CTest->GetTestModelFromString(smodel); + } else { + model = cmCTest::UNKNOWN; + } this->CTest->SetTestModel(model); this->CTest->SetProduceXML(true); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 3fccc38..2c32dea 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -474,11 +474,13 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) day != lctime->tm_mday) { tag.clear(); } - std::string tagmode; - if (cmSystemTools::GetLineFromStream(tfin, tagmode)) { - if (tagmode.size() > 4 && !this->Parts[PartStart]) { - this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str()); - } + std::string track; + if (cmSystemTools::GetLineFromStream(tfin, track)) { + this->SpecificTrack = track; + } + std::string model; + if (cmSystemTools::GetLineFromStream(tfin, model)) { + this->TestModel = GetTestModelFromString(model.c_str()); } tfin.close(); } @@ -502,6 +504,17 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) if (ofs) { ofs << tag << std::endl; ofs << this->GetTestModelString() << std::endl; + switch (this->TestModel) { + case cmCTest::EXPERIMENTAL: + ofs << "Experimental" << std::endl; + break; + case cmCTest::NIGHTLY: + ofs << "Nightly" << std::endl; + break; + case cmCTest::CONTINUOUS: + ofs << "Continuous" << std::endl; + break; + } } ofs.close(); if (nullptr == command) { @@ -512,8 +525,16 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } } } else { + std::string track; + std::string modelStr; + int model = cmCTest::UNKNOWN; + if (tfin) { cmSystemTools::GetLineFromStream(tfin, tag); + cmSystemTools::GetLineFromStream(tfin, track); + if (cmSystemTools::GetLineFromStream(tfin, modelStr)) { + model = GetTestModelFromString(modelStr.c_str()); + } tfin.close(); } @@ -523,6 +544,35 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) return 0; } + if (this->TestModel == cmCTest::UNKNOWN) { + if (model == cmCTest::UNKNOWN) { + cmCTestLog(this, ERROR_MESSAGE, + "TAG file does not contain model and " + "no model specified in start command" + << std::endl); + return 0; + } + + this->SetTestModel(model); + } + + if (model != this->TestModel && model != cmCTest::UNKNOWN && + this->TestModel != cmCTest::UNKNOWN) { + cmCTestOptionalLog(this, WARNING, "Model given in TAG does not match " + "model given in ctest_start()" + << std::endl, + quiet); + } + + if (!this->SpecificTrack.empty() && track != this->SpecificTrack) { + cmCTestOptionalLog(this, WARNING, "Track given in TAG does not match " + "track given in ctest_start()" + << std::endl, + quiet); + } else { + this->SpecificTrack = track; + } + cmCTestOptionalLog(this, OUTPUT, " Use existing tag: " << tag << " - " << this->GetTestModelString() << std::endl, diff --git a/Source/cmCTest.h b/Source/cmCTest.h index b2f4f25..603bb41 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -295,9 +295,10 @@ public: enum { - EXPERIMENTAL, - NIGHTLY, - CONTINUOUS + UNKNOWN = -1, + EXPERIMENTAL = 0, + NIGHTLY = 1, + CONTINUOUS = 2, }; /** provide some more detailed info on the return code for ctest */ |