From 43fe0d3978a81b74be42c0e975bdfe0092778b48 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 22 Sep 2008 14:04:13 -0400 Subject: [PATCH] ENH: add max width option to ctest ouptut --- Source/CTest/cmCTestTestHandler.cxx | 5 +++-- Source/cmCTest.cxx | 12 ++++++++++++ Source/cmCTest.h | 8 +++++++- Source/ctest.cxx | 5 ++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 83d882b42..f8084a956 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -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; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 012571f92..c3033de34 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 01d3b424c..a33746080 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -168,7 +168,11 @@ 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; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index ddd22adb4..9401574bc 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -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 ", "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 "