summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestUploadCommand.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2011-02-18 17:11:51 (GMT)
committerBrad King <brad.king@kitware.com>2011-03-15 19:07:37 (GMT)
commit350546db3aa956e34487bd38dd048fe9a0689e4a (patch)
tree3f0bda38ef56ddba39d93cb172e5cec8e6fb3fe7 /Source/CTest/cmCTestUploadCommand.cxx
parent0554e5e50f6eb3117b4e207f4b01876dbe5a75a4 (diff)
downloadCMake-350546db3aa956e34487bd38dd048fe9a0689e4a.zip
CMake-350546db3aa956e34487bd38dd048fe9a0689e4a.tar.gz
CMake-350546db3aa956e34487bd38dd048fe9a0689e4a.tar.bz2
Implement ctest_upload command
Diffstat (limited to 'Source/CTest/cmCTestUploadCommand.cxx')
-rw-r--r--Source/CTest/cmCTestUploadCommand.cxx57
1 files changed, 57 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx
new file mode 100644
index 0000000..9f0954b
--- /dev/null
+++ b/Source/CTest/cmCTestUploadCommand.cxx
@@ -0,0 +1,57 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCTestUploadCommand.h"
+
+#include "cmCTest.h"
+#include "cmCTestGenericHandler.h"
+#include "cmCTestUploadHandler.h"
+
+cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler()
+{
+ cmCTestGenericHandler* handler
+ = this->CTest->GetInitializedHandler("upload");
+ if ( !handler )
+ {
+ this->SetError("internal CTest error. Cannot instantiate upload handler");
+ return 0;
+ }
+ static_cast<cmCTestUploadHandler*>(handler)->SetFiles(this->Files);
+
+ return handler;
+}
+
+
+//----------------------------------------------------------------------------
+bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg)
+{
+ return this->CheckArgumentValue(arg);
+}
+
+
+//----------------------------------------------------------------------------
+bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg)
+{
+ cmStdString filename(arg);
+ if(cmSystemTools::FileExists(filename.c_str()))
+ {
+ this->Files.insert(filename);
+ return true;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "File \"" << filename << "\" does not exist. Cannot submit "
+ << "a non-existent file.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+}