Skip to content

Conversation

iillyyaa
Copy link
Contributor

@iillyyaa iillyyaa commented Oct 5, 2018

As prevously written, "--benchmark_color=auto" was treated as true,
because IsTruthyFlagValue("auto") returned true. The fix is to
rely on IsColorTerminal test only if the flag value is "auto",
and fall back to IsTruthyFlagValue otherwise. I also integrated
force_no_color check into the same block.

(Aside for @dominichamon: I noticed that you mentioned in the ticket that a PR was in progress, but I couldn't locate it.)

Fixes #559.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

As prevously written, "--benchmark_color=auto" was treated as true,
because IsTruthyFlagValue("auto") returned true.  The fix is to
rely on IsColorTerminal test only if the flag value is "auto",
and fall back to IsTruthyFlagValue otherwise.  I also integrated
force_no_color check into the same block.
@iillyyaa iillyyaa force-pushed the fix-559-benchmark-color-auto branch from b2fcc36 to f5009d7 Compare October 5, 2018 16:58
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Oct 5, 2018
@coveralls
Copy link

coveralls commented Oct 5, 2018

Coverage Status

Coverage decreased (-0.03%) to 89.224% when pulling f5009d7 on iillyyaa:fix-559-benchmark-color-auto into 9ffb8df on google:master.

@AppVeyorBot
Copy link

Build benchmark 1509 completed (commit 5231f34aa8 by @iillyyaa)

@LebedevRI
Copy link
Collaborator

Looks reasonable, but is there any reasonable way to test this?

@iillyyaa
Copy link
Contributor Author

iillyyaa commented Oct 5, 2018

Roman, I'm sure there is a way, but my cmake-fu is not up to snuff to come up with it. I'd appreciate if you accepted the fix as is. If tests must be provided, I will do my best, but can't make promises on the timing of the update.

@LebedevRI LebedevRI changed the title benchmark_color: fix auto option (#559) benchmark_color: fix auto option Oct 6, 2018
Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new code looks reasonable, but i'll leave this for @dominichamon.

@dmah42
Copy link
Member

dmah42 commented Oct 8, 2018

i don't think cmake is required for tests, it would be a googletest unit test of the function, but you may have to use gmock to mock out IsColorTerminal... I'm ok with that waiting for another time.

@dmah42 dmah42 merged commit 8503dfe into google:master Oct 8, 2018
JBakamovic pushed a commit to JBakamovic/benchmark that referenced this pull request Dec 6, 2018
As prevously written, "--benchmark_color=auto" was treated as true,
because IsTruthyFlagValue("auto") returned true.  The fix is to
rely on IsColorTerminal test only if the flag value is "auto",
and fall back to IsTruthyFlagValue otherwise.  I also integrated
force_no_color check into the same block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--benchmark_color=auto (the default value) always prints color

6 participants