--gtest_print_time option should be switched on by default

318 views
Skip to first unread message

Alexander Demin

unread,
Jan 18, 2009, 5:13:36 AM1/18/09
to Google C++ Testing Framework
Hi,

I personally prefer always have '--gtest_print_time' option on by
default all the time. I do not have even one reason to switch it off
anytime -- no overhead and just a bit more characters on each output
line, and I need it in 99% cases. In 99% I prefer to know test timing.
That's why all my gtest main()s explicitly inject '--gtest_print_time'
into the argument list.

I was wondering am I alone? ;-) Maybe it should be great to have this
option on by default rather than off.

Regards,
Alexander

Zhanyong Wan (λx.x x)

unread,
Jan 18, 2009, 6:33:58 PM1/18/09
to Alexander Demin, Google C++ Testing Framework
You can easily change the default of the gtest flags in your tests. Just write

testing::GTEST_FLAG(print_time) = true;

before calling InitGoogleTest() in main().

I shall add this to the wiki.

My experience is that most of the time people don't care about the
timing. The timing is useful when you have some unusually slow tests
and you want to identify them. Otherwise, it just clutters the
output. Therefore I'd like to keep it off by default.

--
Zhanyong

Alexander Demin

unread,
Jan 19, 2009, 4:13:54 AM1/19/09
to Zhanyong Wan (λx.x x), Google C++ Testing Framework
Thanks. Your solution is absolutely fine.

Alexander

Zhanyong Wan (λx.x x)

unread,
Jan 20, 2009, 1:57:05 PM1/20/09
to Alexander Demin, Google C++ Testing Framework
On Sun, Jan 18, 2009 at 3:33 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> You can easily change the default of the gtest flags in your tests. Just write
>
> testing::GTEST_FLAG(print_time) = true;
>
> before calling InitGoogleTest() in main().
>
> I shall add this to the wiki.

Done: http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide#Running_Test_Programs:_Advanced_Options

>
> My experience is that most of the time people don't care about the
> timing. The timing is useful when you have some unusually slow tests
> and you want to identify them. Otherwise, it just clutters the
> output. Therefore I'd like to keep it off by default.
>
> On Sun, Jan 18, 2009 at 2:13 AM, Alexander Demin <ade...@gmail.com> wrote:
>>
>> Hi,
>>
>> I personally prefer always have '--gtest_print_time' option on by
>> default all the time. I do not have even one reason to switch it off
>> anytime -- no overhead and just a bit more characters on each output
>> line, and I need it in 99% cases. In 99% I prefer to know test timing.
>> That's why all my gtest main()s explicitly inject '--gtest_print_time'
>> into the argument list.
>>
>> I was wondering am I alone? ;-) Maybe it should be great to have this
>> option on by default rather than off.
>>
>> Regards,
>> Alexander
>>
>
>
>
> --
> Zhanyong
>

--
Zhanyong

Alexander Demin

unread,
Jan 21, 2009, 8:03:56 AM1/21/09
to Google C++ Testing Framework
Unfortunately "print_time" is not declared in the headers. Is this
only for the trunk?

Alexander

On Jan 20, 6:57 pm, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> On Sun, Jan 18, 2009 at 3:33 PM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
>
> > You can easily change the default of the gtest flags in your tests.  Just write
>
> >  testing::GTEST_FLAG(print_time) = true;
>
> > before calling InitGoogleTest() in main().
>
> > I shall add this to the wiki.
>
> Done:http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide#Runn...

Zhanyong Wan (λx.x x)

unread,
Jan 21, 2009, 11:10:03 AM1/21/09
to Alexander Demin, Google C++ Testing Framework
2009/1/21 Alexander Demin <ade...@gmail.com>:

>
> Unfortunately "print_time" is not declared in the headers. Is this
> only for the trunk?

Uh, I guess we forgot to declare it. You can declare it yourself, but
it's better to declare it in gtest.h. Would you like to submit a
patch for review? See the DevGuide wiki for instructions if you are
interested. Thanks,

--
Zhanyong

Zhanyong Wan (λx.x x)

unread,
Jan 21, 2009, 11:10:41 AM1/21/09
to Alexander Demin, Google C++ Testing Framework
On Wed, Jan 21, 2009 at 8:10 AM, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> 2009/1/21 Alexander Demin <ade...@gmail.com>:
>>
>> Unfortunately "print_time" is not declared in the headers. Is this
>> only for the trunk?
>
> Uh, I guess we forgot to declare it. You can declare it yourself, but
> it's better to declare it in gtest.h. Would you like to submit a
> patch for review? See the DevGuide wiki for instructions if you are
> interested. Thanks,

While you are at it, perhaps you could add declarations for other
missing flags as well?

--
Zhanyong

Alexander Demin

unread,
Jan 22, 2009, 8:04:23 AM1/22/09
to Zhanyong Wan (λx.x x), Google C++ Testing Framework
Well, I'm in process of doing it if somebody is faster than me ;-)

Alexander

Alexander Demin

unread,
Jan 22, 2009, 8:20:10 AM1/22/09
to Zhanyong Wan (λx.x x), Google C++ Testing Framework
The patch source is actually ready. I'm just in process of doing the patch in particular ;-)

