1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 10:47:59 +08:00

CTest: use new methods for builtin commands

This commit is contained in:
Daniel Pfeifer
2017-05-10 21:06:48 +02:00
parent bd14e46400
commit c734c8501b
3 changed files with 26 additions and 27 deletions

View File

@@ -166,12 +166,12 @@ void cmCTestScriptHandler::UpdateElapsedTime()
}
}
void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
void cmCTestScriptHandler::AddCTestCommand(std::string const& name,
cmCTestCommand* command)
{
cmCTestCommand* newCom = command;
newCom->CTest = this->CTest;
newCom->CTestScriptHandler = this;
this->CMake->GetState()->AddCommand(newCom);
command->CTest = this->CTest;
command->CTestScriptHandler = this;
this->CMake->GetState()->AddBuiltinCommand(name, command);
}
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
@@ -290,22 +290,21 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
// add any ctest specific commands, probably should have common superclass
// for ctest commands to clean this up. If a couple more commands are
// created with the same format lets do that - ken
this->AddCTestCommand(new cmCTestBuildCommand);
this->AddCTestCommand(new cmCTestConfigureCommand);
this->AddCTestCommand(new cmCTestCoverageCommand);
this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
this->AddCTestCommand(new cmCTestMemCheckCommand);
this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
this->AddCTestCommand(new cmCTestRunScriptCommand);
this->AddCTestCommand(new cmCTestSleepCommand);
this->AddCTestCommand(new cmCTestStartCommand);
this->AddCTestCommand(new cmCTestSubmitCommand);
this->AddCTestCommand(new cmCTestTestCommand);
this->AddCTestCommand(new cmCTestUpdateCommand);
this->AddCTestCommand(new cmCTestUploadCommand);
this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
this->AddCTestCommand("ctest_coverage", new cmCTestCoverageCommand);
this->AddCTestCommand("ctest_empty_binary_directory",
new cmCTestEmptyBinaryDirectoryCommand);
this->AddCTestCommand("ctest_memcheck", new cmCTestMemCheckCommand);
this->AddCTestCommand("ctest_read_custom_files",
new cmCTestReadCustomFilesCommand);
this->AddCTestCommand("ctest_run_script", new cmCTestRunScriptCommand);
this->AddCTestCommand("ctest_sleep", new cmCTestSleepCommand);
this->AddCTestCommand("ctest_start", new cmCTestStartCommand);
this->AddCTestCommand("ctest_submit", new cmCTestSubmitCommand);
this->AddCTestCommand("ctest_test", new cmCTestTestCommand);
this->AddCTestCommand("ctest_update", new cmCTestUpdateCommand);
this->AddCTestCommand("ctest_upload", new cmCTestUploadCommand);
}
// this sets up some variables for the script to use, creates the required

View File

@@ -126,7 +126,7 @@ private:
int RunConfigurationDashboard();
// Add ctest command
void AddCTestCommand(cmCTestCommand* command);
void AddCTestCommand(std::string const& name, cmCTestCommand* command);
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);

View File

@@ -1662,23 +1662,23 @@ void cmCTestTestHandler::GetListOfTests()
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
newCom1->TestHandler = this;
cm.GetState()->AddCommand(newCom1);
cm.GetState()->AddBuiltinCommand("add_test", newCom1);
// Add handler for SUBDIRS
cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
newCom2->TestHandler = this;
cm.GetState()->AddCommand(newCom2);
cm.GetState()->AddBuiltinCommand("subdirs", newCom2);
// Add handler for ADD_SUBDIRECTORY
cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand;
newCom3->TestHandler = this;
cm.GetState()->AddCommand(newCom3);
cm.GetState()->AddBuiltinCommand("add_subdirectory", newCom3);
// Add handler for SET_SOURCE_FILES_PROPERTIES
// Add handler for SET_TESTS_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom4 =
new cmCTestSetTestsPropertiesCommand;
newCom4->TestHandler = this;
cm.GetState()->AddCommand(newCom4);
cm.GetState()->AddBuiltinCommand("set_tests_properties", newCom4);
const char* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {