ENH: really Bill, using Ken's checkout, fix output in ctest so clean output in build and test is not lost, also display the command lines used

This commit is contained in:
Ken Martin 2008-02-01 16:05:40 -05:00
parent 0dac20cd20
commit 22835a71cd
1 changed files with 39 additions and 6 deletions

View File

@ -998,17 +998,27 @@ int cmGlobalGenerator::Build(
bool clean, bool fast, bool clean, bool fast,
double timeout) double timeout)
{ {
*output += "\nTesting TryCompileWithoutMakefile\n";
/** /**
* Run an executable command and put the stdout in output. * Run an executable command and put the stdout in output.
*/ */
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(bindir); cmSystemTools::ChangeDirectory(bindir);
if(output)
{
*output += "Change Dir: ";
*output += bindir;
*output += "\n";
}
int retVal; int retVal;
bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); bool hideconsole = cmSystemTools::GetRunCommandHideConsole();
cmSystemTools::SetRunCommandHideConsole(true); cmSystemTools::SetRunCommandHideConsole(true);
std::string outputBuffer;
std::string* outputPtr = 0;
if(output)
{
outputPtr = &outputBuffer;
}
// should we do a clean first? // should we do a clean first?
if (clean) if (clean)
@ -1016,13 +1026,21 @@ int cmGlobalGenerator::Build(
std::string cleanCommand = std::string cleanCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName, this->GenerateBuildCommand(makeCommandCSTR, projectName,
0, "clean", config, false, fast); 0, "clean", config, false, fast);
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), output, if(output)
{
*output += "\nRun Clean Command:";
*output += cleanCommand;
*output += "\n";
}
if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), outputPtr,
&retVal, 0, false, timeout)) &retVal, 0, false, timeout))
{ {
cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error("Generator: execution of make clean failed."); cmSystemTools::Error("Generator: execution of make clean failed.");
if (output) if (output)
{ {
*output += *outputPtr;
*output += "\nGenerator: execution of make clean failed.\n"; *output += "\nGenerator: execution of make clean failed.\n";
} }
@ -1030,13 +1048,24 @@ int cmGlobalGenerator::Build(
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 1; return 1;
} }
if (output)
{
*output += *outputPtr;
}
} }
// now build // now build
std::string makeCommand = std::string makeCommand =
this->GenerateBuildCommand(makeCommandCSTR, projectName, this->GenerateBuildCommand(makeCommandCSTR, projectName,
0, target, config, false, fast); 0, target, config, false, fast);
if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, if(output)
{
*output += "\nRun Build Command:";
*output += makeCommand;
*output += "\n";
}
if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), outputPtr,
&retVal, 0, false, timeout)) &retVal, 0, false, timeout))
{ {
cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::SetRunCommandHideConsole(hideconsole);
@ -1045,6 +1074,7 @@ int cmGlobalGenerator::Build(
makeCommand.c_str()); makeCommand.c_str());
if (output) if (output)
{ {
*output += *outputPtr;
*output += "\nGenerator: execution of make failed. Make command was: " *output += "\nGenerator: execution of make failed. Make command was: "
+ makeCommand + "\n"; + makeCommand + "\n";
} }
@ -1053,7 +1083,10 @@ int cmGlobalGenerator::Build(
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 1; return 1;
} }
if (output)
{
*output += *outputPtr;
}
cmSystemTools::SetRunCommandHideConsole(hideconsole); cmSystemTools::SetRunCommandHideConsole(hideconsole);
// The SGI MipsPro 7.3 compiler does not return an error code when // The SGI MipsPro 7.3 compiler does not return an error code when