summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-18 16:53:48 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-18 16:53:48 (GMT)
commitf47a57c3e8410e5ce78acf67bf239303fa6b27e4 (patch)
treea2c5b968c53804064344b45751f58f0fcf912fff /Source
parent3d84afe571f03f0f8406a4af95746877b5ee9267 (diff)
downloadCMake-f47a57c3e8410e5ce78acf67bf239303fa6b27e4.zip
CMake-f47a57c3e8410e5ce78acf67bf239303fa6b27e4.tar.gz
CMake-f47a57c3e8410e5ce78acf67bf239303fa6b27e4.tar.bz2
ENH: Add a way to submit extra files to the dashboard
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx19
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx24
-rw-r--r--Source/cmCTest.cxx52
-rw-r--r--Source/cmCTest.h4
-rw-r--r--Source/ctest.cxx2
5 files changed, 94 insertions, 7 deletions
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 81252a7..3026e92 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -97,6 +97,25 @@ bool cmCTestSubmitCommand::InitialPass(
}
m_CTest->GenerateNotesFile(newNotesFiles);
}
+ const char* extraFilesVariable = m_Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
+ if (extraFilesVariable)
+ {
+ std::vector<std::string> extraFiles;
+ std::vector<cmStdString> newExtraFiles;
+ cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
+ std::vector<std::string>::iterator it;
+ for ( it = extraFiles.begin();
+ it != extraFiles.end();
+ ++ it )
+ {
+ newExtraFiles.push_back(*it);
+ }
+ if ( !m_CTest->SubmitExtraFiles(newExtraFiles))
+ {
+ this->SetError("problem submitting extra files.");
+ return false;
+ }
+ }
cmCTestGenericHandler* handler = m_CTest->GetInitializedHandler("submit");
if ( !handler )
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 45fbcfc..a292f06 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -120,8 +120,12 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix,
// enable uploading
::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1) ;
- cmStdString local_file = localprefix + "/" + *file;
- cmStdString upload_as = url + "/" + remoteprefix + *file;
+ cmStdString local_file = *file;
+ if ( !cmSystemTools::FileExists(local_file.c_str()) )
+ {
+ local_file = localprefix + "/" + *file;
+ }
+ cmStdString upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
@@ -246,8 +250,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix,
::curl_easy_setopt(curl, CURLOPT_PUT, 1);
::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
- cmStdString local_file = localprefix + "/" + *file;
- cmStdString remote_file = remoteprefix + *file;
+ cmStdString local_file = *file;
+ if ( !cmSystemTools::FileExists(local_file.c_str()) )
+ {
+ local_file = localprefix + "/" + *file;
+ }
+ cmStdString remote_file = remoteprefix + remoteprefix + cmSystemTools::GetFilenameName(*file);
*m_LogFile << "\tUpload file: " << local_file.c_str() << " to "
<< remote_file.c_str() << std::endl;
@@ -401,7 +409,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(const std::set<cmStdString>& files,
::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
- cmStdString rfile = remoteprefix + *file;
+ cmStdString rfile = remoteprefix + cmSystemTools::GetFilenameName(*file);
cmStdString ofile = "";
cmStdString::iterator kk;
for ( kk = rfile.begin(); kk < rfile.end(); ++ kk)
@@ -581,7 +589,11 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix,
{
xmlrpc_value *result;
- std::string local_file = localprefix + "/" + *file;
+ cmStdString local_file = *file;
+ if ( !cmSystemTools::FileExists(local_file.c_str()) )
+ {
+ local_file = localprefix + "/" + *file;
+ }
cmCTestLog(m_CTest, HANDLER_OUTPUT, " Submit file: " << local_file.c_str() << std::endl);
struct stat st;
if ( ::stat(local_file.c_str(), &st) )
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index a79f75b..442c387 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1188,7 +1188,47 @@ int cmCTest::GenerateNotesFile(const char* cfiles)
}
//----------------------------------------------------------------------
-bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, const char* varg2 = 0)
+bool cmCTest::SubmitExtraFiles(const std::vector<cmStdString> &files)
+{
+ std::vector<cmStdString>::const_iterator it;
+ for ( it = files.begin();
+ it != files.end();
+ ++ it )
+ {
+ if ( !cmSystemTools::FileExists(it->c_str()) )
+ {
+ cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " << it->c_str() << " to submit."
+ << std::endl;);
+ return false;
+ }
+ this->AddSubmitFile(it->c_str());
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------
+bool cmCTest::SubmitExtraFiles(const char* cfiles)
+{
+ if ( !cfiles )
+ {
+ return 1;
+ }
+
+ std::vector<cmStdString> files;
+
+ cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl);
+
+ files = cmSystemTools::SplitString(cfiles, ';');
+ if ( files.size() == 0 )
+ {
+ return 1;
+ }
+
+ return this->SubmitExtraFiles(files);
+}
+
+//----------------------------------------------------------------------
+bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, const char* varg2)
{
cmOStringStream ostr;
ostr << varg1;
@@ -1592,6 +1632,16 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
i++;
this->SetNotesFiles(args[i].c_str());
}
+ if(this->CheckArgument(arg, "--extra-submit") && i < args.size() - 1)
+ {
+ this->m_ProduceXML = true;
+ this->SetTest("Submit");
+ i++;
+ if ( !this->SubmitExtraFiles(args[i].c_str()) )
+ {
+ return 0;
+ }
+ }
// --build-and-test options
if(this->CheckArgument(arg, "--build-and-test") && i < args.size() - 1)
{
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 0a80e72..c51a112 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -257,6 +257,10 @@ public:
//! Create XML file that contains all the notes specified
int GenerateNotesFile(const std::vector<cmStdString> &files);
+ //! Submit extra files to the server
+ bool SubmitExtraFiles(const char* files);
+ bool SubmitExtraFiles(const std::vector<cmStdString> &files);
+
//! Set the output log file name
void SetOutputLogFileName(const char* name);
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 46dfdac..f263edc 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -157,6 +157,8 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
{"--overwrite", "Overwrite CTest configuration option.",
"By default ctest uses configuration options from configuration file. "
"This option will overwrite the configuration option." },
+ {"--extra-submit <file>[;<file>]", "Submit extra files to the dashboard.",
+ "This option will submit extra files to the dashboard." },
{"--force-new-ctest-process", "Run child CTest instances as new processes",
"By default CTest will run child CTest instances within the same process. "
"If this behavior is not desired, this argument will enforce new processes "