2005-02-17 18:51:52 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
2006-03-09 19:17:10 +03:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
2005-02-17 18:51:52 +03:00
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmCTestStartCommand.h"
|
|
|
|
|
|
|
|
#include "cmCTest.h"
|
2005-05-02 22:15:29 +04:00
|
|
|
#include "cmLocalGenerator.h"
|
|
|
|
#include "cmGlobalGenerator.h"
|
2005-02-17 18:51:52 +03:00
|
|
|
|
|
|
|
bool cmCTestStartCommand::InitialPass(
|
|
|
|
std::vector<std::string> const& args)
|
|
|
|
{
|
|
|
|
if (args.size() < 1)
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-04-28 19:59:31 +04:00
|
|
|
size_t cnt = 0;
|
|
|
|
const char* smodel = args[cnt].c_str();
|
2005-02-17 18:51:52 +03:00
|
|
|
const char* src_dir = 0;
|
|
|
|
const char* bld_dir = 0;
|
|
|
|
|
2006-04-28 19:59:31 +04:00
|
|
|
cnt++;
|
|
|
|
|
|
|
|
this->CTest->SetSpecificTrack(0);
|
|
|
|
if ( cnt < args.size() -1 )
|
2005-02-17 18:51:52 +03:00
|
|
|
{
|
2006-04-28 19:59:31 +04:00
|
|
|
if ( args[cnt] == "TRACK" )
|
2005-02-17 18:51:52 +03:00
|
|
|
{
|
2006-04-28 19:59:31 +04:00
|
|
|
cnt ++;
|
|
|
|
this->CTest->SetSpecificTrack(args[cnt].c_str());
|
|
|
|
cnt ++;
|
2005-02-17 18:51:52 +03:00
|
|
|
}
|
|
|
|
}
|
2006-04-28 19:59:31 +04:00
|
|
|
|
|
|
|
if ( cnt < args.size() )
|
2005-02-17 18:51:52 +03:00
|
|
|
{
|
2006-04-28 19:59:31 +04:00
|
|
|
src_dir = args[cnt].c_str();
|
|
|
|
cnt ++;
|
|
|
|
if ( cnt < args.size() )
|
|
|
|
{
|
|
|
|
bld_dir = args[cnt].c_str();
|
|
|
|
}
|
2005-02-17 18:51:52 +03:00
|
|
|
}
|
|
|
|
if ( !src_dir )
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
src_dir = this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY");
|
2005-02-17 18:51:52 +03:00
|
|
|
}
|
|
|
|
if ( !bld_dir)
|
|
|
|
{
|
2006-03-15 19:02:08 +03:00
|
|
|
bld_dir = this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY");
|
2005-02-17 18:51:52 +03:00
|
|
|
}
|
|
|
|
if ( !src_dir )
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
this->SetError("source directory not specified. Specify source directory "
|
|
|
|
"as an argument or set CTEST_SOURCE_DIRECTORY");
|
2005-02-17 18:51:52 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ( !bld_dir)
|
|
|
|
{
|
2006-03-09 19:17:10 +03:00
|
|
|
this->SetError("binary directory not specified. Specify binary directory "
|
|
|
|
"as an argument or set CTEST_BINARY_DIRECTORY");
|
2005-02-17 18:51:52 +03:00
|
|
|
return false;
|
|
|
|
}
|
2006-08-14 18:51:08 +04:00
|
|
|
|
|
|
|
cmSystemTools::AddKeepPath(src_dir);
|
|
|
|
cmSystemTools::AddKeepPath(bld_dir);
|
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->EmptyCTestConfiguration();
|
2006-07-11 23:58:07 +04:00
|
|
|
this->CTest->SetCTestConfiguration("SourceDirectory",
|
|
|
|
cmSystemTools::CollapseFullPath(src_dir).c_str());
|
|
|
|
this->CTest->SetCTestConfiguration("BuildDirectory",
|
|
|
|
cmSystemTools::CollapseFullPath(bld_dir).c_str());
|
2005-05-02 22:15:29 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
|
|
|
|
<< smodel << std::endl
|
2005-06-23 21:04:18 +04:00
|
|
|
<< " Source directory: " << src_dir << std::endl
|
|
|
|
<< " Build directory: " << bld_dir << std::endl);
|
2006-04-28 19:59:31 +04:00
|
|
|
const char* track = this->CTest->GetSpecificTrack();
|
|
|
|
if ( track )
|
|
|
|
{
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
|
|
|
" Track: " << track << std::endl);
|
|
|
|
}
|
2005-06-16 21:18:21 +04:00
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", "OFF");
|
2006-03-10 23:03:09 +03:00
|
|
|
this->CTest->SetSuppressUpdatingCTestConfiguration(true);
|
|
|
|
int model = this->CTest->GetTestModelFromString(smodel);
|
|
|
|
this->CTest->SetTestModel(model);
|
|
|
|
this->CTest->SetProduceXML(true);
|
2005-06-16 21:18:21 +04:00
|
|
|
|
2006-03-10 23:03:09 +03:00
|
|
|
return this->CTest->InitializeFromCommand(this, true);
|
2005-02-17 18:51:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|