Add LastBuild.log file, fix some minor problems in output, modify output a bit...
This commit is contained in:
parent
d8167fb7fd
commit
461a3d2089
@ -464,37 +464,23 @@ int ctest::BuildDirectory()
|
|||||||
// Add parsing of output for errors and warnings.
|
// Add parsing of output for errors and warnings.
|
||||||
|
|
||||||
cmCTestBuildErrorWarning cerw;
|
cmCTestBuildErrorWarning cerw;
|
||||||
char* coutput = new char[ output.size() + 1];
|
|
||||||
memcpy(coutput, output.c_str(), output.size());
|
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
std::vector<std::string> lines;
|
std::ofstream ofs;
|
||||||
|
if ( this->OpenFile("Temporary", "LastBuild.log", ofs) )
|
||||||
|
{
|
||||||
|
ofs << output;
|
||||||
|
ofs.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cmStdString> lines;
|
||||||
|
cmSystemTools::Split(output.c_str(), lines);
|
||||||
|
|
||||||
// Lines are marked:
|
// Lines are marked:
|
||||||
// 0 - nothing
|
// 0 - nothing
|
||||||
// 1 - error
|
// 1 - error
|
||||||
// > 1 - warning
|
// > 1 - warning
|
||||||
std::vector<int> markedLines;
|
std::vector<int> markedLines(lines.size(), 0);
|
||||||
cmIStringStream istr(coutput);
|
|
||||||
while(istr)
|
|
||||||
{
|
|
||||||
char buffer[1024];
|
|
||||||
std::string line;
|
|
||||||
while ( istr )
|
|
||||||
{
|
|
||||||
buffer[0] = 0;
|
|
||||||
istr.getline(buffer, 1023);
|
|
||||||
buffer[1023] = 0;
|
|
||||||
line += buffer;
|
|
||||||
if ( strlen(buffer) < 1023 )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lines.push_back(line);
|
|
||||||
markedLines.push_back(0);
|
|
||||||
//std::cout << "Line [" << line << "]" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Errors
|
// Errors
|
||||||
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
|
for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ )
|
||||||
@ -595,7 +581,23 @@ int ctest::BuildDirectory()
|
|||||||
errorsWarnings.push_back(errorwarning);
|
errorsWarnings.push_back(errorwarning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !this->OpenFile("", "Build.xml", ofs) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
this->GenerateDartBuildOutput(ofs, errorsWarnings);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ctest::OpenFile(const std::string& path,
|
||||||
|
const std::string& name, std::ofstream& stream)
|
||||||
|
{
|
||||||
std::string testingDir = m_ToplevelPath + "/Testing/CDart";
|
std::string testingDir = m_ToplevelPath + "/Testing/CDart";
|
||||||
|
if ( path.size() > 0 )
|
||||||
|
{
|
||||||
|
testingDir += "/" + path;
|
||||||
|
}
|
||||||
if ( cmSystemTools::FileExists(testingDir.c_str()) )
|
if ( cmSystemTools::FileExists(testingDir.c_str()) )
|
||||||
{
|
{
|
||||||
if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) )
|
if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) )
|
||||||
@ -603,7 +605,7 @@ int ctest::BuildDirectory()
|
|||||||
std::cerr << "File " << testingDir
|
std::cerr << "File " << testingDir
|
||||||
<< " is in the place of the testing directory"
|
<< " is in the place of the testing directory"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -612,21 +614,19 @@ int ctest::BuildDirectory()
|
|||||||
{
|
{
|
||||||
std::cerr << "Cannot create directory " << testingDir
|
std::cerr << "Cannot create directory " << testingDir
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string buildxml = testingDir + "/Build.xml";
|
std::string filename = testingDir + "/" + name;
|
||||||
std::ofstream ofs(buildxml.c_str());
|
stream.open(filename.c_str());
|
||||||
if( !ofs )
|
if( !stream )
|
||||||
{
|
{
|
||||||
std::cerr << "Cannot create build XML file" << std::endl;
|
std::cerr << "Cannot create build XML file" << std::endl;
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
this->GenerateDartBuildOutput(ofs, errorsWarnings);
|
return true;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctest::GenerateDartBuildOutput(std::ostream& os,
|
void ctest::GenerateDartBuildOutput(std::ostream& os,
|
||||||
std::vector<cmCTestBuildErrorWarning> ew)
|
std::vector<cmCTestBuildErrorWarning> ew)
|
||||||
{
|
{
|
||||||
@ -635,7 +635,7 @@ void ctest::GenerateDartBuildOutput(std::ostream& os,
|
|||||||
<< "\" BuildStamp=\"" << m_CurrentTag << "-Experimental\" Name=\""
|
<< "\" BuildStamp=\"" << m_CurrentTag << "-Experimental\" Name=\""
|
||||||
<< m_DartConfiguration["Site"] << "\">\n"
|
<< m_DartConfiguration["Site"] << "\">\n"
|
||||||
<< "<Build>\n"
|
<< "<Build>\n"
|
||||||
<< " <StartDateTime>" << m_StartBuild << "</StartDateTime>\n"
|
<< "\t<StartDateTime>" << m_StartBuild << "</StartDateTime>\n"
|
||||||
<< "<BuildCommand>" << m_DartConfiguration["MakeCommand"]
|
<< "<BuildCommand>" << m_DartConfiguration["MakeCommand"]
|
||||||
<< "</BuildCommand>" << std::endl;
|
<< "</BuildCommand>" << std::endl;
|
||||||
|
|
||||||
@ -643,31 +643,32 @@ void ctest::GenerateDartBuildOutput(std::ostream& os,
|
|||||||
for ( it = ew.begin(); it != ew.end(); it++ )
|
for ( it = ew.begin(); it != ew.end(); it++ )
|
||||||
{
|
{
|
||||||
cmCTestBuildErrorWarning *cm = &(*it);
|
cmCTestBuildErrorWarning *cm = &(*it);
|
||||||
os << " <" << (cm->m_Error ? "Error" : "Warning") << ">\n"
|
os << "\t<" << (cm->m_Error ? "Error" : "Warning") << ">\n"
|
||||||
<< " <BuildLogLine>" << cm->m_LogLine << "</BuildLogLine>\n"
|
<< "\t\t<BuildLogLine>" << cm->m_LogLine << "</BuildLogLine>\n"
|
||||||
<< " <Text>" << cm->m_Text << "</Text>" << std::endl;
|
<< "\t\t<Text>" << cm->m_Text << "\n</Text>" << std::endl;
|
||||||
if ( cm->m_SourceFile.size() > 0 )
|
if ( cm->m_SourceFile.size() > 0 )
|
||||||
{
|
{
|
||||||
os << " <SourceFile>" << cm->m_SourceFile << "</SourceFile>"
|
os << "\t\t<SourceFile>" << cm->m_SourceFile << "</SourceFile>"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
if ( cm->m_SourceFileTail.size() > 0 )
|
if ( cm->m_SourceFileTail.size() > 0 )
|
||||||
{
|
{
|
||||||
os << " <SourceFileTail>" << cm->m_SourceFileTail
|
os << "\t\t<SourceFileTail>" << cm->m_SourceFileTail
|
||||||
<< "</SourceFileTail>" << std::endl;
|
<< "</SourceFileTail>" << std::endl;
|
||||||
}
|
}
|
||||||
if ( cm->m_LineNumber >= 0 )
|
if ( cm->m_LineNumber >= 0 )
|
||||||
{
|
{
|
||||||
os << " <SourceLineNumber>" << cm->m_LineNumber
|
os << "\t\t<SourceLineNumber>" << cm->m_LineNumber
|
||||||
<< "</SourceLineNumber>" << std::endl;
|
<< "</SourceLineNumber>" << std::endl;
|
||||||
}
|
}
|
||||||
os << " <PreContext>" << cm->m_PreContext << "</PreContext>\n"
|
os << "\t\t<PreContext>" << cm->m_PreContext << "\n</PreContext>\n"
|
||||||
<< " <PostContext>" << cm->m_PostContext << "</PostContext>\n"
|
<< "\t\t<PostContext>" << cm->m_PostContext << "\n</PostContext>\n"
|
||||||
<< " </" << (cm->m_Error ? "Error" : "Warning") << ">"
|
<< "\t\t<RepeatCount>0</RepeatCount>\n"
|
||||||
|
<< "</" << (cm->m_Error ? "Error" : "Warning") << ">\n\n"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
os << " <Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n </Log>\n"
|
os << "\t<Log Encoding=\"base64\" Compression=\"/bin/gzip\">\n\t</Log>\n"
|
||||||
<< " <EndDateTime>" << m_EndBuild << "</EndDateTime>\n"
|
<< "\t<EndDateTime>" << m_EndBuild << "</EndDateTime>\n"
|
||||||
<< "</Build>\n"
|
<< "</Build>\n"
|
||||||
<< "</Site>" << std::endl;
|
<< "</Site>" << std::endl;
|
||||||
}
|
}
|
||||||
@ -966,7 +967,7 @@ void ctest::GenerateDartOutput(std::ostream& os)
|
|||||||
<< "name=\"Completion Status\"><Value>"
|
<< "name=\"Completion Status\"><Value>"
|
||||||
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n"
|
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n"
|
||||||
<< " <Measurement>\n"
|
<< " <Measurement>\n"
|
||||||
<< " <Value>" << result->m_Output << "</value>\n"
|
<< " <Value>" << result->m_Output << "</Value>\n"
|
||||||
<< " </Measurement>\n"
|
<< " </Measurement>\n"
|
||||||
<< " </Results>\n"
|
<< " </Results>\n"
|
||||||
<< " </Test>" << std::endl;
|
<< " </Test>" << std::endl;
|
||||||
|
@ -149,5 +149,7 @@ private:
|
|||||||
void GenerateDartBuildOutput(std::ostream& os,
|
void GenerateDartBuildOutput(std::ostream& os,
|
||||||
std::vector<cmCTestBuildErrorWarning>);
|
std::vector<cmCTestBuildErrorWarning>);
|
||||||
|
|
||||||
|
bool OpenFile(const std::string& path,
|
||||||
|
const std::string& name, std::ofstream& stream);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user