ENH: Teach ctest_submit about parts
This adds a PARTS option to the ctest_submit command which tells it to submit only parts whose names are listed with the option.
This commit is contained in:
parent
447f5b303e
commit
d66c25c2f0
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "cmCTest.h"
|
#include "cmCTest.h"
|
||||||
#include "cmCTestGenericHandler.h"
|
#include "cmCTestGenericHandler.h"
|
||||||
|
#include "cmCTestSubmitHandler.h"
|
||||||
|
|
||||||
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||||
{
|
{
|
||||||
|
@ -106,7 +107,52 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
|
||||||
this->SetError("internal CTest error. Cannot instantiate submit handler");
|
this->SetError("internal CTest error. Cannot instantiate submit handler");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a PARTS option was given, select only the named parts for submission.
|
||||||
|
if(!this->Parts.empty())
|
||||||
|
{
|
||||||
|
static_cast<cmCTestSubmitHandler*>(handler)->SelectParts(this->Parts);
|
||||||
|
}
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
|
||||||
|
{
|
||||||
|
// Look for arguments specific to this command.
|
||||||
|
if(arg == "PARTS")
|
||||||
|
{
|
||||||
|
this->ArgumentDoing = ArgumentDoingParts;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for other arguments.
|
||||||
|
return this->Superclass::CheckArgumentKeyword(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg)
|
||||||
|
{
|
||||||
|
// Handle states specific to this command.
|
||||||
|
if(this->ArgumentDoing == ArgumentDoingParts)
|
||||||
|
{
|
||||||
|
cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str());
|
||||||
|
if(p != cmCTest::PartCount)
|
||||||
|
{
|
||||||
|
this->Parts.insert(p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmOStringStream e;
|
||||||
|
e << "Part name \"" << arg << "\" is invalid.";
|
||||||
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
this->ArgumentDoing = ArgumentDoingError;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for other arguments.
|
||||||
|
return this->Superclass::CheckArgumentValue(arg);
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define cmCTestSubmitCommand_h
|
#define cmCTestSubmitCommand_h
|
||||||
|
|
||||||
#include "cmCTestHandlerCommand.h"
|
#include "cmCTestHandlerCommand.h"
|
||||||
|
#include "cmCTest.h"
|
||||||
|
|
||||||
/** \class cmCTestSubmit
|
/** \class cmCTestSubmit
|
||||||
* \brief Run a ctest script
|
* \brief Run a ctest script
|
||||||
|
@ -61,14 +62,25 @@ public:
|
||||||
virtual const char* GetFullDocumentation()
|
virtual const char* GetFullDocumentation()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
" ctest_submit([RETURN_VALUE res])\n"
|
" ctest_submit([RETURN_VALUE res] [PARTS ...])\n"
|
||||||
"Submits the test results for the project.";
|
"Submits the test results for the project. "
|
||||||
|
"By default all available parts are submitted. "
|
||||||
|
"The PARTS option lists a subset of parts to be submitted.";
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
|
cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmCTestGenericHandler* InitializeHandler();
|
cmCTestGenericHandler* InitializeHandler();
|
||||||
|
|
||||||
|
virtual bool CheckArgumentKeyword(std::string const& arg);
|
||||||
|
virtual bool CheckArgumentValue(std::string const& arg);
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ArgumentDoingParts = Superclass::ArgumentDoingLast1,
|
||||||
|
ArgumentDoingLast2
|
||||||
|
};
|
||||||
|
std::set<cmCTest::Part> Parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,13 @@ cmCTestSubmitHandler::cmCTestSubmitHandler() : HTTPProxy(), FTPProxy()
|
||||||
this->FTPProxy = "";
|
this->FTPProxy = "";
|
||||||
this->FTPProxyType = 0;
|
this->FTPProxyType = 0;
|
||||||
this->CDash = false;
|
this->CDash = false;
|
||||||
|
|
||||||
|
// We submit all available parts by default.
|
||||||
|
for(cmCTest::Part p = cmCTest::PartStart;
|
||||||
|
p != cmCTest::PartCount; p = cmCTest::Part(p+1))
|
||||||
|
{
|
||||||
|
this->SubmitPart[p] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -893,6 +900,13 @@ int cmCTestSubmitHandler::ProcessHandler()
|
||||||
for(cmCTest::Part p = cmCTest::PartStart;
|
for(cmCTest::Part p = cmCTest::PartStart;
|
||||||
p != cmCTest::PartCount; p = cmCTest::Part(p+1))
|
p != cmCTest::PartCount; p = cmCTest::Part(p+1))
|
||||||
{
|
{
|
||||||
|
// Skip parts we are not submitting.
|
||||||
|
if(!this->SubmitPart[p])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit files from this part.
|
||||||
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
|
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
|
||||||
for(std::vector<std::string>::const_iterator pi = pfiles.begin();
|
for(std::vector<std::string>::const_iterator pi = pfiles.begin();
|
||||||
pi != pfiles.end(); ++pi)
|
pi != pfiles.end(); ++pi)
|
||||||
|
@ -1107,4 +1121,13 @@ std::string cmCTestSubmitHandler::GetSubmitResultsPrefix()
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
|
||||||
|
{
|
||||||
|
// Check whether each part is selected.
|
||||||
|
for(cmCTest::Part p = cmCTest::PartStart;
|
||||||
|
p != cmCTest::PartCount; p = cmCTest::Part(p+1))
|
||||||
|
{
|
||||||
|
this->SubmitPart[p] = (parts.find(p) != parts.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -39,7 +39,9 @@ public:
|
||||||
int ProcessHandler();
|
int ProcessHandler();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
|
/** Specify a set of parts (by name) to submit. */
|
||||||
|
void SelectParts(std::set<cmCTest::Part> const& parts);
|
||||||
private:
|
private:
|
||||||
void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
|
void SetLogFile(std::ostream* ost) { this->LogFile = ost; }
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ private:
|
||||||
cmStdString FTPProxy;
|
cmStdString FTPProxy;
|
||||||
int FTPProxyType;
|
int FTPProxyType;
|
||||||
std::ostream* LogFile;
|
std::ostream* LogFile;
|
||||||
|
bool SubmitPart[cmCTest::PartCount];
|
||||||
bool CDash;
|
bool CDash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,3 +42,8 @@ CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res START 6 STRIDE 2 S
|
||||||
CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res STRIDE 1.5)
|
CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res STRIDE 1.5)
|
||||||
CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
|
CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
|
||||||
CTEST_SUBMIT(RETURN_VALUE res)
|
CTEST_SUBMIT(RETURN_VALUE res)
|
||||||
|
|
||||||
|
# Test submission of a subset of parts.
|
||||||
|
SET(CTEST_EXTRA_SUBMIT_FILES ${CTEST_NOTES_FILES})
|
||||||
|
CTEST_SUBMIT(RETURN_VALUE res PARTS ExtraFiles)
|
||||||
|
SET(CTEST_EXTRA_SUBMIT_FILES)
|
||||||
|
|
Loading…
Reference in New Issue