Alexander

Alexander Demin

unread,
Jan 22, 2009, 9:50:42 AM1/22/09
to Zhanyong Wan (λx.x x), Google C++ Testing Framework
I've submitted the patch for review -- http://codereview.appspot.com/11957

Alexander

housemaister

unread,
Jan 22, 2009, 10:53:44 AM1/22/09
to Alexander Demin, Zhanyong Wan (λx.x x), Google C++ Testing Framework
Hi Alexander,

seems you uploaded the patch with wrong "SVN Base" (it says
http://svn.python.org/view/*checkout*/python/trunk/).
Side by-side-diff and commenting does not work.

Stefan.

Zhanyong Wan (λx.x x)

unread,
Jan 22, 2009, 12:11:00 PM1/22/09
to housemaister, Alexander Demin, Google C++ Testing Framework
Alexander,

2009/1/22 housemaister <housem...@gmail.com>:


> Hi Alexander,
>
> seems you uploaded the patch with wrong "SVN Base" (it says
> http://svn.python.org/view/*checkout*/python/trunk/).
> Side by-side-diff and commenting does not work.

Yes, please check out gtest and upload the patch from gtest's own SVN check-out.

Also, have you signed the CLA yet? I cannot seem to find your record
at this time. Thanks,

--
Zhanyong

Alexander Demin

unread,
Jan 22, 2009, 12:44:41 PM1/22/09
to Zhanyong Wan (λx.x x), housemaister, Google C++ Testing Framework
I've signed the CLA recently.

Ok, I'll try submit again. I was confused a bit because the submit procedure is a bit iffy.

Alexander

Alexander Demin

unread,
Jan 22, 2009, 2:41:15 PM1/22/09
to Zhanyong Wan (λx.x x), housemaister, Google C++ Testing Framework
I've re-submitted the patch to http://codereview.appspot.com/12483 using upload.py now and it seems to me everything is fine.

Alexander

Alexander Demin

unread,
Jan 26, 2009, 5:10:08 PM1/26/09
to Google C++ Testing Framework
There is the next submit including all changes according to the review
-- http://codereview.appspot.com/12499

I was wondering when I need to change my patch to satisfy the review
(for example, http://codereview.appspot.com/12483) do I need to submit
brand new patch with new id (as I've done in http://codereview.appspot.com/12499)
or I can modify the already created one?

Alexander

On Jan 22, 10:41 pm, Alexander Demin <ade...@gmail.com> wrote:
> I've re-submitted the patch tohttp://codereview.appspot.com/12483using
> upload.py now and it seems to me everything is fine.
>
> Alexander
>
> On Thu, Jan 22, 2009 at 8:44 PM, Alexander Demin <ade...@gmail.com> wrote:
> > I've signed the CLA recently.
>
> > Ok, I'll try submit again. I was confused a bit because the submit
> > procedure is a bit iffy.
>
> > Alexander
>
> > On Thu, Jan 22, 2009 at 5:11 PM, Zhanyong Wan (λx.x x) <w...@google.com>wrote:
>
> >> Alexander,
>
> >> 2009/1/22 housemaister <housemais...@gmail.com>:

Zhanyong Wan (λx.x x)

unread,
Jan 26, 2009, 11:38:02 PM1/26/09
to Alexander Demin, Google C++ Testing Framework
On Mon, Jan 26, 2009 at 2:10 PM, Alexander Demin <ade...@gmail.com> wrote:
>
> There is the next submit including all changes according to the review
> -- http://codereview.appspot.com/12499
>
> I was wondering when I need to change my patch to satisfy the review
> (for example, http://codereview.appspot.com/12483) do I need to submit
> brand new patch with new id (as I've done in http://codereview.appspot.com/12499)
> or I can modify the already created one?

Thanks. Could you please re-submit it to issue 12483 ('upload.py -i
12483')? This allows the reviewers to easily diff two patches and see
what has changed since the last time.

--
Zhanyong

Alexander Demin

unread,
Jan 27, 2009, 3:49:09 PM1/27/09
to Zhanyong Wan (λx.x x), Google C++ Testing Framework
Great, I've re-submit it to issue 12483 as you mentioned and re-asked for the review.

By the way, does upload.py support proxy? Unfortunately I have to use using http/ftp proxy on work and that's why I have to do submits at home ;-)

Alexander

Zhanyong Wan (λx.x x)

unread,
Jan 27, 2009, 4:07:16 PM1/27/09
to Alexander Demin, Google C++ Testing Framework
On Tue, Jan 27, 2009 at 12:49 PM, Alexander Demin <ade...@gmail.com> wrote:
> Great, I've re-submit it to issue 12483 as you mentioned and re-asked for
> the review.

Thanks!

> By the way, does upload.py support proxy? Unfortunately I have to use using
> http/ftp proxy on work and that's why I have to do submits at home ;-)

The people who created the tool can best answer this question. Do you
want to post it at http://groups.google.com/group/codereview-discuss ?

--
Zhanyong

Reply all
Reply to author
Forward
0 new messages