test: in coverage runs, log stacktraces directly to stderr#10397
test: in coverage runs, log stacktraces directly to stderr#10397mattklein123 merged 15 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
… from coverage script. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for working on this. This is going to be super useful in figuring out our coverage issues. A few small comments.
/wait
test/test_runner.cc
Outdated
| return return_value; | ||
| } | ||
|
|
||
| bool findAndRemoveExact(absl::string_view option, int& argc, char**& argv) { |
There was a problem hiding this comment.
Should we just use TCLAP here? It seems like we are reimplementing a bunch org arg parsing for tests. Also, is there any reason to make this a real server option with documentation? Probably not but just throwing it out there.
There was a problem hiding this comment.
We could; actually I have that in a patch saved away if we want to go in that direction.
OTOH we could use the TCLAP library to do this parsing rather than do this manually; I just copied the loop from above. I don't know if we can replace the one above because it uses the --name=value syntax rather than --name value, so I was trying to use a parallel approach but I'm not wedded to it.
There was a problem hiding this comment.
actually there's a third option I considered, using #ifdef ENVOY_CONFIG_COVERAGE and not making it a command-line option at all. WDYT?
There was a problem hiding this comment.
(I think you would have to ifdef out that test which checks the log but that is probably fine)
source/server/backtrace.cc
Outdated
| bool BackwardsTrace::log_to_stderr_ = false; | ||
|
|
||
| void BackwardsTrace::setLogToStderr(bool log_to_stderr) { | ||
| std::cerr << "setting log_to_stderr_=" << log_to_stderr << std::endl; |
There was a problem hiding this comment.
nit: prepend with BackwardsTrace or something?
There was a problem hiding this comment.
will do; or I could just delete it.
… an ifdef. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
Sorry can you re-approve? Formatting issue needed to be fixed. |
Description:
Coverage tests run with
-l trace --log-path /dev/null, in order to ensure that all of the code-paths from the maximum level of tracing are covered in tests, but we don't wind up filling up CI with useless detailed artifacts.The downside of this is that if there's a crash, the backtrace is lost, as the backtracing mechanism uses logging. This PR resolves this by redirecting crash logs to stderr for coverage tests only.
Forcing a segv in a test, I see this from coverage with this PR:
Note that this was tested manually; we do not have a test for this test behavior.
Risk Level: medium -- mostly because this messes with the crash handler
Testing: //test/..., plus a manual coverage run with a segv injected.
Docs Changes: n/a -- this does not add an option for envoy servers; just for tests.
Release Notes: n/a