diff options
author | Brad King <brad.king@kitware.com> | 2015-09-21 13:25:24 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-21 13:25:24 (GMT) |
commit | 82a0c7be3f6a00119f3ba00b0d1a4f73cbbb140c (patch) | |
tree | 88c11a1cfd7d22ec16d0abda2937c9fbc2b5dff8 /Source | |
parent | 358b56414563d2100bbbb6e482e8441d29fa8f55 (diff) | |
parent | fd47df45030733341858fa33ee96015d64c73c03 (diff) | |
download | CMake-82a0c7be3f6a00119f3ba00b0d1a4f73cbbb140c.zip CMake-82a0c7be3f6a00119f3ba00b0d1a4f73cbbb140c.tar.gz CMake-82a0c7be3f6a00119f3ba00b0d1a4f73cbbb140c.tar.bz2 |
Merge topic 'ctest-custom-output-size'
fd47df45 CTest: Add options to limit output of passed and failed tests
6e3151f6 CTest: Document and test custom output size settings
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 5 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 41 | ||||
-rw-r--r-- | Source/ctest.cxx | 4 |
3 files changed, 49 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 14067d5..c635430 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -65,6 +65,11 @@ public: void SetMaxIndex(int n) {this->MaxIndex = n;} int GetMaxIndex() {return this->MaxIndex;} + void SetTestOutputSizePassed(int n) + { this->CustomMaximumPassedTestOutputSize = n; } + void SetTestOutputSizeFailed(int n) + { this->CustomMaximumFailedTestOutputSize = n; } + ///! pass the -I argument down void SetTestsToRunInformation(const char*); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b2ad4a8..6e55d89 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2165,7 +2165,46 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, { this->OutputTestOutputOnTestFailure = true; } - + if (this->CheckArgument(arg, "--test-output-size-passed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizePassed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-passed': " << + args[i] << "\n"); + } + } + if (this->CheckArgument(arg, "--test-output-size-failed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizeFailed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-failed': " << + args[i] << "\n"); + } + } if(this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index afcbd61..7fa6aed 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -46,6 +46,10 @@ static const char * cmDocumentationOptions[][2] = {"--debug", "Displaying more verbose internals of CTest."}, {"--output-on-failure", "Output anything outputted by the test program " "if the test should fail."}, + {"--test-output-size-passed <size>", "Limit the output for passed tests " + "to <size> bytes"}, + {"--test-output-size-failed <size>", "Limit the output for failed tests " + "to <size> bytes"}, {"-F", "Enable failover."}, {"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the " "given number of jobs."}, |