ENH: Add a way to submit extra files to the dashboard

This commit is contained in:
Andy Cedilnik 2005-07-18 12:53:48 -04:00
parent 3d84afe571
commit f47a57c3e8
5 changed files with 94 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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 "