Bug #86016 Make MTR show core dump stacktraces from unit tests too
Submitted: 20 Apr 2017 9:12 Modified: 22 Jul 2019 6:36
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Tests Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: mtr

[20 Apr 2017 9:12] Laurynas Biveinis
Description:
MySQL test framework has this very convenient feature of using the debugger to dump any core dump stacktraces. It would be useful to extend this feature to unit test crashes too, as it would help with intermittent crashes there and the like.

How to repeat:
See above
[24 Apr 2017 8:10] MySQL Verification Team
Hello Laurynas,

Thank you for the report and feature request!

Thanks,
Umesh
[8 Jun 2017 3:42] Laurynas Biveinis
Bug 86016 proof of concept implementation for 5.7

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug86016-5.7-poc.patch (application/octet-stream, text), 19.13 KiB.

[8 Jun 2017 3:45] Laurynas Biveinis
Uploaded a non-GA proof-of-concept patch. It implements the feature but needs improving:
- only tested under Linux, no cross-platform compatibility considerations whatsoever;
- thread_utils.h is not the best place for the disable core dump guard;
- that guard and the whole s/EXPECT_DEATH_IF_SUPPORTED/MY_EXPET_DEATH_IF_SUPPORTED business should not be required at all, but alas gtest upstream does not consider https://github.com/google/googletest/issues/237 to be something they need to fix
[22 Jul 2019 6:36] Laurynas Biveinis
A bit of overlap with [1] implemented in 8.0.17 in that both no longer dump cores for DEATH tests. Otherwise this is still a valid request

[1]:

commit 0e79c7843610b8a753d89dd8130dd69d2e1a85d7
Author: Tor Didriksen <tor.didriksen@oracle.com>
Date:   Thu Feb 21 10:58:12 2019 +0100

    Bug#29389789 HANDLE SIGNALS, AND ENABLE STACK TRACE IN UNIT TESTS
    
    Googletest based unit tests should:
     - handle control-C gracefully
     - not dump core files for DEATH tests
     - print stack trace for unexpected signals
    
    Also: Tag all executables which do stack backtracing with
      SET_TARGET_PROPERTIES(executable PROPERTIES ENABLE_EXPORTS TRUE)
    This will add '-Wl,--export-dynamic -rdynamic' to link flags (on Linux)
    
    Also: Remove the special handling with printstack() on Solaris,
    use abi::__cxa_demangle()
    (and remove the obsolete reference to resolve_stack_dump)
    
    Change-Id: I54e3650a533a5ef51cf2695f349fb96451d9bd1b