From 6b6f309c5f2fa5c327afb98ac57d0b9f4f79a980 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Thu, 10 Mar 2011 15:56:55 -0500 Subject: Add the FILES keyword to ctest_upload command --- Source/CTest/cmCTestUploadCommand.cxx | 36 +++++++++++++++++++++++------------ Source/CTest/cmCTestUploadCommand.h | 8 +++++++- Tests/CTestTestUpload/test.cmake.in | 2 +- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 9f0954b..52fcc04 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -33,6 +33,11 @@ cmCTestGenericHandler* cmCTestUploadCommand::InitializeHandler() //---------------------------------------------------------------------------- bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) { + if(arg == "FILES") + { + this->ArgumentDoing = ArgumentDoingFiles; + return true; + } return this->CheckArgumentValue(arg); } @@ -40,18 +45,25 @@ bool cmCTestUploadCommand::CheckArgumentKeyword(std::string const& arg) //---------------------------------------------------------------------------- bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) { - cmStdString filename(arg); - if(cmSystemTools::FileExists(filename.c_str())) + if(this->ArgumentDoing == ArgumentDoingFiles) { - 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; + 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()); + this->ArgumentDoing = ArgumentDoingError; + return false; + } } + + // Look for other arguments. + return this->Superclass::CheckArgumentValue(arg); } diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index b8c9d9f..6c2a4c2 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -59,7 +59,7 @@ public: virtual const char* GetFullDocumentation() { return - " ctest_upload(...)\n" + " ctest_upload(FILES ...)\n" "Pass a list of files to be sent along with the build results to " "the dashboard server.\n"; } @@ -72,6 +72,12 @@ protected: virtual bool CheckArgumentKeyword(std::string const& arg); virtual bool CheckArgumentValue(std::string const& arg); + enum + { + ArgumentDoingFiles = Superclass::ArgumentDoingLast1, + ArgumentDoingLast2 + }; + cmCTest::SetOfStrings Files; }; diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index 2ab98d7..acfa233 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -13,5 +13,5 @@ SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") CTEST_START(Experimental) CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_UPLOAD("${CTEST_SOURCE_DIRECTORY}/sleep.c" "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt") +CTEST_UPLOAD(FILES "${CTEST_SOURCE_DIRECTORY}/sleep.c" "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt") CTEST_SUBMIT() -- cgit v0.12