diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-05-03 20:42:09 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-05-09 12:22:55 (GMT) |
commit | 563781099f08ce36c2213066936806e8bb78b933 (patch) | |
tree | 0c9ea78ceca5c3aa3583c66d27edc6ae3ba9c1c4 /Source/CTest | |
parent | d3292d2d102710cb66d933dc27d72e3002d008b9 (diff) | |
download | CMake-563781099f08ce36c2213066936806e8bb78b933.zip CMake-563781099f08ce36c2213066936806e8bb78b933.tar.gz CMake-563781099f08ce36c2213066936806e8bb78b933.tar.bz2 |
ctest_start: read model from TAG file
This change reworks ctest_start() so that simply calling
ctest_start(APPEND) will read all the information from the TAG file.
On top of that, it relaxes the argument parsing for ctest_start() to
allow greater flexibility in the argument ordering, and the documentation
for ctest_start() has been cleaned up.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 73 |
1 files changed, 46 insertions, 27 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); |