3
3
Program: CMake - Cross-Platform Makefile Generator
4
4
Module: $RCSfile: cmCTestHandlerCommand.cxx,v $
6
Date: $Date: 2005/06/23 17:04:17 $
7
Version: $Revision: 1.1 $
6
Date: $Date: 2006/05/11 02:15:09 $
7
Version: $Revision: 1.7.2.1 $
9
9
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10
10
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
14
PURPOSE. See the above copyright notices for more information.
16
16
=========================================================================*/
24
24
const size_t INIT_SIZE = 100;
26
m_Arguments.reserve(INIT_SIZE);
26
this->Arguments.reserve(INIT_SIZE);
27
27
for ( cc = 0; cc < INIT_SIZE; ++ cc )
29
this->Arguments.push_back(0);
31
m_Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
32
m_Arguments[ct_SOURCE] = "SOURCE";
33
m_Arguments[ct_BUILD] = "BUILD";
34
m_Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
31
this->Arguments[ct_RETURN_VALUE] = "RETURN_VALUE";
32
this->Arguments[ct_SOURCE] = "SOURCE";
33
this->Arguments[ct_BUILD] = "BUILD";
34
this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
38
38
bool cmCTestHandlerCommand::InitialPass(
39
39
std::vector<std::string> const& args)
41
if ( !this->ProcessArguments(args, m_Last, &*m_Arguments.begin(), m_Values) )
41
if ( !this->ProcessArguments(args, (unsigned int)this->Last,
42
&*this->Arguments.begin(),this->Values) )
47
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
46
48
cmCTestGenericHandler* handler = this->InitializeHandler();
53
if ( m_Values[ct_BUILD] )
55
m_CTest->SetCTestConfiguration("BuildDirectory", m_Values[ct_BUILD]);
57
if ( m_Values[ct_SUBMIT_INDEX] )
59
if ( m_CTest->GetDartVersion() <= 1 )
55
cmCTestLog(this->CTest, DEBUG, "Populate Custom Vectors" << std::endl;);
56
handler->PopulateCustomVectors(this->Makefile);
58
if ( this->Values[ct_BUILD] )
60
this->CTest->SetCTestConfiguration("BuildDirectory",
61
this->Values[ct_BUILD]);
65
this->CTest->SetCTestConfiguration("BuildDirectory",
66
this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"));
68
if ( this->Values[ct_SOURCE] )
70
cmCTestLog(this->CTest, DEBUG,
71
"Set source directory to: " << this->Values[ct_SOURCE] << std::endl);
72
this->CTest->SetCTestConfiguration("SourceDirectory",
73
this->Values[ct_SOURCE]);
77
this->CTest->SetCTestConfiguration("SourceDirectory",
78
this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"));
80
if ( this->Values[ct_SUBMIT_INDEX] )
82
if ( this->CTest->GetDartVersion() <= 1 )
61
cmCTestLog(m_CTest, ERROR_MESSAGE, "Dart before version 2.0 does not support collecting submissions." << std::endl
62
<< "Please upgrade the server to Dart 2 or higher, or do not use SUBMIT_INDEX." << std::endl);
84
cmCTestLog(this->CTest, ERROR_MESSAGE,
85
"Dart before version 2.0 does not support collecting submissions."
87
<< "Please upgrade the server to Dart 2 or higher, or do not use "
88
"SUBMIT_INDEX." << std::endl);
66
handler->SetSubmitIndex(atoi(m_Values[ct_SUBMIT_INDEX]));
92
handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX]));
71
96
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
72
cmSystemTools::ChangeDirectory(m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
97
cmSystemTools::ChangeDirectory(
98
this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
73
99
int res = handler->ProcessHandler();
74
if ( m_Values[ct_RETURN_VALUE] && *m_Values[ct_RETURN_VALUE])
100
if ( this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE])
76
102
cmOStringStream str;
78
m_Makefile->AddDefinition(m_Values[ct_RETURN_VALUE], str.str().c_str());
104
this->Makefile->AddDefinition(
105
this->Values[ct_RETURN_VALUE], str.str().c_str());
80
107
cmSystemTools::ChangeDirectory(current_dir.c_str());
84
bool cmCTestHandlerCommand::ProcessArguments(std::vector<std::string> const& args,
85
int last, const char** strings, std::vector<const char*>& values)
111
bool cmCTestHandlerCommand::ProcessArguments(
112
std::vector<std::string> const& args, int last, const char** strings,
113
std::vector<const char*>& values)