Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
7e86f567
Commit
7e86f567
authored
Jul 06, 2015
by
Brad King
Committed by
Kitware Robot
Jul 06, 2015
Browse files
Merge topic 'show-number-of-tests'
42747fcc
CTest: Show the number of tests for each label in the summary
parents
e5d37f23
42747fcc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/CTest/cmCTestTestHandler.cxx
View file @
7e86f567
...
...
@@ -656,9 +656,8 @@ int cmCTestTestHandler::ProcessHandler()
void
cmCTestTestHandler
::
PrintLabelSummary
()
{
cmCTestTestHandler
::
ListOfTests
::
iterator
it
=
this
->
TestList
.
begin
();
cmCTestTestHandler
::
TestResultsVector
::
iterator
ri
=
this
->
TestResults
.
begin
();
std
::
map
<
std
::
string
,
double
>
labelTimes
;
std
::
map
<
std
::
string
,
int
>
labelCounts
;
std
::
set
<
std
::
string
>
labels
;
// initialize maps
std
::
string
::
size_type
maxlen
=
0
;
...
...
@@ -676,10 +675,12 @@ void cmCTestTestHandler::PrintLabelSummary()
}
labels
.
insert
(
*
l
);
labelTimes
[
*
l
]
=
0
;
labelCounts
[
*
l
]
=
0
;
}
}
}
ri
=
this
->
TestResults
.
begin
();
cmCTestTestHandler
::
TestResultsVector
::
iterator
ri
=
this
->
TestResults
.
begin
();
// fill maps
for
(;
ri
!=
this
->
TestResults
.
end
();
++
ri
)
{
...
...
@@ -691,6 +692,7 @@ void cmCTestTestHandler::PrintLabelSummary()
l
!=
p
.
Labels
.
end
();
++
l
)
{
labelTimes
[
*
l
]
+=
result
.
ExecutionTime
;
++
labelCounts
[
*
l
];
}
}
}
...
...
@@ -705,10 +707,21 @@ void cmCTestTestHandler::PrintLabelSummary()
{
std
::
string
label
=
*
i
;
label
.
resize
(
maxlen
+
3
,
' '
);
char
buf
[
1024
];
sprintf
(
buf
,
"%6.2f sec"
,
labelTimes
[
*
i
]);
std
::
ostringstream
labelCountStr
;
labelCountStr
<<
"("
<<
labelCounts
[
*
i
]
<<
" test"
;
if
(
labelCounts
[
*
i
]
>
1
)
{
labelCountStr
<<
"s"
;
}
labelCountStr
<<
")"
;
cmCTestOptionalLog
(
this
->
CTest
,
HANDLER_OUTPUT
,
"
\n
"
<<
label
<<
" = "
<<
buf
,
this
->
Quiet
);
<<
label
<<
" = "
<<
buf
<<
" "
<<
labelCountStr
.
str
(),
this
->
Quiet
);
if
(
this
->
LogFile
)
{
*
this
->
LogFile
<<
"
\n
"
<<
*
i
<<
" = "
...
...
Tests/RunCMake/CTestCommandLine/LabelCount-stdout.txt
0 → 100644
View file @
7e86f567
100% tests passed, 0 tests failed out of 4
+
+Label Time Summary:
+'bar' = +[0-9.]+ sec \(3 tests\)
+'foo' = +[0-9.]+ sec \(1 test\)
+
Total Test time \(real\) = +[0-9.]+ sec
Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
View file @
7e86f567
...
...
@@ -54,6 +54,29 @@ add_test(MergeOutput \"${CMAKE_COMMAND}\" -P \"${RunCMake_SOURCE_DIR}/MergeOutpu
endfunction
()
run_MergeOutput
()
function
(
run_LabelCount
)
set
(
RunCMake_TEST_BINARY_DIR
${
RunCMake_BINARY_DIR
}
/LabelCount
)
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(test1
\"
${
CMAKE_COMMAND
}
\"
-E echo
\"
test1
\"
)
set_tests_properties(test1 PROPERTIES LABELS 'bar')
add_test(test2
\"
${
CMAKE_COMMAND
}
\"
-E echo
\"
test2
\"
)
set_tests_properties(test2 PROPERTIES LABELS 'bar')
add_test(test3
\"
${
CMAKE_COMMAND
}
\"
-E echo
\"
test3
\"
)
set_tests_properties(test3 PROPERTIES LABELS 'foo')
add_test(test4
\"
${
CMAKE_COMMAND
}
\"
-E echo
\"
test4
\"
)
set_tests_properties(test4 PROPERTIES LABELS 'bar')
"
)
run_cmake_command
(
LabelCount
${
CMAKE_CTEST_COMMAND
}
-V
)
endfunction
()
run_LabelCount
()
function
(
run_TestLoad name load
)
set
(
RunCMake_TEST_BINARY_DIR
${
RunCMake_BINARY_DIR
}
/TestLoad
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment