Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
f204cd89
Commit
f204cd89
authored
Apr 14, 2009
by
zhanyong.wan
Browse files
Makes gtest print elapsed time by default.
parent
7fa242a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
src/gtest.cc
src/gtest.cc
+6
-7
test/gtest_env_var_test.py
test/gtest_env_var_test.py
+1
-1
test/gtest_output_test_.cc
test/gtest_output_test_.cc
+2
-0
test/gtest_unittest.cc
test/gtest_unittest.cc
+5
-5
No files found.
src/gtest.cc
View file @
f204cd89
...
@@ -211,7 +211,7 @@ GTEST_DEFINE_string_(
...
@@ -211,7 +211,7 @@ GTEST_DEFINE_string_(
GTEST_DEFINE_bool_
(
GTEST_DEFINE_bool_
(
print_time
,
print_time
,
internal
::
BoolFromGTestEnv
(
"print_time"
,
fals
e
),
internal
::
BoolFromGTestEnv
(
"print_time"
,
tru
e
),
"True iff "
GTEST_NAME_
"True iff "
GTEST_NAME_
" should display elapsed time in text output."
);
" should display elapsed time in text output."
);
...
@@ -4141,8 +4141,8 @@ static const char kColorEncodedHelpMessage[] =
...
@@ -4141,8 +4141,8 @@ static const char kColorEncodedHelpMessage[] =
"Test Output:
\n
"
"Test Output:
\n
"
" @G--"
GTEST_FLAG_PREFIX_
"color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D
\n
"
" @G--"
GTEST_FLAG_PREFIX_
"color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D
\n
"
" Enable/disable colored output. The default is @Gauto@D.
\n
"
" Enable/disable colored output. The default is @Gauto@D.
\n
"
" -@G-"
GTEST_FLAG_PREFIX_
"print_time@D
\n
"
" -@G-"
GTEST_FLAG_PREFIX_
"print_time
=0
@D
\n
"
"
P
rint the elapsed time of each test.
\n
"
"
Don't p
rint the elapsed time of each test.
\n
"
" @G--"
GTEST_FLAG_PREFIX_
"output=xml@Y[@G:@YDIRECTORY_PATH@G"
" @G--"
GTEST_FLAG_PREFIX_
"output=xml@Y[@G:@YDIRECTORY_PATH@G"
GTEST_PATH_SEP_
"@Y|@G:@YFILE_PATH]@D
\n
"
GTEST_PATH_SEP_
"@Y|@G:@YFILE_PATH]@D
\n
"
" Generate an XML report in the given directory or with the given file
\n
"
" Generate an XML report in the given directory or with the given file
\n
"
...
@@ -4165,10 +4165,9 @@ static const char kColorEncodedHelpMessage[] =
...
@@ -4165,10 +4165,9 @@ static const char kColorEncodedHelpMessage[] =
"Except for @G--"
GTEST_FLAG_PREFIX_
"list_tests@D, you can alternatively set "
"Except for @G--"
GTEST_FLAG_PREFIX_
"list_tests@D, you can alternatively set "
"the corresponding
\n
"
"the corresponding
\n
"
"environment variable of a flag (all letters in upper-case). For example, to
\n
"
"environment variable of a flag (all letters in upper-case). For example, to
\n
"
"print the elapsed time, you can either specify @G--"
GTEST_FLAG_PREFIX_
"disable colored text output, you can either specify @G--"
GTEST_FLAG_PREFIX_
"print_time@D or set the
\n
"
"color=no@D or set
\n
"
"@G"
GTEST_FLAG_PREFIX_UPPER_
"PRINT_TIME@D environment variable to a "
"the @G"
GTEST_FLAG_PREFIX_UPPER_
"COLOR@D environment variable to @Gno@D.
\n
"
"non-zero value.
\n
"
"
\n
"
"
\n
"
"For more information, please read the "
GTEST_NAME_
" documentation at
\n
"
"For more information, please read the "
GTEST_NAME_
" documentation at
\n
"
"@G"
GTEST_PROJECT_URL_
"@D. If you find a bug in "
GTEST_NAME_
"
\n
"
"@G"
GTEST_PROJECT_URL_
"@D. If you find a bug in "
GTEST_NAME_
"
\n
"
...
...
test/gtest_env_var_test.py
View file @
f204cd89
...
@@ -90,7 +90,7 @@ def TestEnvVarAffectsFlag(command):
...
@@ -90,7 +90,7 @@ def TestEnvVarAffectsFlag(command):
TestFlag
(
command
,
'color'
,
'yes'
,
'auto'
)
TestFlag
(
command
,
'color'
,
'yes'
,
'auto'
)
TestFlag
(
command
,
'filter'
,
'FooTest.Bar'
,
'*'
)
TestFlag
(
command
,
'filter'
,
'FooTest.Bar'
,
'*'
)
TestFlag
(
command
,
'output'
,
'tmp/foo.xml'
,
''
)
TestFlag
(
command
,
'output'
,
'tmp/foo.xml'
,
''
)
TestFlag
(
command
,
'print_time'
,
'
1
'
,
'
0
'
)
TestFlag
(
command
,
'print_time'
,
'
0
'
,
'
1
'
)
TestFlag
(
command
,
'repeat'
,
'999'
,
'1'
)
TestFlag
(
command
,
'repeat'
,
'999'
,
'1'
)
TestFlag
(
command
,
'throw_on_failure'
,
'1'
,
'0'
)
TestFlag
(
command
,
'throw_on_failure'
,
'1'
,
'0'
)
TestFlag
(
command
,
'death_test_style'
,
'threadsafe'
,
'fast'
)
TestFlag
(
command
,
'death_test_style'
,
'threadsafe'
,
'fast'
)
...
...
test/gtest_output_test_.cc
View file @
f204cd89
...
@@ -976,6 +976,8 @@ GTEST_DEFINE_bool_(internal_skip_environment_and_ad_hoc_tests, false,
...
@@ -976,6 +976,8 @@ GTEST_DEFINE_bool_(internal_skip_environment_and_ad_hoc_tests, false,
// of them are intended to fail), and then compare the test results
// of them are intended to fail), and then compare the test results
// with the "golden" file.
// with the "golden" file.
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
GTEST_FLAG
(
print_time
)
=
false
;
// We just run the tests, knowing some of them are intended to fail.
// We just run the tests, knowing some of them are intended to fail.
// We will use a separate Python script to compare the output of
// We will use a separate Python script to compare the output of
// this program with the golden file.
// this program with the golden file.
...
...
test/gtest_unittest.cc
View file @
f204cd89
...
@@ -1204,7 +1204,7 @@ class GTestFlagSaverTest : public Test {
...
@@ -1204,7 +1204,7 @@ class GTestFlagSaverTest : public Test {
GTEST_FLAG
(
filter
)
=
""
;
GTEST_FLAG
(
filter
)
=
""
;
GTEST_FLAG
(
list_tests
)
=
false
;
GTEST_FLAG
(
list_tests
)
=
false
;
GTEST_FLAG
(
output
)
=
""
;
GTEST_FLAG
(
output
)
=
""
;
GTEST_FLAG
(
print_time
)
=
fals
e
;
GTEST_FLAG
(
print_time
)
=
tru
e
;
GTEST_FLAG
(
repeat
)
=
1
;
GTEST_FLAG
(
repeat
)
=
1
;
GTEST_FLAG
(
throw_on_failure
)
=
false
;
GTEST_FLAG
(
throw_on_failure
)
=
false
;
}
}
...
@@ -1227,7 +1227,7 @@ class GTestFlagSaverTest : public Test {
...
@@ -1227,7 +1227,7 @@ class GTestFlagSaverTest : public Test {
EXPECT_STREQ
(
""
,
GTEST_FLAG
(
filter
).
c_str
());
EXPECT_STREQ
(
""
,
GTEST_FLAG
(
filter
).
c_str
());
EXPECT_FALSE
(
GTEST_FLAG
(
list_tests
));
EXPECT_FALSE
(
GTEST_FLAG
(
list_tests
));
EXPECT_STREQ
(
""
,
GTEST_FLAG
(
output
).
c_str
());
EXPECT_STREQ
(
""
,
GTEST_FLAG
(
output
).
c_str
());
EXPECT_
FALS
E
(
GTEST_FLAG
(
print_time
));
EXPECT_
TRU
E
(
GTEST_FLAG
(
print_time
));
EXPECT_EQ
(
1
,
GTEST_FLAG
(
repeat
));
EXPECT_EQ
(
1
,
GTEST_FLAG
(
repeat
));
EXPECT_FALSE
(
GTEST_FLAG
(
throw_on_failure
));
EXPECT_FALSE
(
GTEST_FLAG
(
throw_on_failure
));
...
@@ -1239,7 +1239,7 @@ class GTestFlagSaverTest : public Test {
...
@@ -1239,7 +1239,7 @@ class GTestFlagSaverTest : public Test {
GTEST_FLAG
(
filter
)
=
"abc"
;
GTEST_FLAG
(
filter
)
=
"abc"
;
GTEST_FLAG
(
list_tests
)
=
true
;
GTEST_FLAG
(
list_tests
)
=
true
;
GTEST_FLAG
(
output
)
=
"xml:foo.xml"
;
GTEST_FLAG
(
output
)
=
"xml:foo.xml"
;
GTEST_FLAG
(
print_time
)
=
tru
e
;
GTEST_FLAG
(
print_time
)
=
fals
e
;
GTEST_FLAG
(
repeat
)
=
100
;
GTEST_FLAG
(
repeat
)
=
100
;
GTEST_FLAG
(
throw_on_failure
)
=
true
;
GTEST_FLAG
(
throw_on_failure
)
=
true
;
}
}
...
@@ -4325,7 +4325,7 @@ struct Flags {
...
@@ -4325,7 +4325,7 @@ struct Flags {
filter
(
""
),
filter
(
""
),
list_tests
(
false
),
list_tests
(
false
),
output
(
""
),
output
(
""
),
print_time
(
fals
e
),
print_time
(
tru
e
),
repeat
(
1
),
repeat
(
1
),
throw_on_failure
(
false
)
{}
throw_on_failure
(
false
)
{}
...
@@ -4436,7 +4436,7 @@ class InitGoogleTestTest : public Test {
...
@@ -4436,7 +4436,7 @@ class InitGoogleTestTest : public Test {
GTEST_FLAG
(
filter
)
=
""
;
GTEST_FLAG
(
filter
)
=
""
;
GTEST_FLAG
(
list_tests
)
=
false
;
GTEST_FLAG
(
list_tests
)
=
false
;
GTEST_FLAG
(
output
)
=
""
;
GTEST_FLAG
(
output
)
=
""
;
GTEST_FLAG
(
print_time
)
=
fals
e
;
GTEST_FLAG
(
print_time
)
=
tru
e
;
GTEST_FLAG
(
repeat
)
=
1
;
GTEST_FLAG
(
repeat
)
=
1
;
GTEST_FLAG
(
throw_on_failure
)
=
false
;
GTEST_FLAG
(
throw_on_failure
)
=
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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