ENH: clean up output
This commit is contained in:
parent
67f1dab2b5
commit
c47409d9e9
|
@ -3851,6 +3851,7 @@ void CMakeStdoutCallback(const char* m, int len, void* s)
|
||||||
int cmCTest::RunCMakeAndTest(std::string* outstring)
|
int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
{
|
{
|
||||||
cmSystemTools::ResetErrorOccuredFlag();
|
cmSystemTools::ResetErrorOccuredFlag();
|
||||||
|
cmListFileCache::GetInstance()->ClearCache();
|
||||||
std::string cmakeOutString;
|
std::string cmakeOutString;
|
||||||
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &cmakeOutString);
|
cmSystemTools::SetErrorCallback(CMakeMessageCallback, &cmakeOutString);
|
||||||
cmSystemTools::SetStdoutCallback(CMakeStdoutCallback, &cmakeOutString);
|
cmSystemTools::SetStdoutCallback(CMakeStdoutCallback, &cmakeOutString);
|
||||||
|
@ -3888,38 +3889,54 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
}
|
}
|
||||||
if (cm.Run(args) != 0)
|
if (cm.Run(args) != 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cmake execution failed\n";
|
out << "Error: cmake execution failed\n";
|
||||||
std::cerr << cmakeOutString << "\n";
|
out << cmakeOutString << "\n";
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
|
if(outstring)
|
||||||
|
{
|
||||||
|
*outstring = out.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << out << "\n";
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(m_BuildTwoConfig)
|
if(m_BuildTwoConfig)
|
||||||
{
|
{
|
||||||
if (cm.Run(args) != 0)
|
if (cm.Run(args) != 0)
|
||||||
{
|
{
|
||||||
std::cerr << "Error: cmake execution failed\n";
|
out << "Error: cmake execution failed\n";
|
||||||
std::cerr << cmakeOutString << "\n";
|
out << cmakeOutString << "\n";
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
|
if(outstring)
|
||||||
|
{
|
||||||
|
*outstring = out.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << out << "\n";
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmSystemTools::SetErrorCallback(0, 0);
|
cmSystemTools::SetErrorCallback(0, 0);
|
||||||
|
out << cmakeOutString << "\n";
|
||||||
|
if(m_BuildMakeProgram.size() == 0)
|
||||||
|
{
|
||||||
|
out << "Error: cmake does not have a valid MAKEPROGRAM\n";
|
||||||
|
out << "Did you specify a --build-makeprogram and a --build-generator?\n";
|
||||||
if(outstring)
|
if(outstring)
|
||||||
{
|
{
|
||||||
*outstring += cmakeOutString;
|
*outstring = out.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << cmakeOutString << "\n";
|
std::cerr << out << "\n";
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
cmListFileCache::GetInstance()->ClearCache();
|
|
||||||
if(m_BuildMakeProgram.size() == 0)
|
|
||||||
{
|
|
||||||
std::cerr << "Error: cmake does not have a valid MAKEPROGRAM\n";
|
|
||||||
std::cerr << "Did you specify a --build-makeprogram and a --build-generator?\n";
|
|
||||||
}
|
}
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
std::string makeCommand = cmSystemTools::ConvertToOutputPath(m_BuildMakeProgram.c_str());
|
std::string makeCommand = cmSystemTools::ConvertToOutputPath(m_BuildMakeProgram.c_str());
|
||||||
|
@ -4001,6 +4018,7 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
out << output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_BuildTarget.size())
|
if(m_BuildTarget.size())
|
||||||
|
@ -4036,6 +4054,7 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
{
|
{
|
||||||
if(outstring)
|
if(outstring)
|
||||||
{
|
{
|
||||||
|
*outstring = out.str();
|
||||||
*outstring += "Building of project failed\n";
|
*outstring += "Building of project failed\n";
|
||||||
*outstring += output;
|
*outstring += output;
|
||||||
*outstring += "\n";
|
*outstring += "\n";
|
||||||
|
@ -4043,20 +4062,25 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Building of project failed\n";
|
std::cerr << "Building of project failed\n";
|
||||||
std::cout << output << "\n";
|
std::cerr << out << output << "\n";
|
||||||
}
|
}
|
||||||
// return to the original directory
|
// return to the original directory
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outstring)
|
out << output;
|
||||||
{
|
|
||||||
*outstring += output;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_TestCommand.size() == 0)
|
if(m_TestCommand.size() == 0)
|
||||||
{
|
{
|
||||||
|
if(outstring)
|
||||||
|
{
|
||||||
|
*outstring = out.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << out << "\n";
|
||||||
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4138,7 +4162,7 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
}
|
}
|
||||||
if(outstring)
|
if(outstring)
|
||||||
{
|
{
|
||||||
*outstring += out.str();
|
*outstring = out.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4153,7 +4177,6 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
testCommand.push_back(fullPath.c_str());
|
testCommand.push_back(fullPath.c_str());
|
||||||
for(k=0; k < m_TestCommandArgs.size(); ++k)
|
for(k=0; k < m_TestCommandArgs.size(); ++k)
|
||||||
{
|
{
|
||||||
out << m_TestCommandArgs[k].c_str() << "\n";
|
|
||||||
testCommand.push_back(m_TestCommandArgs[k].c_str());
|
testCommand.push_back(m_TestCommandArgs[k].c_str());
|
||||||
}
|
}
|
||||||
testCommand.push_back(0);
|
testCommand.push_back(0);
|
||||||
|
@ -4169,7 +4192,7 @@ int cmCTest::RunCMakeAndTest(std::string* outstring)
|
||||||
out << outs << "\n";
|
out << outs << "\n";
|
||||||
if(outstring)
|
if(outstring)
|
||||||
{
|
{
|
||||||
*outstring += out.str();
|
*outstring = out.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue