[Cmake-commits] [cmake-commits] zach.mullen committed cmCTestRunTest.cxx 1.13 1.14 cmProcess.cxx 1.10 1.11 cmProcess.h 1.5 1.6
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Sep 4 13:50:08 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv12424
Modified Files:
cmCTestRunTest.cxx cmProcess.cxx cmProcess.h
Log Message:
Fixed ctest output processing. Should now display output as it occurs, as well as be able to consume multiple lines if they exist within the timeout.
Index: cmProcess.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmProcess.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** cmProcess.cxx 4 Sep 2009 15:23:38 -0000 1.10
--- cmProcess.cxx 4 Sep 2009 17:50:06 -0000 1.11
***************
*** 75,87 ****
}
! bool cmProcess::GetNextOutputLine(std::string& stdOutLine,
! std::string& stdErrLine)
{
if(this->StdErrorBuffer.empty() && this->StdOutBuffer.empty())
{
! return false;
}
stdOutLine = "";
stdErrLine = "";
std::vector<char>::iterator outiter =
this->StdOutBuffer.begin();
--- 75,91 ----
}
! int cmProcess::GetNextOutputLine(std::string& stdOutLine,
! std::string& stdErrLine,
! bool& gotStdOut,
! bool& gotStdErr)
{
if(this->StdErrorBuffer.empty() && this->StdOutBuffer.empty())
{
! return cmsysProcess_Pipe_Timeout;
}
stdOutLine = "";
stdErrLine = "";
+
+ this->LastOutputPipe = cmsysProcess_Pipe_Timeout;
std::vector<char>::iterator outiter =
this->StdOutBuffer.begin();
***************
*** 108,112 ****
this->StdOutBuffer.erase(this->StdOutBuffer.begin(), outiter+1);
this->LastOutputPipe = cmsysProcess_Pipe_STDOUT;
! return true;
}
}
--- 112,117 ----
this->StdOutBuffer.erase(this->StdOutBuffer.begin(), outiter+1);
this->LastOutputPipe = cmsysProcess_Pipe_STDOUT;
! gotStdOut = true;
! break;
}
}
***************
*** 132,144 ****
this->StdErrorBuffer.erase(this->StdErrorBuffer.begin(), erriter+1);
this->LastOutputPipe = cmsysProcess_Pipe_STDERR;
! return true;
}
}
//If we get here, we have stuff waiting in the buffers, but no newline
! return false;
}
// return true if there is a new line of data
// return false if there is no new data
! int cmProcess::CheckOutput(double timeout)
{
// Wait for data from the process.
--- 137,150 ----
this->StdErrorBuffer.erase(this->StdErrorBuffer.begin(), erriter+1);
this->LastOutputPipe = cmsysProcess_Pipe_STDERR;
! gotStdErr = true;
! break;
}
}
//If we get here, we have stuff waiting in the buffers, but no newline
! return this->LastOutputPipe;
}
// return true if there is a new line of data
// return false if there is no new data
! void cmProcess::CheckOutput(double timeout)
{
// Wait for data from the process.
***************
*** 154,165 ****
// Timeout has been exceeded.
this->LastOutputPipe = pipe;
! return pipe;
}
else if(pipe == cmsysProcess_Pipe_STDOUT)
{
! // Append to the stdout buffer.
this->StdOutBuffer.insert(this->StdOutBuffer.end(), data, data+length);
this->LastOutputPipe = pipe;
- return pipe;
}
else if(pipe == cmsysProcess_Pipe_STDERR)
--- 160,170 ----
// Timeout has been exceeded.
this->LastOutputPipe = pipe;
! return;
}
else if(pipe == cmsysProcess_Pipe_STDOUT)
{
! // Append to the stdout buffer.
this->StdOutBuffer.insert(this->StdOutBuffer.end(), data, data+length);
this->LastOutputPipe = pipe;
}
else if(pipe == cmsysProcess_Pipe_STDERR)
***************
*** 169,173 ****
data, data+length);
this->LastOutputPipe = pipe;
- return pipe;
}
else if(pipe == cmsysProcess_Pipe_None)
--- 174,177 ----
***************
*** 177,191 ****
{
this->LastOutputPipe = cmsysProcess_Pipe_STDOUT;
! return this->LastOutputPipe;
}
else if(!this->StdErrorBuffer.empty())
{
this->LastOutputPipe = cmsysProcess_Pipe_STDERR;
! return this->LastOutputPipe;
}
else
{
this->LastOutputPipe = cmsysProcess_Pipe_None;
! return this->LastOutputPipe;
}
}
--- 181,195 ----
{
this->LastOutputPipe = cmsysProcess_Pipe_STDOUT;
! return;
}
else if(!this->StdErrorBuffer.empty())
{
this->LastOutputPipe = cmsysProcess_Pipe_STDERR;
! return;
}
else
{
this->LastOutputPipe = cmsysProcess_Pipe_None;
! return;
}
}
Index: cmCTestRunTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunTest.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmCTestRunTest.cxx 3 Sep 2009 19:33:44 -0000 1.13
--- cmCTestRunTest.cxx 4 Sep 2009 17:50:06 -0000 1.14
***************
*** 39,62 ****
{
std::string out, err;
! int pipe = this->TestProcess->CheckOutput(.1);
//start our timeout for reading the process output
double clock_start = cmSystemTools::GetTime();
! while(this->TestProcess->GetNextOutputLine(out, err))
{
!
! if(pipe == cmsysProcess_Pipe_STDOUT)
! {
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << out << std::endl);
! this->ProcessOutput += out;
! this->ProcessOutput += "\n";
! }
! else if(pipe == cmsysProcess_Pipe_STDERR)
{
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << err << std::endl);
! this->ProcessOutput += err;
! this->ProcessOutput += "\n";
}
//timeout while reading process output (could denote infinite output)
if(cmSystemTools::GetTime() - clock_start > .1)
--- 39,72 ----
{
std::string out, err;
! this->TestProcess->CheckOutput(.1);
//start our timeout for reading the process output
double clock_start = cmSystemTools::GetTime();
! int pipe;
! bool gotStdOut = false;
! bool gotStdErr = false;
! while((pipe = this->TestProcess->
! GetNextOutputLine(out, err, gotStdOut, gotStdErr) )
! != cmsysProcess_Pipe_Timeout)
{
! if(pipe == cmsysProcess_Pipe_STDOUT ||
! pipe == cmsysProcess_Pipe_STDERR)
{
! if(gotStdErr)
! {
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << err << std::endl);
! this->ProcessOutput += err;
! this->ProcessOutput += "\n";
! }
! if(gotStdOut)
! {
! cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
! this->GetIndex() << ": " << out << std::endl);
! this->ProcessOutput += out;
! this->ProcessOutput += "\n";
! }
}
+ gotStdOut = false;
+ gotStdErr = false;
//timeout while reading process output (could denote infinite output)
if(cmSystemTools::GetTime() - clock_start > .1)
Index: cmProcess.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmProcess.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmProcess.h 3 Sep 2009 19:33:44 -0000 1.5
--- cmProcess.h 4 Sep 2009 17:50:06 -0000 1.6
***************
*** 42,46 ****
// return process state
! int CheckOutput(double timeout);
// return the process status
int GetProcessStatus();
--- 42,46 ----
// return process state
! void CheckOutput(double timeout);
// return the process status
int GetProcessStatus();
***************
*** 53,57 ****
int GetExitValue() { return this->ExitValue;}
double GetTotalTime() { return this->TotalTime;}
! bool GetNextOutputLine(std::string& stdOutLine, std::string& stdErrLine);
private:
int LastOutputPipe;
--- 53,58 ----
int GetExitValue() { return this->ExitValue;}
double GetTotalTime() { return this->TotalTime;}
! int GetNextOutputLine(std::string& stdOutLine, std::string& stdErrLine,
! bool& gotStdOut, bool& gotStdErr);
private:
int LastOutputPipe;
More information about the Cmake-commits
mailing list