[Cmake-commits] CMake branch, next, updated. v3.3.1-3041-g19d6c7b
Brad King
brad.king at kitware.com
Thu Sep 17 11:14:00 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 19d6c7b3a63a4ebb655507424e6116ed576ffc98 (commit)
via 8ed641f0e562f9406f6c301562866a46093e1806 (commit)
via b671db13f6b02650459380a0a23eb36cead25bb4 (commit)
from cf6b25fc0bcb78685da6299dddd1190eaa3ef910 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19d6c7b3a63a4ebb655507424e6116ed576ffc98
commit 19d6c7b3a63a4ebb655507424e6116ed576ffc98
Merge: cf6b25f 8ed641f
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 17 11:13:59 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 17 11:13:59 2015 -0400
Merge topic 'ctest-custom-output-size' into next
8ed641f0 CTest: Add options to limit output of passed and failed tests
b671db13 CTest: Document and test custom output size settings
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8ed641f0e562f9406f6c301562866a46093e1806
commit 8ed641f0e562f9406f6c301562866a46093e1806
Author: Roman Wüger <roman.wueger at gmx.at>
AuthorDate: Thu Sep 17 11:06:27 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 17 11:09:04 2015 -0400
CTest: Add options to limit output of passed and failed tests
Add ctest command-line options:
--test-output-size-passed <n>
--test-output-size-failed <n>
to set the amount of test output to store in Test.xml as a command-line
dashboard client.
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 50c856a..2fdf7f3 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -302,6 +302,12 @@ Options
``--test-command``
The test to run with the --build-and-test option.
+``--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.
+
``--test-timeout``
The time limit in seconds, internal use only.
diff --git a/Help/release/dev/ctest-custom-output-size.rst b/Help/release/dev/ctest-custom-output-size.rst
new file mode 100644
index 0000000..8098b93
--- /dev/null
+++ b/Help/release/dev/ctest-custom-output-size.rst
@@ -0,0 +1,7 @@
+ctest-custom-output-size
+------------------------
+
+* :manual:`ctest(1)` learned options
+ ``--test-output-size-passed`` and ``--test-output-size-failed``
+ to customize the limit on test output size submitted when
+ running as a :ref:`Dashboard Client`.
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."},
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index dfc1e33..00895cc 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -108,3 +108,20 @@ run_TestLoad(test-load-invalid 'two')
run_TestLoad(test-load-pass 10)
unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING})
+
+function(run_TestOutputSize)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestOutputSize)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+ add_test(PassingTest \"${CMAKE_COMMAND}\" -E echo PassingTestOutput)
+ add_test(FailingTest \"${CMAKE_COMMAND}\" -E no_such_command)
+")
+ run_cmake_command(TestOutputSize
+ ${CMAKE_CTEST_COMMAND} -M Experimental -T Test
+ --test-output-size-passed 10
+ --test-output-size-failed 12
+ )
+endfunction()
+run_TestOutputSize()
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
new file mode 100644
index 0000000..23fdc97
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
@@ -0,0 +1,22 @@
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ if("${test_xml}" MATCHES [[<Test Status="passed">([^<]|<[^/]|</[^T])*</Test>]])
+ set(test_passed "${CMAKE_MATCH_0}")
+ if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}")
+ endif()
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a passed test:\n ${test_xml}")
+ endif()
+ if("${test_xml}" MATCHES [[<Test Status="failed">([^<]|<[^/]|</[^T])*</Test>]])
+ set(test_failed "${CMAKE_MATCH_0}")
+ if(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}")
+ endif()
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a failed test:\n ${test_xml}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt
@@ -0,0 +1 @@
+.
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
new file mode 100644
index 0000000..ba4235d
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
@@ -0,0 +1 @@
+Errors while running CTest
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b671db13f6b02650459380a0a23eb36cead25bb4
commit b671db13f6b02650459380a0a23eb36cead25bb4
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 17 10:55:56 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 17 11:05:25 2015 -0400
CTest: Document and test custom output size settings
Add documentation and tests for the existing
CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
CTest variables.
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst
index 162db69..412e323 100644
--- a/Help/command/ctest_test.rst
+++ b/Help/command/ctest_test.rst
@@ -85,3 +85,6 @@ The options are:
been printed to the console. Output from the underlying test command is not
affected. Summary info detailing the percentage of passing tests is also
unaffected by the ``QUIET`` option.
+
+See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE`
+and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables.
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index e0dbdeb..660d544 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -374,6 +374,8 @@ Variables for CTest
/variable/CTEST_COVERAGE_COMMAND
/variable/CTEST_COVERAGE_EXTRA_FLAGS
/variable/CTEST_CURL_OPTIONS
+ /variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
+ /variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
/variable/CTEST_CVS_CHECKOUT
/variable/CTEST_CVS_COMMAND
/variable/CTEST_CVS_UPDATE_OPTIONS
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
new file mode 100644
index 0000000..1b4bb01
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
@@ -0,0 +1,6 @@
+CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
+--------------------------------------------
+
+Specify the maximum amount of output from a failed test that will
+be collected by the :command:`ctest_test` command. If not set,
+the default is 300 KiB.
diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
new file mode 100644
index 0000000..168e84e
--- /dev/null
+++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
@@ -0,0 +1,6 @@
+CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
+--------------------------------------------
+
+Specify the maximum amount of output from a passed test that will
+be collected by the :command:`ctest_test` command. If not set,
+the default is 1 KiB.
diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
index cedf379..e61b556 100644
--- a/Tests/RunCMake/ctest_test/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in
@@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1)
project(CTestTest at CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
+ at CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 76dc143..e2f380c 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -59,3 +59,18 @@ function(run_TestChangeId)
run_ctest(TestChangeId)
endfunction()
run_TestChangeId()
+
+function(run_TestOutputSize)
+ set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion)
+ set(CASE_TEST_PREFIX_CODE [[
+set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10)
+set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 12)
+ ]])
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput)
+add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command)
+ ]])
+
+ run_ctest(TestOutputSize)
+endfunction()
+run_TestOutputSize()
diff --git a/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
new file mode 100644
index 0000000..23fdc97
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
@@ -0,0 +1,22 @@
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ if("${test_xml}" MATCHES [[<Test Status="passed">([^<]|<[^/]|</[^T])*</Test>]])
+ set(test_passed "${CMAKE_MATCH_0}")
+ if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}")
+ endif()
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a passed test:\n ${test_xml}")
+ endif()
+ if("${test_xml}" MATCHES [[<Test Status="failed">([^<]|<[^/]|</[^T])*</Test>]])
+ set(test_failed "${CMAKE_MATCH_0}")
+ if(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}")
+ endif()
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a failed test:\n ${test_xml}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()
-----------------------------------------------------------------------
Summary of changes:
Help/command/ctest_test.rst | 3 ++
Help/manual/cmake-variables.7.rst | 2 +
Help/manual/ctest.1.rst | 6 +++
Help/release/dev/ctest-custom-output-size.rst | 7 ++++
...TEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst | 6 +++
...TEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst | 6 +++
Source/CTest/cmCTestTestHandler.h | 5 +++
Source/cmCTest.cxx | 41 +++++++++++++++++++-
Source/ctest.cxx | 4 ++
Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 17 ++++++++
.../CTestCommandLine/TestOutputSize-check.cmake | 22 +++++++++++
.../CTestCommandLine/TestOutputSize-result.txt | 1 +
.../CTestCommandLine/TestOutputSize-stderr.txt | 1 +
Tests/RunCMake/ctest_test/CMakeLists.txt.in | 1 +
Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 15 +++++++
.../RunCMake/ctest_test/TestOutputSize-check.cmake | 22 +++++++++++
16 files changed, 158 insertions(+), 1 deletion(-)
create mode 100644 Help/release/dev/ctest-custom-output-size.rst
create mode 100644 Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst
create mode 100644 Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst
create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt
create mode 100644 Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt
create mode 100644 Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list