Closed ChillerDragon closed 2 weeks ago
I don't see any indication that one is supposed to use GTEST_BRIEF
from user code in the posted documentation link.
Is there maybe a way of making gtest only show the output for failing tests?
Is there maybe a way of making gtest only show the output for failing tests?
The only thing I found is GTEST_BRIEF
which removed the passing test output coming from gtest. But then what is left is whatever ddnet prints to stdout in the passing tests. Which is a bunch of sql logs and a lot of those teehistorian dumps.
Hmm. Perhaps it's simply not possible: https://github.com/google/googletest/issues/2178.
I wonder if there's a test framework we could switch to that supports this. It seems like a pretty fundamental feature.
I am all in for switching test framework. What about rolling our own?
I'd generally prefer using an existing one so that we can benefit from its features. Writing our own will likely miss many use cases.
Perhaps we could try to implement output-on-failure-only within GTest using events: https://google.github.io/googletest/advanced.html#defining-event-listeners.
Which use cases do we rely on other than an assert eq feature?
Just two features I remember using: Filtering what tests are run. Repeating a single test until failure.
There are probably more that others have used that I'm not aware of.
Seems simple. So we did not use anything complex such as mocking?
Mocking wasn't used AFAIK. I don't know if anything "as complex as mocking" was used.
Which use cases do we rely on other than an assert eq feature?
Test fixtures and typed tests.
Death tests also seem interesting for testing dbg_assert
s.
What about rolling our own?
I don't think that's a worthwhile effort.
Well if we don't want to roll our own and gtest cant silence stdout. How about we merge this pr or stop spamming stdout in any other way?
Can you use ::testing::GTEST_FLAG(brief)
instead of checking the environment variable? That seems like the "documented" way to retrieve the googletest configuration.
GTEST_FLAG(repeat)
::testing::GTEST_FLAG(death_test_style)
The flag looks unrelated to what we want though, so it's no good to retrieve it the proper way.
Well if we don't want to roll our own and gtest cant silence stdout. How about we merge this pr or stop spamming stdout in any other way?
Possible solutions:
I don't see this PR as a solution because it uses an flag that is supposed to hide output of successful runs to hide output of all runs.
I am not doing gtest event listeners.
By default running the tests is very verbose and one has to scroll to the failing test case every time while debugging. Luckily there is https://google.github.io/googletest/advanced.html#suppressing-test-passes
GTEST_BRIEF=1
which silences passing tests. But then the teehistorian test still prints a lot of things.