1
/*=========================================================================
3
Program: CMake - Cross-Platform Makefile Generator
4
Module: $RCSfile: cmCTestSubmitCommand.cxx,v $
6
Date: $Date: 2009-03-31 14:29:12 $
7
Version: $Revision: 1.13.12.1 $
9
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
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
14
PURPOSE. See the above copyright notices for more information.
16
=========================================================================*/
1
/*============================================================================
2
CMake - Cross Platform Makefile Generator
3
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5
Distributed under the OSI-approved BSD License (the "License");
6
see accompanying file Copyright.txt for details.
8
This software is distributed WITHOUT ANY WARRANTY; without even the
9
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
See the License for more information.
11
============================================================================*/
17
12
#include "cmCTestSubmitCommand.h"
19
14
#include "cmCTest.h"
20
15
#include "cmCTestGenericHandler.h"
16
#include "cmCTestSubmitHandler.h"
22
18
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
37
33
ctestDropMethod = "http";
40
if ( ctestDropSiteCDash )
42
// drop site is a CDash server...
46
// error: CDash requires CTEST_DROP_SITE definition
47
// in CTestConfig.cmake
49
if ( !ctestDropLocation )
51
// error: CDash requires CTEST_DROP_LOCATION definition
52
// in CTestConfig.cmake
38
// error: CDash requires CTEST_DROP_SITE definition
39
// in CTestConfig.cmake
41
if ( !ctestDropLocation )
57
// drop site is a *NOT* a CDash server...
59
// Keep all this code in case anybody out there is still
60
// using newer CMake with non-CDash servers
64
ctestDropSite = "public.kitware.com";
66
if ( !ctestDropLocation )
68
ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi";
70
if ( !ctestTriggerSite )
73
= "http://public.kitware.com/cgi-bin/Submit-Random-TestingResults.cgi";
74
cmCTestLog(this->CTest, HANDLER_OUTPUT, "* Use default trigger site: "
75
<< ctestTriggerSite << std::endl;);
43
// error: CDash requires CTEST_DROP_LOCATION definition
44
// in CTestConfig.cmake
79
this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
80
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite);
47
this->CTest->SetCTestConfiguration("DropMethod", ctestDropMethod);
48
this->CTest->SetCTestConfiguration("DropSite", ctestDropSite);
81
49
this->CTest->SetCTestConfiguration("DropLocation", ctestDropLocation);
83
51
this->CTest->SetCTestConfiguration("IsCDash",
93
61
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
62
"CurlOptions", "CTEST_CURL_OPTIONS");
63
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
94
64
"DropSiteUser", "CTEST_DROP_SITE_USER");
95
65
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
96
66
"DropSitePassword", "CTEST_DROP_SITE_PASSWORD");
141
112
this->SetError("internal CTest error. Cannot instantiate submit handler");
116
// If no FILES or PARTS given, *all* PARTS are submitted by default.
118
// If FILES are given, but not PARTS, only the FILES are submitted
119
// and *no* PARTS are submitted.
120
// (This is why we select the empty "noParts" set in the
121
// FilesMentioned block below...)
123
// If PARTS are given, only the selected PARTS are submitted.
125
// If both PARTS and FILES are given, only the selected PARTS *and*
126
// all the given FILES are submitted.
128
// If given explicit FILES to submit, pass them to the handler.
130
if(this->FilesMentioned)
132
// Intentionally select *no* PARTS. (Pass an empty set.) If PARTS
133
// were also explicitly mentioned, they will be selected below...
134
// But FILES with no PARTS mentioned should just submit the FILES
135
// without any of the default parts.
137
std::set<cmCTest::Part> noParts;
138
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts);
140
static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files);
143
// If a PARTS option was given, select only the named parts for submission.
145
if(this->PartsMentioned)
147
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
154
//----------------------------------------------------------------------------
155
bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
157
// Look for arguments specific to this command.
160
this->ArgumentDoing = ArgumentDoingParts;
161
this->PartsMentioned = true;
167
this->ArgumentDoing = ArgumentDoingFiles;
168
this->FilesMentioned = true;
172
// Look for other arguments.
173
return this->Superclass::CheckArgumentKeyword(arg);
177
//----------------------------------------------------------------------------
178
bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
180
// Handle states specific to this command.
181
if(this->ArgumentDoing == ArgumentDoingParts)
183
cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str());
184
if(p != cmCTest::PartCount)
186
this->Parts.insert(p);
191
e << "Part name \"" << arg << "\" is invalid.";
192
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
193
this->ArgumentDoing = ArgumentDoingError;
198
if(this->ArgumentDoing == ArgumentDoingFiles)
200
cmStdString filename(arg);
201
if(cmSystemTools::FileExists(filename.c_str()))
203
this->Files.insert(filename);
208
e << "File \"" << filename << "\" does not exist. Cannot submit "
209
<< "a non-existent file.";
210
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
211
this->ArgumentDoing = ArgumentDoingError;
216
// Look for other arguments.
217
return this->Superclass::CheckArgumentValue(arg);