Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(187)

Issue 2574: Adds elapsed time to gtest's textual output. Original patch by balazs.dan.

Can't Edit
Can't Publish+Mail
Start Review
Created:
17 years, 6 months ago by Zhanyong
Modified:
11 years, 2 months ago
Reviewers:
Vlad, wan, balazs.dan
CC:
balazs.dan_gmail.com, googletestframework_googlegroups.com
Base URL:
http://googletest.googlecode.com/svn/trunk/
Visibility:
Public.

Patch Set 1 #

Patch Set 2 : Second attempt #

Patch Set 3 : Addresses Zhanyong's comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -3 lines) Patch
src/gtest.cc View 1 2 6 chunks +34 lines, -2 lines 0 comments Download
src/gtest-internal-inl.h View 1 5 chunks +6 lines, -1 line 0 comments Download
test/gtest_unittest.cc View 1 2 9 chunks +95 lines, -0 lines 0 comments Download

Messages

Total messages: 7
Zhanyong
Balazs created this patch for this issue: http://code.google.com/p/googletest/issues/detail?id=6. I have uploaded the patch to the ...
17 years, 6 months ago (2008-07-16 21:29:10 UTC) #1
chandlerc
FYI http://codereview.appspot.com/2574/diff/1/4 File src/gtest.cc (right): http://codereview.appspot.com/2574/diff/1/4#newcode2358 Line 2358: printf("%s from %s\t%d msec\n\n", counts.c_str(), test_case_name_.c_str(), test_case->elapsed_time()); ...
17 years, 6 months ago (2008-07-16 21:47:43 UTC) #2
Zhanyong
http://codereview.appspot.com/2574/diff/1/3 File src/gtest-internal-inl.h (right): http://codereview.appspot.com/2574/diff/1/3#newcode76 Line 76: GTEST_DECLARE_bool(print_time); Style nit: could you sort the list ...
17 years, 6 months ago (2008-07-16 22:42:54 UTC) #3
Zhanyong
Thanks for addressing the comments thoroughly, Balazs. In addition to some nits, we also need ...
17 years, 5 months ago (2008-07-23 22:10:46 UTC) #4
Balazs.Dan
Ok, I will try to modify the gtest_output_test.py, but I'm not an python expert..
17 years, 5 months ago (2008-07-24 02:04:33 UTC) #5
Balazs.Dan
http://codereview.appspot.com/2574/diff/6/31 File src/gtest.cc (right): http://codereview.appspot.com/2574/diff/6/31#newcode2440 Line 2440: if (GTEST_FLAG(print_time)) { This will print the "end ...
17 years, 5 months ago (2008-07-24 02:05:07 UTC) #6
Vlad
17 years, 5 months ago (2008-07-24 02:20:54 UTC) #7
http://codereview.appspot.com/2574/diff/6/31
File src/gtest.cc (right):

http://codereview.appspot.com/2574/diff/6/31#newcode2440
Line 2440: if (GTEST_FLAG(print_time)) {
On 2008/07/24 02:05:07, Balazs.Dan wrote:
> This will print the "end of line" in green, thus the output will differ.
> However, I can do this:
>   printf(...);
>   if (GTEST_FLAG(print_time)) {
>     printf(...);
>   }
>   printf("\n");
>   ColoredPrintf(COLOR_GREEN, "[  PASSED  ] ");
> 
> But, this will decrease the performance and wont be much more compact..

How about this:

string time_printout;
if (GTEST_FLAG(print_time)) {
  time_printout = string(" (") +
      internal::StreamableToString(impl->elapsed_time()) + " ms total)";
}
printf("%s from %s ran.%s\n",
    FormatTestCount(impl->test_to_run_count()).c_str(),
    FormatTestCaseCount(
        impl->test_case_to_run_count()).c_str(),
    time_printout.c_str());
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b