From 563781099f08ce36c2213066936806e8bb78b933 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Thu, 3 May 2018 16:42:09 -0400 Subject: 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. --- Help/command/ctest_start.rst | 89 ++++++++++++++++++---- Source/CTest/cmCTestStartCommand.cxx | 73 +++++++++++------- Source/cmCTest.cxx | 60 +++++++++++++-- Source/cmCTest.h | 7 +- .../ctest_start/AppendDifferentModel-check.cmake | 1 + .../ctest_start/AppendDifferentModel-stderr.txt | 1 + .../ctest_start/AppendDifferentModel-stdout.txt | 8 ++ .../ctest_start/AppendDifferentTrack-stderr.txt | 1 + .../ctest_start/AppendDifferentTrack-stdout.txt | 9 +++ .../ctest_start/AppendNoMatchingTrack-stdout.txt | 8 ++ .../RunCMake/ctest_start/AppendNoModel-check.cmake | 1 + .../RunCMake/ctest_start/AppendNoModel-stdout.txt | 8 ++ .../ctest_start/AppendOldContinuous-stdout.txt | 8 ++ .../ctest_start/AppendOldNoModel-result.txt | 1 + .../ctest_start/AppendOldNoModel-stderr.txt | 3 + .../ctest_start/AppendOldNoModel-stdout.txt | 6 ++ .../ctest_start/AppendSameModel-check.cmake | 1 + .../ctest_start/AppendSameModel-stdout.txt | 8 ++ .../ctest_start/MissingTrackArg-result.txt | 1 + .../ctest_start/MissingTrackArg-stderr.txt | 2 + .../ctest_start/MissingTrackArgAppend-result.txt | 1 + .../ctest_start/MissingTrackArgAppend-stderr.txt | 2 + .../ctest_start/MissingTrackArgQuiet-result.txt | 1 + .../ctest_start/MissingTrackArgQuiet-stderr.txt | 2 + Tests/RunCMake/ctest_start/NoModel-result.txt | 1 + Tests/RunCMake/ctest_start/NoModel-stderr.txt | 3 + Tests/RunCMake/ctest_start/RunCMakeTest.cmake | 33 +++++++- Tests/RunCMake/ctest_start/TooManyArgs-result.txt | 1 + Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt | 2 + .../WriteModelToTagContinuous-check.cmake | 1 + .../WriteModelToTagExperimental-check.cmake | 1 + .../ctest_start/WriteModelToTagNightly-check.cmake | 1 + .../WriteModelToTagNoMatchingTrack-check.cmake | 1 + Tests/RunCMake/ctest_start/test.cmake.in | 12 +++ 34 files changed, 305 insertions(+), 53 deletions(-) create mode 100644 Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake create mode 100644 Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendNoModel-check.cmake create mode 100644 Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt create mode 100644 Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/AppendSameModel-check.cmake create mode 100644 Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArg-result.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt create mode 100644 Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/NoModel-result.txt create mode 100644 Tests/RunCMake/ctest_start/NoModel-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/TooManyArgs-result.txt create mode 100644 Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt create mode 100644 Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake create mode 100644 Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake create mode 100644 Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake create mode 100644 Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake diff --git a/Help/command/ctest_start.rst b/Help/command/ctest_start.rst index 63db32f..6db9a48 100644 --- a/Help/command/ctest_start.rst +++ b/Help/command/ctest_start.rst @@ -5,21 +5,78 @@ Starts the testing for a given model :: - ctest_start(Model [TRACK ] [APPEND] [source [binary]] [QUIET]) + ctest_start( [ []] [TRACK ] [QUIET]) + + ctest_start([ [ []]] [TRACK ] APPEND [QUIET]) Starts the testing for a given model. The command should be called -after the binary directory is initialized. If the 'source' and -'binary' directory are not specified, it reads the -:variable:`CTEST_SOURCE_DIRECTORY` and :variable:`CTEST_BINARY_DIRECTORY`. -If the track is -specified, the submissions will go to the specified track. If APPEND -is used, the existing TAG is used rather than creating a new one based -on the current time stamp. If ``QUIET`` is used, CTest will suppress any -non-error messages that it otherwise would have printed to the console. - -If the :variable:`CTEST_CHECKOUT_COMMAND` variable -(or the :variable:`CTEST_CVS_CHECKOUT` variable) -is set, its content is treated as command-line. The command is -invoked with the current working directory set to the parent of the source -directory, even if the source directory already exists. This can be used -to create the source tree from a version control repository. +after the binary directory is initialized. + +The parameters are as follows: + +```` + Set the dashboard model. Must be one of ``Experimental``, ``Continuous``, or + ``Nightly``. This parameter is required unless ``APPEND`` is specified. + +```` + Set the source directory. If not specified, the value of + :variable:`CTEST_SOURCE_DIRECTORY` is used instead. + +```` + Set the binary directory. If not specified, the value of + :variable:`CTEST_BINARY_DIRECTORY` is used instead. + +``TRACK `` + If ``TRACK`` is used, the submissions will go to the specified track on the + CDash server. If no ``TRACK`` is specified, the name of the model is used by + default. + +``APPEND`` + If ``APPEND`` is used, the existing ``TAG`` is used rather than creating a new + one based on the current time stamp. If you use ``APPEND``, you can omit the + ```` and ``TRACK `` parameters, because they will be read from + the generated ``TAG`` file. For example: + + .. code-block:: cmake + + ctest_start(Experimental TRACK TrackExperimental) + + Later, in another ``ctest -S`` script: + + .. code-block:: cmake + + ctest_start(APPEND) + + When the second script runs ``ctest_start(APPEND)``, it will read the + ``Experimental`` model and ``TrackExperimental`` track from the ``TAG`` file + generated by the first ``ctest_start()`` command. Please note that if you + call ``ctest_start(APPEND)`` and specify a different model or track than + in the first ``ctest_start()`` command, a warning will be issued, and the + new model and track will be used. + +``QUIET`` + If ``QUIET`` is used, CTest will suppress any non-error messages that it + otherwise would have printed to the console. + +The parameters for ``ctest_start()`` can be issued in any order, with the +exception that ````, ````, and ```` have to appear +in that order with respect to each other. The following are all valid and +equivalent: + +.. code-block:: cmake + + ctest_start(Experimental path/to/source path/to/binary TRACK SomeTrack QUIET APPEND) + + ctest_start(TRACK SomeTrack Experimental QUIET path/to/source APPEND path/to/binary) + + ctest_start(APPEND QUIET Experimental path/to/source TRACK SomeTrack path/to/binary) + +However, for the sake of readability, it is recommended that you order your +parameters in the order listed at the top of this page. + +If the :variable:`CTEST_CHECKOUT_COMMAND` variable (or the +:variable:`CTEST_CVS_CHECKOUT` variable) is set, its content is treated as +command-line. The command is invoked with the current working directory set +to the parent of the source directory, even if the source directory already +exists. This can be used to create the source tree from a version control +repository. 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 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 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 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 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 */ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake b/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt b/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt new file mode 100644 index 0000000..a523f3f --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-stderr.txt @@ -0,0 +1 @@ +^Model given in TAG does not match model given in ctest_start\(\)$ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt new file mode 100644 index 0000000..bc9a4c8 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Experimental + Source directory: .*/Tests/RunCMake/ctest_start/AppendDifferentModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendDifferentModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendDifferentModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt new file mode 100644 index 0000000..0d6d19d --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stderr.txt @@ -0,0 +1 @@ +^Track given in TAG does not match track given in ctest_start\(\)$ diff --git a/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt new file mode 100644 index 0000000..ab1c1f7 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendDifferentTrack-stdout.txt @@ -0,0 +1,9 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack + Build directory: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack-build + Track: ExperimentalDifferent + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendDifferentTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ExperimentalDifferent + Use ExperimentalDifferent tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt b/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt new file mode 100644 index 0000000..55f2d8e --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack + Build directory: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendNoMatchingTrack/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - SomeWeirdTrackName + Use SomeWeirdTrackName tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake b/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt new file mode 100644 index 0000000..f909a44 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendNoModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendNoModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendNoModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendNoModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt b/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt new file mode 100644 index 0000000..0660f5d --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldContinuous-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendOldContinuous + Build directory: .*/Tests/RunCMake/ctest_start/AppendOldContinuous-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendOldContinuous/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: 19551112-2204 diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt new file mode 100644 index 0000000..c7ca1e7 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-stderr.txt @@ -0,0 +1,3 @@ +^TAG file does not contain model and no model specified in start command +CMake Error at .*/Tests/RunCMake/ctest_start/AppendOldNoModel/test.cmake:[0-9]+ \(ctest_start\): + ctest_start unknown error.$ diff --git a/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt new file mode 100644 index 0000000..0bdf9e4 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendOldNoModel-stdout.txt @@ -0,0 +1,6 @@ +Run dashboard with to-be-determined model + Source directory: .*/Tests/RunCMake/ctest_start/AppendOldNoModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendOldNoModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendOldNoModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name diff --git a/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake b/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake new file mode 100644 index 0000000..d71b1cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendSameModel-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^19551112-2204\nContinuousTrack\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt b/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt new file mode 100644 index 0000000..4f43626 --- /dev/null +++ b/Tests/RunCMake/ctest_start/AppendSameModel-stdout.txt @@ -0,0 +1,8 @@ +Run dashboard with model Continuous + Source directory: .*/Tests/RunCMake/ctest_start/AppendSameModel + Build directory: .*/Tests/RunCMake/ctest_start/AppendSameModel-build + Reading ctest configuration file: .*/Tests/RunCMake/ctest_start/AppendSameModel/CTestConfig.cmake + Site: test-site + Build name: test-build-name + Use existing tag: 19551112-2204 - ContinuousTrack + Use ContinuousTrack tag: [0-9-]+ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArg-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt new file mode 100644 index 0000000..7b42bc9 --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArg-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArg/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt new file mode 100644 index 0000000..695bfad --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgAppend-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArgAppend/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt new file mode 100644 index 0000000..9438522 --- /dev/null +++ b/Tests/RunCMake/ctest_start/MissingTrackArgQuiet-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/MissingTrackArgQuiet/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start TRACK argument missing track name$ diff --git a/Tests/RunCMake/ctest_start/NoModel-result.txt b/Tests/RunCMake/ctest_start/NoModel-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoModel-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/NoModel-stderr.txt b/Tests/RunCMake/ctest_start/NoModel-stderr.txt new file mode 100644 index 0000000..a516cf8 --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoModel-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/NoModel/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start no test model specified and APPEND not specified. Specify + either a test model or the APPEND argument$ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index bf47256..2e8aa75 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -7,11 +7,40 @@ function(run_ctest_start CASE_NAME) run_ctest(${CASE_NAME}) endfunction() -run_ctest_start(StartQuiet Experimental QUIET) +function(check_tag_contents EXPECTED) + set(_tag_file "${RunCMake_BINARY_DIR}/${CASE_NAME}-build/Testing/TAG") + if(EXISTS "${_tag_file}") + file(READ "${_tag_file}" _tag_contents) + if(NOT _tag_contents MATCHES "${EXPECTED}") + set(RunCMake_TEST_FAILED "Testing/TAG file does not match expected value.\nActual TAG file:\n${_tag_contents}\nExpected TAG file:\n${EXPECTED}\n" PARENT_SCOPE) + endif() + else() + set(RunCMake_TEST_FAILED "Testing/TAG file does not exist." PARENT_SCOPE) + endif() +endfunction() +run_ctest_start(StartQuiet Experimental QUIET) run_ctest_start(ConfigInSource Experimental) - run_ctest_start(FunctionScope Experimental QUIET) +run_ctest_start(WriteModelToTagExperimental Experimental QUIET) +run_ctest_start(WriteModelToTagContinuous Continuous QUIET) +run_ctest_start(WriteModelToTagNightly Nightly QUIET) +run_ctest_start(WriteModelToTagNoMatchingTrack Continuous TRACK SomeWeirdTrackName QUIET) +run_ctest_start(AppendSameModel Continuous APPEND) +run_ctest_start(AppendDifferentModel Experimental APPEND) +run_ctest_start(AppendNoModel APPEND) +run_ctest_start(AppendDifferentTrack TRACK ExperimentalDifferent APPEND) +run_ctest_start(AppendNoMatchingTrack Continuous APPEND) +run_ctest_start(AppendOldContinuous Continuous APPEND) +run_ctest_start(AppendOldNoModel APPEND) +run_ctest_start(NoModel QUIET) +run_ctest_start(MissingTrackArg Experimental TRACK) +run_ctest_start(MissingTrackArgAppend Experimental TRACK APPEND) +run_ctest_start(MissingTrackArgQuiet Experimental TRACK QUIET) +run_ctest_start(TooManyArgs Experimental + ${RunCMake_BINARY_DIR}/TooManyArgs-build + ${RunCMake_BINARY_DIR}/TooManyArgs-build + ${RunCMake_BINARY_DIR}/TooManyArgs-build) function(run_ConfigInBuild) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) diff --git a/Tests/RunCMake/ctest_start/TooManyArgs-result.txt b/Tests/RunCMake/ctest_start/TooManyArgs-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/TooManyArgs-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt b/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt new file mode 100644 index 0000000..c1d5f22 --- /dev/null +++ b/Tests/RunCMake/ctest_start/TooManyArgs-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error at .*/Tests/RunCMake/ctest_start/TooManyArgs/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start Too many arguments$ diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake new file mode 100644 index 0000000..4e67bf5 --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagContinuous-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nContinuous\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake new file mode 100644 index 0000000..b5bf2cf --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagExperimental-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nExperimental\nExperimental\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake new file mode 100644 index 0000000..35d0566 --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagNightly-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nNightly\nNightly\n$") diff --git a/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake b/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake new file mode 100644 index 0000000..bd2862d --- /dev/null +++ b/Tests/RunCMake/ctest_start/WriteModelToTagNoMatchingTrack-check.cmake @@ -0,0 +1 @@ +check_tag_contents("^[0-9-]+\nSomeWeirdTrackName\nContinuous\n$") diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 0a27942..172baf7 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -8,11 +8,23 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") function(setup_tests) ctest_start(${ctest_start_args}) endfunction() +if("@CASE_NAME@" MATCHES "^Append") + if("@CASE_NAME@" MATCHES "^AppendNoMatchingTrack$") + file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nSomeWeirdTrackName\n") + else() + file(WRITE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "19551112-2204\nContinuousTrack\n") + endif() + if(NOT "@CASE_NAME@" MATCHES "^AppendOld") + file(APPEND "${CTEST_BINARY_DIRECTORY}/Testing/TAG" "Continuous\n") + endif() +endif() + set(ctest_start_args "@CASE_CTEST_START_ARGS@") if("@CASE_NAME@" STREQUAL "FunctionScope") setup_tests() -- cgit v0.12