1 extern crate backtrace
;
3 use backtrace
::Backtrace
;
5 const FRAME_RANGE
: usize = 128; // should be close enough not to give false positives
8 #[cfg_attr(any(not(any(feature = "libunwind", feature = "unix-backtrace", feature = "dbghelp")), all(target_os = "windows", target_arch = "x86")), ignore)]
9 fn backtrace_new_unresolved_should_start_with_call_site_trace() {
10 let mut b
= Backtrace
::new_unresolved();
15 assert
!(!b
.frames().is_empty());
17 let this_ip
= backtrace_new_unresolved_should_start_with_call_site_trace
as usize;
18 let frame_ip
= b
.frames().first().unwrap().ip() as usize;
20 assert
!(frame_ip
>= this_ip
);
21 assert
!(frame_ip
<= this_ip
+ FRAME_RANGE
);
25 #[cfg_attr(any(not(any(feature = "libunwind", feature = "unix-backtrace", feature = "dbghelp")), all(target_os = "windows", target_arch = "x86")), ignore)]
26 fn backtrace_new_should_start_with_call_site_trace() {
27 let b
= Backtrace
::new();
30 assert
!(!b
.frames().is_empty());
32 let this_ip
= backtrace_new_should_start_with_call_site_trace
as usize;
33 let frame_ip
= b
.frames().first().unwrap().ip() as usize;
35 assert
!(frame_ip
>= this_ip
);
36 assert
!(frame_ip
<= this_ip
+ FRAME_RANGE
);