Skip to content

Commit

Permalink
fix test properly
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 27, 2024
1 parent afb7e57 commit 1d56ec5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/smoke.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use backtrace::Frame;
use core::ffi::c_void;
use std::ptr;
use std::thread;

Expand Down Expand Up @@ -249,11 +250,11 @@ fn sp_smoke_test() {
return;

#[inline(never)]
fn recursive_stack_references(refs: &mut Vec<usize>) {
fn recursive_stack_references(refs: &mut Vec<*mut c_void>) {
assert!(refs.len() < 5);

let x = refs.len();
refs.push(ptr::addr_of!(x) as usize);
let mut x = refs.len();
refs.push(ptr::addr_of_mut!(x).cast());

if refs.len() < 5 {
recursive_stack_references(refs);
Expand All @@ -271,7 +272,7 @@ fn sp_smoke_test() {
// mangled names.

fn make_trace_closure<'a>(
refs: &'a mut Vec<usize>,
refs: &'a mut Vec<*mut c_void>,
) -> impl FnMut(&backtrace::Frame) -> bool + 'a {
let mut child_sp = None;
let mut child_ref = None;
Expand Down Expand Up @@ -306,8 +307,8 @@ fn sp_smoke_test() {

if is_recursive_stack_references {
let r = refs.pop().unwrap();
eprintln!("ref = {:p}", r as *const u8);
if sp != 0 {
eprintln!("ref = {:p}", r);
if sp as usize != 0 {
assert!(r > sp);
if let Some(child_ref) = child_ref {
assert!(sp >= child_ref);
Expand Down

0 comments on commit 1d56ec5

Please sign in to comment.