ENH: Add option to submit notes. Implements Bug #465 - Add notes support to CTest
This commit is contained in:
parent
32accc1607
commit
2f2596c213
@ -470,6 +470,10 @@ bool cmCTest::SetTest(const char* ttype)
|
|||||||
{
|
{
|
||||||
m_Tests[cmCTest::MEMCHECK_TEST] = 1;
|
m_Tests[cmCTest::MEMCHECK_TEST] = 1;
|
||||||
}
|
}
|
||||||
|
else if ( cmSystemTools::LowerCase(ttype) == "notes" )
|
||||||
|
{
|
||||||
|
m_Tests[cmCTest::NOTES_TEST] = 1;
|
||||||
|
}
|
||||||
else if ( cmSystemTools::LowerCase(ttype) == "submit" )
|
else if ( cmSystemTools::LowerCase(ttype) == "submit" )
|
||||||
{
|
{
|
||||||
m_Tests[cmCTest::SUBMIT_TEST] = 1;
|
m_Tests[cmCTest::SUBMIT_TEST] = 1;
|
||||||
@ -924,7 +928,8 @@ int cmCTest::ConfigureDirectory()
|
|||||||
std::ofstream os;
|
std::ofstream os;
|
||||||
if ( !this->OpenOutputFile(m_CurrentTag, "Configure.xml", os) )
|
if ( !this->OpenOutputFile(m_CurrentTag, "Configure.xml", os) )
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot open log file" << std::endl;
|
std::cerr << "Cannot open configure file" << std::endl;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
std::string start_time = ::CurrentTime();
|
std::string start_time = ::CurrentTime();
|
||||||
|
|
||||||
@ -2194,6 +2199,10 @@ int cmCTest::SubmitResults()
|
|||||||
{
|
{
|
||||||
files.push_back("Purify.xml");
|
files.push_back("Purify.xml");
|
||||||
}
|
}
|
||||||
|
if ( this->CTestFileExists("Notes.xml") )
|
||||||
|
{
|
||||||
|
files.push_back("Notes.xml");
|
||||||
|
}
|
||||||
cmCTestSubmit submit;
|
cmCTestSubmit submit;
|
||||||
submit.SetVerbose(m_Verbose);
|
submit.SetVerbose(m_Verbose);
|
||||||
if ( m_DartConfiguration["DropMethod"] == "" ||
|
if ( m_DartConfiguration["DropMethod"] == "" ||
|
||||||
@ -3259,3 +3268,81 @@ bool cmCTest::ProcessMemCheckOutput(const std::string& str, std::string& log, in
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cmCTest::GenerateDartNotesOutput(std::ostream& os, const cmCTest::tm_VectorOfStrings& files)
|
||||||
|
{
|
||||||
|
cmCTest::tm_VectorOfStrings::const_iterator it;
|
||||||
|
for ( it = files.begin(); it != files.end(); it ++ )
|
||||||
|
{
|
||||||
|
if ( !cmSystemTools::FileExists(it->c_str()) )
|
||||||
|
{
|
||||||
|
std::cerr << "Error creating notes. File " << it->c_str() << " does not exists" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
|
<< "<?xml-stylesheet type=\"text/xsl\" href=\"Dart/Source/Server/XSL/Build.xsl <file:///Dart/Source/Server/XSL/Build.xsl> \"?>\n"
|
||||||
|
<< "<Site BuildName=\"" << m_DartConfiguration["BuildName"] << "\" BuildStamp=\""
|
||||||
|
<< m_CurrentTag << "-" << this->GetTestModelString() << "\" Name=\""
|
||||||
|
<< m_DartConfiguration["Site"] << "\">\n"
|
||||||
|
<< "<Notes>" << std::endl;
|
||||||
|
|
||||||
|
for ( it = files.begin(); it != files.end(); it ++ )
|
||||||
|
{
|
||||||
|
std::cout << "\tAdd file: " << it->c_str() << std::endl;
|
||||||
|
std::string note_time = ::CurrentTime();
|
||||||
|
os << "<Note>\n"
|
||||||
|
<< "<DateTime>" << note_time << "</DateTime>\n"
|
||||||
|
<< "<Text>" << std::endl;
|
||||||
|
std::ifstream ifs(it->c_str());
|
||||||
|
if ( ifs )
|
||||||
|
{
|
||||||
|
std::string line;
|
||||||
|
while ( cmSystemTools::GetLineFromStream(ifs, line) )
|
||||||
|
{
|
||||||
|
os << this->MakeXMLSafe(line) << std::endl;
|
||||||
|
}
|
||||||
|
ifs.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << "Problem reading file: " << it->c_str() << std::endl;
|
||||||
|
std::cerr << "Problem reading file: " << it->c_str() << " while creating notes" << std::endl;
|
||||||
|
}
|
||||||
|
os << "</Text>\n"
|
||||||
|
<< "</Note>" << std::endl;
|
||||||
|
}
|
||||||
|
os << "</Notes>\n"
|
||||||
|
<< "</Site>" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmCTest::GenerateNotesFile(const char* cfiles)
|
||||||
|
{
|
||||||
|
if ( !cfiles )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cmStdString> files;
|
||||||
|
|
||||||
|
std::cout << "Create notes file" << std::endl;
|
||||||
|
|
||||||
|
files = cmSystemTools::SplitString(cfiles, ';');
|
||||||
|
if ( files.size() == 0 )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ofstream ofs;
|
||||||
|
if ( !this->OpenOutputFile(m_CurrentTag, "Notes.xml", ofs) )
|
||||||
|
{
|
||||||
|
std::cerr << "Cannot open notes file" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->GenerateDartNotesOutput(ofs, files);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,8 @@ public:
|
|||||||
CONTINUOUS
|
CONTINUOUS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int GenerateNotesFile(const char* files);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
FIRST_TEST = 0,
|
FIRST_TEST = 0,
|
||||||
@ -148,8 +150,9 @@ private:
|
|||||||
COVERAGE_TEST = 6,
|
COVERAGE_TEST = 6,
|
||||||
MEMCHECK_TEST = 7,
|
MEMCHECK_TEST = 7,
|
||||||
SUBMIT_TEST = 8,
|
SUBMIT_TEST = 8,
|
||||||
ALL_TEST = 9,
|
NOTES_TEST = 9,
|
||||||
LAST_TEST = 10
|
ALL_TEST = 10,
|
||||||
|
LAST_TEST = 11
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { // Program statuses
|
enum { // Program statuses
|
||||||
@ -313,6 +316,9 @@ private:
|
|||||||
//! End CTest XML output file
|
//! End CTest XML output file
|
||||||
void EndXML(std::ostream& ostr);
|
void EndXML(std::ostream& ostr);
|
||||||
|
|
||||||
|
//! Create not from files.
|
||||||
|
int GenerateDartNotesOutput(std::ostream& os, const tm_VectorOfStrings& files);
|
||||||
|
|
||||||
//! Parse Valgrind/Purify/Bounds Checker result out of the output string. After running,
|
//! Parse Valgrind/Purify/Bounds Checker result out of the output string. After running,
|
||||||
// log holds the output and results hold the different memmory errors.
|
// log holds the output and results hold the different memmory errors.
|
||||||
bool ProcessMemCheckOutput(const std::string& str, std::string& log, int* results);
|
bool ProcessMemCheckOutput(const std::string& str, std::string& log, int* results);
|
||||||
|
@ -79,6 +79,8 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
|
|||||||
"ctest will do what is required to create and run a dashboard. This "
|
"ctest will do what is required to create and run a dashboard. This "
|
||||||
"option basically sets up a dashboard and then runs ctest -D with the "
|
"option basically sets up a dashboard and then runs ctest -D with the "
|
||||||
"appropriate options."},
|
"appropriate options."},
|
||||||
|
{"-A <Notes file>", "Add a notes file with submission",
|
||||||
|
"This option tells ctest to include a notes file when submitting dashboard. "},
|
||||||
{0,0,0}
|
{0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -376,6 +378,16 @@ int main (int argc, char *argv[])
|
|||||||
inst.m_ExcludeRegExp = args[i+1];
|
inst.m_ExcludeRegExp = args[i+1];
|
||||||
inst.m_UseExcludeRegExpFirst = inst.m_UseIncludeRegExp ? false : true;
|
inst.m_UseExcludeRegExpFirst = inst.m_UseIncludeRegExp ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(arg.find("-A",0) == 0 && i < args.size() - 1)
|
||||||
|
{
|
||||||
|
inst.m_DartMode = true;
|
||||||
|
inst.SetTest("Notes");
|
||||||
|
inst.Initialize();
|
||||||
|
int ires = inst.GenerateNotesFile(args[i+1].c_str());
|
||||||
|
inst.Finalize();
|
||||||
|
return ires;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// call process directory
|
// call process directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user