diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-03-18 21:25:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-20 15:39:14 (GMT) |
commit | b172a81d5512a2f0973dae6d5545b159e5b1ec2b (patch) | |
tree | b035bb75e4ac6c2ad13663a2b8ba514cecc4ea5e /Source/CTest | |
parent | 46090c2337f9d867b8662247f0033f002742d42b (diff) | |
download | CMake-b172a81d5512a2f0973dae6d5545b159e5b1ec2b.zip CMake-b172a81d5512a2f0973dae6d5545b159e5b1ec2b.tar.gz CMake-b172a81d5512a2f0973dae6d5545b159e5b1ec2b.tar.bz2 |
cmCTest: Use concrete accessor functions for TestingHandlers
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageCommand.cxx | 8 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckCommand.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 35 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateCommand.cxx | 10 | ||||
-rw-r--r-- | Source/CTest/cmCTestUploadCommand.cxx | 12 |
9 files changed, 34 insertions, 69 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 32f7496..2eacaf1 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -4,7 +4,6 @@ #include "cmCTest.h" #include "cmCTestBuildHandler.h" -#include "cmCTestGenericHandler.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -39,12 +38,10 @@ cmCTestBuildCommand::~cmCTestBuildCommand() cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() { - cmCTestGenericHandler* handler = this->CTest->GetInitializedHandler("build"); - if (!handler) { - this->SetError("internal CTest error. Cannot instantiate build handler"); - return nullptr; - } - this->Handler = static_cast<cmCTestBuildHandler*>(handler); + cmCTestBuildHandler* handler = this->CTest->GetBuildHandler(); + handler->Initialize(); + + this->Handler = handler; const char* ctestBuildCommand = this->Makefile->GetDefinition("CTEST_BUILD_COMMAND"); diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 7b5c3bc..74a932a 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -3,7 +3,7 @@ #include "cmCTestConfigureCommand.h" #include "cmCTest.h" -#include "cmCTestGenericHandler.h" +#include "cmCTestConfigureHandler.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -142,13 +142,8 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() labelsForSubprojects, this->Quiet); } - cmCTestGenericHandler* handler = - this->CTest->GetInitializedHandler("configure"); - if (!handler) { - this->SetError( - "internal CTest error. Cannot instantiate configure handler"); - return nullptr; - } + cmCTestConfigureHandler* handler = this->CTest->GetConfigureHandler(); + handler->Initialize(); handler->SetQuiet(this->Quiet); return handler; } diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index d2003ba..07aae76 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -19,12 +19,8 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() this->CTest->SetCTestConfigurationFromCMakeVariable( this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS", this->Quiet); - cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>( - this->CTest->GetInitializedHandler("coverage")); - if (!handler) { - this->SetError("internal CTest error. Cannot instantiate test handler"); - return nullptr; - } + cmCTestCoverageHandler* handler = this->CTest->GetCoverageHandler(); + handler->Initialize(); // If a LABELS option was given, select only files with the labels. if (this->LabelsMentioned) { diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index a5d5995..7dad1ce 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -7,7 +7,6 @@ #include <vector> #include "cmCTest.h" -#include "cmCTestGenericHandler.h" #include "cmCTestMemCheckHandler.h" #include "cmMakefile.h" @@ -20,8 +19,8 @@ cmCTestMemCheckCommand::cmCTestMemCheckCommand() cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler() { - cmCTestGenericHandler* handler = - this->CTest->GetInitializedHandler("memcheck"); + cmCTestMemCheckHandler* handler = this->CTest->GetMemCheckHandler(); + handler->Initialize(); this->CTest->SetCTestConfigurationFromCMakeVariable( this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet); diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 00c0610..a3aa7aa 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -3,7 +3,6 @@ #include "cmCTestSubmitCommand.h" #include "cmCTest.h" -#include "cmCTestGenericHandler.h" #include "cmCTestSubmitHandler.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -63,12 +62,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() } } - cmCTestGenericHandler* handler = - this->CTest->GetInitializedHandler("submit"); - if (!handler) { - this->SetError("internal CTest error. Cannot instantiate submit handler"); - return nullptr; - } + cmCTestSubmitHandler* handler = this->CTest->GetSubmitHandler(); + handler->Initialize(); // If no FILES or PARTS given, *all* PARTS are submitted by default. // @@ -90,38 +85,30 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() // But FILES with no PARTS mentioned should just submit the FILES // without any of the default parts. // - std::set<cmCTest::Part> noParts; - static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts); - - static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files); + handler->SelectParts(std::set<cmCTest::Part>()); + handler->SelectFiles(this->Files); } // If a PARTS option was given, select only the named parts for submission. // if (this->PartsMentioned) { - static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts); + handler->SelectParts(this->Parts); } // Pass along any HTTPHEADER to the handler if this option was given. if (!this->HttpHeaders.empty()) { - static_cast<cmCTestSubmitHandler*>(handler)->SetHttpHeaders( - this->HttpHeaders); + handler->SetHttpHeaders(this->HttpHeaders); } - static_cast<cmCTestSubmitHandler*>(handler)->SetOption( - "RetryDelay", this->RetryDelay.c_str()); - static_cast<cmCTestSubmitHandler*>(handler)->SetOption( - "RetryCount", this->RetryCount.c_str()); - static_cast<cmCTestSubmitHandler*>(handler)->SetOption( - "InternalTest", this->InternalTest ? "ON" : "OFF"); + handler->SetOption("RetryDelay", this->RetryDelay.c_str()); + handler->SetOption("RetryCount", this->RetryCount.c_str()); + handler->SetOption("InternalTest", this->InternalTest ? "ON" : "OFF"); handler->SetQuiet(this->Quiet); if (this->CDashUpload) { - static_cast<cmCTestSubmitHandler*>(handler)->SetOption( - "CDashUploadFile", this->CDashUploadFile.c_str()); - static_cast<cmCTestSubmitHandler*>(handler)->SetOption( - "CDashUploadType", this->CDashUploadType.c_str()); + handler->SetOption("CDashUploadFile", this->CDashUploadFile.c_str()); + handler->SetOption("CDashUploadType", this->CDashUploadType.c_str()); } return handler; } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1539635..c3f7fb4 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -259,8 +259,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( upload_as += ctest_curl.Escape(this->CTest->GetCurrentTag()); upload_as += "-"; upload_as += ctest_curl.Escape(this->CTest->GetTestModelString()); - cmCTestScriptHandler* ch = static_cast<cmCTestScriptHandler*>( - this->CTest->GetHandler("script")); + cmCTestScriptHandler* ch = this->CTest->GetScriptHandler(); cmake* cm = ch->GetCMake(); if (cm) { const char* subproject = @@ -558,8 +557,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, // has already been uploaded // TODO I added support for subproject. You would need to add // a "&subproject=subprojectname" to the first POST. - cmCTestScriptHandler* ch = - static_cast<cmCTestScriptHandler*>(this->CTest->GetHandler("script")); + cmCTestScriptHandler* ch = this->CTest->GetScriptHandler(); cmake* cm = ch->GetCMake(); const char* subproject = cm->GetState()->GetGlobalProperty("SubProject"); // TODO: Encode values for a URL instead of trusting caller. diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 895ca12..cfd5e3d 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -4,6 +4,7 @@ #include "cmCTest.h" #include "cmCTestGenericHandler.h" +#include "cmCTestTestHandler.h" #include "cmDuration.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -140,5 +141,7 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() cmCTestGenericHandler* cmCTestTestCommand::InitializeActualHandler() { - return this->CTest->GetInitializedHandler("test"); + cmCTestTestHandler* handler = this->CTest->GetTestHandler(); + handler->Initialize(); + return handler; } diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 3d800f8..a2f1462 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -3,7 +3,7 @@ #include "cmCTestUpdateCommand.h" #include "cmCTest.h" -#include "cmCTestGenericHandler.h" +#include "cmCTestUpdateHandler.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -74,12 +74,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() this->CTest->SetCTestConfigurationFromCMakeVariable( this->Makefile, "P4Options", "CTEST_P4_OPTIONS", this->Quiet); - cmCTestGenericHandler* handler = - this->CTest->GetInitializedHandler("update"); - if (!handler) { - this->SetError("internal CTest error. Cannot instantiate update handler"); - return nullptr; - } + cmCTestUpdateHandler* handler = this->CTest->GetUpdateHandler(); + handler->Initialize(); handler->SetCommand(this); if (source_dir.empty()) { this->SetError("source directory not specified. Please use SOURCE tag"); diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 2fe2cd3..59fbf37 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -6,7 +6,6 @@ #include <vector> #include "cmCTest.h" -#include "cmCTestGenericHandler.h" #include "cmCTestUploadHandler.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -14,14 +13,9 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() { - cmCTestGenericHandler* handler = - this->CTest->GetInitializedHandler("upload"); - if (!handler) { - this->SetError("internal CTest error. Cannot instantiate upload handler"); - return nullptr; - } - static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files); - + cmCTestUploadHandler* handler = this->CTest->GetUploadHandler(); + handler->Initialize(); + handler->SetFiles(this->Files); handler->SetQuiet(this->Quiet); return handler; } |