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/cmCTest.cxx | |
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/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 60 |
1 files changed, 55 insertions, 5 deletions
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, |