|
|
@@ -14,6 +14,8 @@
|
|
|
#include "cmCTest.h"
|
|
|
#include "cmLocalGenerator.h"
|
|
|
#include "cmGlobalGenerator.h"
|
|
|
+#include "cmCTestVC.h"
|
|
|
+#include "cmGeneratedFileStream.h"
|
|
|
|
|
|
bool cmCTestStartCommand
|
|
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
|
|
@@ -76,10 +78,11 @@ bool cmCTestStartCommand
|
|
|
cmSystemTools::AddKeepPath(bld_dir);
|
|
|
|
|
|
this->CTest->EmptyCTestConfiguration();
|
|
|
- this->CTest->SetCTestConfiguration("SourceDirectory",
|
|
|
- cmSystemTools::CollapseFullPath(src_dir).c_str());
|
|
|
- this->CTest->SetCTestConfiguration("BuildDirectory",
|
|
|
- cmSystemTools::CollapseFullPath(bld_dir).c_str());
|
|
|
+
|
|
|
+ std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir);
|
|
|
+ std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir);
|
|
|
+ this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str());
|
|
|
+ this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str());
|
|
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
|
|
|
<< smodel << std::endl
|
|
|
@@ -92,13 +95,62 @@ bool cmCTestStartCommand
|
|
|
" Track: " << track << std::endl);
|
|
|
}
|
|
|
|
|
|
+ // Log startup actions.
|
|
|
+ std::string startLogFile = binaryDir + "/Testing/Temporary/LastStart.log";
|
|
|
+ cmGeneratedFileStream ofs(startLogFile.c_str());
|
|
|
+ if(!ofs)
|
|
|
+ {
|
|
|
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
+ "Cannot create log file: LastStart.log" << std::endl);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Make sure the source directory exists.
|
|
|
+ if(!this->InitialCheckout(ofs, sourceDir))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(!cmSystemTools::FileIsDirectory(sourceDir.c_str()))
|
|
|
+ {
|
|
|
+ cmOStringStream e;
|
|
|
+ e << "given source path\n"
|
|
|
+ << " " << sourceDir << "\n"
|
|
|
+ << "which is not an existing directory. "
|
|
|
+ << "Set CTEST_CHECKOUT_COMMAND to a command line to create it.";
|
|
|
+ this->SetError(e.str().c_str());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
|
|
|
this->CTest->SetSuppressUpdatingCTestConfiguration(true);
|
|
|
int model = this->CTest->GetTestModelFromString(smodel);
|
|
|
this->CTest->SetTestModel(model);
|
|
|
this->CTest->SetProduceXML(true);
|
|
|
|
|
|
- return this->CTest->InitializeFromCommand(this, true);
|
|
|
+ return this->CTest->InitializeFromCommand(this);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+bool cmCTestStartCommand::InitialCheckout(
|
|
|
+ std::ostream& ofs, std::string const& sourceDir)
|
|
|
+{
|
|
|
+ // Use the user-provided command to create the source tree.
|
|
|
+ const char* initialCheckoutCommand
|
|
|
+ = this->Makefile->GetDefinition("CTEST_CHECKOUT_COMMAND");
|
|
|
+ if(!initialCheckoutCommand)
|
|
|
+ {
|
|
|
+ initialCheckoutCommand =
|
|
|
+ this->Makefile->GetDefinition("CTEST_CVS_CHECKOUT");
|
|
|
+ }
|
|
|
+ if(initialCheckoutCommand)
|
|
|
+ {
|
|
|
+ // Use a generic VC object to run and log the command.
|
|
|
+ cmCTestVC vc(this->CTest, ofs);
|
|
|
+ vc.SetSourceDirectory(sourceDir.c_str());
|
|
|
+ if(!vc.InitialCheckout(initialCheckoutCommand))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|