ENH: Be more verbose

This commit is contained in:
Andy Cedilnik 2005-06-10 09:01:37 -04:00
parent cf4ed39140
commit ab313ca547
2 changed files with 30 additions and 6 deletions

View File

@ -500,13 +500,13 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
} }
argv.push_back(0); argv.push_back(0);
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:"); cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, "Run command:");
std::vector<const char*>::iterator ait; std::vector<const char*>::iterator ait;
for ( ait = argv.begin(); ait != argv.end(); ++ ait ) for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait )
{ {
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\""); cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\"");
} }
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, std::endl); cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
// Now create process object // Now create process object
cmsysProcess* cp = cmsysProcess_New(); cmsysProcess* cp = cmsysProcess_New();
@ -589,7 +589,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
errorwarning.m_Error = true; errorwarning.m_Error = true;
m_ErrorsAndWarnings.push_back(errorwarning); m_ErrorsAndWarnings.push_back(errorwarning);
m_TotalErrors ++; m_TotalErrors ++;
cmCTestLog(this, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl); cmCTestLog(m_CTest, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl);
} }
cmsysProcess_Delete(cp); cmsysProcess_Delete(cp);

View File

@ -753,10 +753,16 @@ int cmCTest::GetTestModelFromString(const char* str)
return cmCTest::EXPERIMENTAL; return cmCTest::EXPERIMENTAL;
} }
//######################################################################
//######################################################################
//######################################################################
//######################################################################
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTest::RunMakeCommand(const char* command, std::string* output, int cmCTest::RunMakeCommand(const char* command, std::string* output,
int* retVal, const char* dir, int timeout, std::ofstream& ofs) int* retVal, const char* dir, int timeout, std::ofstream& ofs)
{ {
// First generate the command and arguments
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command); std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
if(args.size() < 1) if(args.size() < 1)
@ -777,6 +783,15 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
*output = ""; *output = "";
} }
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Run command:");
std::vector<const char*>::iterator ait;
for ( ait = argv.begin(); ait != argv.end() && *ait; ++ ait )
{
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, " \"" << *ait << "\"");
}
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, std::endl);
// Now create process object
cmsysProcess* cp = cmsysProcess_New(); cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin()); cmsysProcess_SetCommand(cp, &*argv.begin());
cmsysProcess_SetWorkingDirectory(cp, dir); cmsysProcess_SetWorkingDirectory(cp, dir);
@ -784,13 +799,15 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
cmsysProcess_SetTimeout(cp, timeout); cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp); cmsysProcess_Execute(cp);
// Initialize tick's
std::string::size_type tick = 0; std::string::size_type tick = 0;
std::string::size_type tick_len = 1024; std::string::size_type tick_len = 1024;
std::string::size_type tick_line_len = 50; std::string::size_type tick_line_len = 50;
char* data; char* data;
int length; int length;
cmCTestLog(this, HANDLER_OUTPUT, " Each . represents " << tick_len << " bytes of output" << std::endl cmCTestLog(this, HANDLER_OUTPUT,
" Each . represents " << tick_len << " bytes of output" << std::endl
<< " " << std::flush); << " " << std::flush);
while(cmsysProcess_WaitForData(cp, &data, &length, 0)) while(cmsysProcess_WaitForData(cp, &data, &length, 0))
{ {
@ -833,6 +850,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
if(result == cmsysProcess_State_Exited) if(result == cmsysProcess_State_Exited)
{ {
*retVal = cmsysProcess_GetExitValue(cp); *retVal = cmsysProcess_GetExitValue(cp);
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Command exited with the value: " << *retVal << std::endl);
} }
else if(result == cmsysProcess_State_Exception) else if(result == cmsysProcess_State_Exception)
{ {
@ -847,6 +865,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
{ {
*output += "\n*** ERROR executing: "; *output += "\n*** ERROR executing: ";
*output += cmsysProcess_GetErrorString(cp); *output += cmsysProcess_GetErrorString(cp);
cmCTestLog(this, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl);
} }
cmsysProcess_Delete(cp); cmsysProcess_Delete(cp);
@ -854,6 +873,11 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
return result; return result;
} }
//######################################################################
//######################################################################
//######################################################################
//######################################################################
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int cmCTest::RunTest(std::vector<const char*> argv, int cmCTest::RunTest(std::vector<const char*> argv,
std::string* output, int *retVal, std::string* output, int *retVal,