diff options
author | Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> | 2016-06-28 22:04:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-07-05 15:19:00 (GMT) |
commit | 280d0a6947aee7d73404a3d5d0a795d490a781db (patch) | |
tree | ebb63d3b0a73e96147759dcddaca2943d9640abb /Source/cmCTest.cxx | |
parent | 898cb987b4a2ed027f7ec9308a128cab97feabf9 (diff) | |
download | CMake-280d0a6947aee7d73404a3d5d0a795d490a781db.zip CMake-280d0a6947aee7d73404a3d5d0a795d490a781db.tar.gz CMake-280d0a6947aee7d73404a3d5d0a795d490a781db.tar.bz2 |
cmCTest: Improve readability adding "RunCMakeAndTest()" and "ExecuteTests()"
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 118 |
1 files changed, 64 insertions, 54 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 59a58d0..9c6117a 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2134,70 +2134,80 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // now what should cmake do? if --build-and-test was specified then // we run the build and test handler and return if (cmakeAndTest) { - this->Verbose = true; - cmCTestBuildAndTestHandler* handler = - static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest")); - int retv = handler->ProcessHandler(); - *output = handler->GetOutput(); -#ifdef CMAKE_BUILD_WITH_CMAKE - cmDynamicLoader::FlushCache(); -#endif - if (retv != 0) { - cmCTestLog(this, DEBUG, - "build and test failing returning: " << retv << std::endl); - } - return retv; + return this->RunCMakeAndTest(output); } if (executeTests) { - int res; - // call process directory - if (this->RunConfigurationScript) { - if (this->ExtraVerbose) { - cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl); - } - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); - it != this->TestingHandlers.end(); ++it) { - it->second->SetVerbose(this->ExtraVerbose); - it->second->SetSubmitIndex(this->SubmitIndex); - } - this->GetHandler("script")->SetVerbose(this->Verbose); - res = this->GetHandler("script")->ProcessHandler(); - if (res != 0) { - cmCTestLog(this, DEBUG, - "running script failing returning: " << res << std::endl); - } + return this->ExecuteTests(); + } - } else { - // What is this? -V seems to be the same as -VV, - // and Verbose is always on in this case - this->ExtraVerbose = this->Verbose; - this->Verbose = true; - cmCTest::t_TestingHandlers::iterator it; - for (it = this->TestingHandlers.begin(); - it != this->TestingHandlers.end(); ++it) { - it->second->SetVerbose(this->Verbose); - it->second->SetSubmitIndex(this->SubmitIndex); - } - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) { - res = 12; - cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." - << std::endl); - } else { - res = this->ProcessTests(); - } - this->Finalize(); + return 1; +} + +int cmCTest::ExecuteTests() +{ + int res; + // call process directory + if (this->RunConfigurationScript) { + if (this->ExtraVerbose) { + cmCTestLog(this, OUTPUT, "* Extra verbosity turned on" << std::endl); } + cmCTest::t_TestingHandlers::iterator it; + for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); + ++it) { + it->second->SetVerbose(this->ExtraVerbose); + it->second->SetSubmitIndex(this->SubmitIndex); + } + this->GetHandler("script")->SetVerbose(this->Verbose); + res = this->GetHandler("script")->ProcessHandler(); if (res != 0) { cmCTestLog(this, DEBUG, - "Running a test(s) failed returning : " << res << std::endl); + "running script failing returning: " << res << std::endl); + } + + } else { + // What is this? -V seems to be the same as -VV, + // and Verbose is always on in this case + this->ExtraVerbose = this->Verbose; + this->Verbose = true; + cmCTest::t_TestingHandlers::iterator it; + for (it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); + ++it) { + it->second->SetVerbose(this->Verbose); + it->second->SetSubmitIndex(this->SubmitIndex); + } + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + if (!this->Initialize(cwd.c_str(), CM_NULLPTR)) { + res = 12; + cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." + << std::endl); + } else { + res = this->ProcessTests(); } - return res; + this->Finalize(); } + if (res != 0) { + cmCTestLog(this, DEBUG, + "Running a test(s) failed returning : " << res << std::endl); + } + return res; +} - return 1; +int cmCTest::RunCMakeAndTest(std::string* output) +{ + this->Verbose = true; + cmCTestBuildAndTestHandler* handler = + static_cast<cmCTestBuildAndTestHandler*>(this->GetHandler("buildtest")); + int retv = handler->ProcessHandler(); + *output = handler->GetOutput(); +#ifdef CMAKE_BUILD_WITH_CMAKE + cmDynamicLoader::FlushCache(); +#endif + if (retv != 0) { + cmCTestLog(this, DEBUG, "build and test failing returning: " << retv + << std::endl); + } + return retv; } void cmCTest::SetNotesFiles(const char* notes) |