Add the FILES keyword to ctest_upload command

This commit is contained in:
Zach Mullen 2011-03-10 15:56:55 -05:00 committed by Brad King
parent 28cdd0a5be
commit 6b6f309c5f
3 changed files with 32 additions and 14 deletions

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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()