From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../crates/without_debuginfo/tests/smoke.rs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 library/backtrace/crates/without_debuginfo/tests/smoke.rs (limited to 'library/backtrace/crates/without_debuginfo/tests/smoke.rs') diff --git a/library/backtrace/crates/without_debuginfo/tests/smoke.rs b/library/backtrace/crates/without_debuginfo/tests/smoke.rs new file mode 100644 index 000000000..5a0dfea15 --- /dev/null +++ b/library/backtrace/crates/without_debuginfo/tests/smoke.rs @@ -0,0 +1,44 @@ +#[test] +fn all_frames_have_symbols() { + println!("{:?}", backtrace::Backtrace::new()); + + let mut missing_symbols = 0; + let mut has_symbols = 0; + backtrace::trace(|frame| { + let mut any = false; + backtrace::resolve_frame(frame, |sym| { + if sym.name().is_some() { + any = true; + } + }); + if any { + has_symbols += 1; + } else if !frame.ip().is_null() { + missing_symbols += 1; + } + true + }); + + // FIXME(#346) currently on MinGW we can't symbolize kernel32.dll and other + // system libraries, which means we miss the last few symbols. + if cfg!(windows) && cfg!(target_env = "gnu") { + assert!(missing_symbols < has_symbols && has_symbols > 4); + } else { + assert_eq!(missing_symbols, 0); + } +} + +#[test] +fn all_frames_have_module_base_address() { + let mut missing_base_addresses = 0; + backtrace::trace(|frame| { + if frame.module_base_address().is_none() { + missing_base_addresses += 1; + } + true + }); + + if cfg!(windows) { + assert_eq!(missing_base_addresses, 0); + } +} -- cgit v1.2.3