File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ pub fn register_panic_hook() -> anyhow::Result<()> {
107107 }
108108 }
109109 }
110- call_previous_panic_hook ( panic_info) ;
110+ // call_previous_panic_hook(panic_info);
111111 } ) ) ;
112112 Ok ( ( ) )
113113}
@@ -120,6 +120,7 @@ pub fn register_panic_hook() -> anyhow::Result<()> {
120120/// SAFETY:
121121/// Crash-tracking functions are not guaranteed to be reentrant.
122122/// No other crash-handler functions should be called concurrently.
123+ #[ allow( dead_code) ]
123124fn call_previous_panic_hook ( panic_info : & PanicHookInfo < ' _ > ) {
124125 let old_hook_ptr = PREVIOUS_PANIC_HOOK . load ( SeqCst ) ;
125126 if !old_hook_ptr. is_null ( ) {
Original file line number Diff line number Diff line change @@ -453,4 +453,25 @@ mod tests {
453453 assert_eq ! ( crash_ping. metadata( ) , & metadata) ;
454454 assert ! ( crash_ping. message( ) . contains( "crash processing started" ) ) ;
455455 }
456+
457+ #[ test]
458+ fn test_crash_info_builder_to_crash_ping_with_message ( ) {
459+ let sig_info = SigInfo :: test_instance ( 42 ) ;
460+ let metadata = Metadata :: test_instance ( 1 ) ;
461+ let message = "test message" ;
462+
463+ let mut crash_info_builder = CrashInfoBuilder :: new ( ) ;
464+ crash_info_builder. with_sig_info ( sig_info. clone ( ) ) . unwrap ( ) ;
465+ crash_info_builder. with_metadata ( metadata. clone ( ) ) . unwrap ( ) ;
466+ crash_info_builder. with_kind ( ErrorKind :: Panic ) . unwrap ( ) ;
467+ crash_info_builder. with_message ( message. to_string ( ) ) . unwrap ( ) ;
468+
469+ let crash_ping = crash_info_builder. build_crash_ping ( ) . unwrap ( ) ;
470+
471+ assert ! ( !crash_ping. crash_uuid( ) . is_empty( ) ) ;
472+ assert ! ( Uuid :: parse_str( crash_ping. crash_uuid( ) ) . is_ok( ) ) ;
473+ assert_eq ! ( crash_ping. siginfo( ) , Some ( & sig_info) ) ;
474+ assert_eq ! ( crash_ping. metadata( ) , & metadata) ;
475+ assert ! ( crash_ping. message( ) . contains( "crash processing started - test message" ) ) ;
476+ }
456477}
You can’t perform that action at this time.
0 commit comments