~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Source/CTest/cmCTestSubmitCommand.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=========================================================================
2
 
 
3
 
  Program:   CMake - Cross-Platform Makefile Generator
4
 
  Module:    $RCSfile: cmCTestSubmitCommand.cxx,v $
5
 
  Language:  C++
6
 
  Date:      $Date: 2009-03-31 14:29:12 $
7
 
  Version:   $Revision: 1.13.12.1 $
8
 
 
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.
11
 
 
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.
15
 
 
16
 
=========================================================================*/
 
1
/*============================================================================
 
2
  CMake - Cross Platform Makefile Generator
 
3
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
 
4
 
 
5
  Distributed under the OSI-approved BSD License (the "License");
 
6
  see accompanying file Copyright.txt for details.
 
7
 
 
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"
18
13
 
19
14
#include "cmCTest.h"
20
15
#include "cmCTestGenericHandler.h"
 
16
#include "cmCTestSubmitHandler.h"
21
17
 
22
18
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
23
19
{
37
33
    ctestDropMethod = "http";
38
34
    }
39
35
 
40
 
  if ( ctestDropSiteCDash )
 
36
  if ( !ctestDropSite )
41
37
    {
42
 
    // drop site is a CDash server...
43
 
    //
44
 
    if ( !ctestDropSite )
45
 
      {
46
 
      // error: CDash requires CTEST_DROP_SITE definition
47
 
      // in CTestConfig.cmake
48
 
      }
49
 
    if ( !ctestDropLocation )
50
 
      {
51
 
      // error: CDash requires CTEST_DROP_LOCATION definition
52
 
      // in CTestConfig.cmake
53
 
      }
 
38
    // error: CDash requires CTEST_DROP_SITE definition
 
39
    // in CTestConfig.cmake
54
40
    }
55
 
  else
 
41
  if ( !ctestDropLocation )
56
42
    {
57
 
    // drop site is a *NOT* a CDash server...
58
 
    //
59
 
    // Keep all this code in case anybody out there is still
60
 
    // using newer CMake with non-CDash servers
61
 
    //
62
 
    if ( !ctestDropSite )
63
 
      {
64
 
      ctestDropSite = "public.kitware.com";
65
 
      }
66
 
    if ( !ctestDropLocation )
67
 
      {
68
 
      ctestDropLocation = "/cgi-bin/HTTPUploadDartFile.cgi";
69
 
      }
70
 
    if ( !ctestTriggerSite )
71
 
      {
72
 
      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;);
76
 
      }
 
43
    // error: CDash requires CTEST_DROP_LOCATION definition
 
44
    // in CTestConfig.cmake
77
45
    }
78
46
 
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);
82
50
 
83
51
  this->CTest->SetCTestConfiguration("IsCDash",
91
59
    }
92
60
 
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");
113
83
      }
114
84
    this->CTest->GenerateNotesFile(newNotesFiles);
115
85
    }
 
86
 
116
87
  const char* extraFilesVariable
117
88
    = this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
118
89
  if (extraFilesVariable)
141
112
    this->SetError("internal CTest error. Cannot instantiate submit handler");
142
113
    return 0;
143
114
    }
 
115
 
 
116
  // If no FILES or PARTS given, *all* PARTS are submitted by default.
 
117
  //
 
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...)
 
122
  //
 
123
  // If PARTS are given, only the selected PARTS are submitted.
 
124
  //
 
125
  // If both PARTS and FILES are given, only the selected PARTS *and*
 
126
  // all the given FILES are submitted.
 
127
 
 
128
  // If given explicit FILES to submit, pass them to the handler.
 
129
  //
 
130
  if(this->FilesMentioned)
 
131
    {
 
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.
 
136
    //
 
137
    std::set<cmCTest::Part> noParts;
 
138
    static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(noParts);
 
139
 
 
140
    static_cast<cmCTestSubmitHandler*>(handler)->SelectFiles(this->Files);
 
141
    }
 
142
 
 
143
  // If a PARTS option was given, select only the named parts for submission.
 
144
  //
 
145
  if(this->PartsMentioned)
 
146
    {
 
147
    static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
 
148
    }
 
149
 
144
150
  return handler;
145
151
}
146
152
 
147
153
 
 
154
//----------------------------------------------------------------------------
 
155
bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
 
156
{
 
157
  // Look for arguments specific to this command.
 
158
  if(arg == "PARTS")
 
159
    {
 
160
    this->ArgumentDoing = ArgumentDoingParts;
 
161
    this->PartsMentioned = true;
 
162
    return true;
 
163
    }
 
164
 
 
165
  if(arg == "FILES")
 
166
    {
 
167
    this->ArgumentDoing = ArgumentDoingFiles;
 
168
    this->FilesMentioned = true;
 
169
    return true;
 
170
    }
 
171
 
 
172
  // Look for other arguments.
 
173
  return this->Superclass::CheckArgumentKeyword(arg);
 
174
}
 
175
 
 
176
 
 
177
//----------------------------------------------------------------------------
 
178
bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
 
179
{
 
180
  // Handle states specific to this command.
 
181
  if(this->ArgumentDoing == ArgumentDoingParts)
 
182
    {
 
183
    cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str());
 
184
    if(p != cmCTest::PartCount)
 
185
      {
 
186
      this->Parts.insert(p);
 
187
      }
 
188
    else
 
189
      {
 
190
      cmOStringStream e;
 
191
      e << "Part name \"" << arg << "\" is invalid.";
 
192
      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
 
193
      this->ArgumentDoing = ArgumentDoingError;
 
194
      }
 
195
    return true;
 
196
    }
 
197
 
 
198
  if(this->ArgumentDoing == ArgumentDoingFiles)
 
199
    {
 
200
    cmStdString filename(arg);
 
201
    if(cmSystemTools::FileExists(filename.c_str()))
 
202
      {
 
203
      this->Files.insert(filename);
 
204
      }
 
205
    else
 
206
      {
 
207
      cmOStringStream e;
 
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;
 
212
      }
 
213
    return true;
 
214
    }
 
215
 
 
216
  // Look for other arguments.
 
217
  return this->Superclass::CheckArgumentValue(arg);
 
218
}