ENH: add max width option to ctest ouptut

This commit is contained in:
Bill Hoffman 2008-09-22 14:04:13 -04:00
parent ae9f9e6994
commit 43fe0d3978
4 changed files with 26 additions and 4 deletions

View File

@ -644,8 +644,9 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Testing");
}
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
std::string outname = testname;
outname.resize(30, ' ');
const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
std::string outname = testname + " ";
outname.resize(maxTestNameWidth, '.');
*this->LogFile << cnt << "/" << tmsize << " Testing: " << testname
<< std::endl;

View File

@ -249,6 +249,7 @@ cmCTest::cmCTest()
this->ShowOnly = false;
this->RunConfigurationScript = false;
this->TestModel = cmCTest::EXPERIMENTAL;
this->MaxTestNameWidth = 30;
this->InteractiveDebugMode = true;
this->TimeOut = 0;
this->CompressXMLFiles = false;
@ -1721,6 +1722,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
{
this->ForceNewCTestProcess = true;
}
if(this->CheckArgument(arg, "-W", "--max-width") && i < args.size() - 1)
{
i++;
this->MaxTestNameWidth = atoi(args[i].c_str());
}
if(this->CheckArgument(arg, "--interactive-debug-mode") &&
i < args.size() - 1 )
{
@ -2309,6 +2315,12 @@ bool cmCTest::GetShowOnly()
return this->ShowOnly;
}
//----------------------------------------------------------------------
int cmCTest::GetMaxTestNameWidth() const
{
return this->MaxTestNameWidth;
}
//----------------------------------------------------------------------
void cmCTest::SetProduceXML(bool v)
{

View File

@ -168,6 +168,10 @@ public:
///! Should we only show what we would do?
bool GetShowOnly();
///! The max output width
int GetMaxTestNameWidth() const;
/**
* Run a single executable command and put the stdout and stderr
* in output.
@ -373,6 +377,8 @@ private:
double TimeOut;
int MaxTestNameWidth;
std::string ParallelCacheFile;
int ParallelLevel;
int ParallelSubprocessId;

View File

@ -128,8 +128,11 @@ static const char * cmDocumentationOptions[][3] =
{"-U, --union", "Take the Union of -I and -R",
"When both -R and -I are specified by default the intersection of "
"tests are run. By specifying -U the union of tests is run instead."},
{"--max-width <width>", "Set the max width for a test name to output",
"Set the maximum width for each test name to show in the output. This "
"allows the user to widen the output to avoid cliping the test name which "
"can be very annoying."},
{"--interactive-debug-mode [0|1]", "Set the interactive mode to 0 or 1.",
"This option causes ctest to run tests in either an interactive mode or "
"a non-interactive mode. On Windows this means that in non-interactive "
"mode, all system debug pop up windows are blocked. In dashboard mode "