From 0b7a148ad9e5b990c9d6278f5010959afdac90ed Mon Sep 17 00:00:00 2001 From: DrMeepster <19316085+DrMeepster@users.noreply.github.com> Date: Wed, 1 Jun 2022 17:32:01 -0700 Subject: [PATCH] add test for backtrace with global allocator --- tests/pass/backtrace-global-alloc.rs | 13 +++++++++++ tests/pass/backtrace-global-alloc.stderr | 28 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/pass/backtrace-global-alloc.rs create mode 100644 tests/pass/backtrace-global-alloc.stderr diff --git a/tests/pass/backtrace-global-alloc.rs b/tests/pass/backtrace-global-alloc.rs new file mode 100644 index 00000000000..8c51bf62706 --- /dev/null +++ b/tests/pass/backtrace-global-alloc.rs @@ -0,0 +1,13 @@ +// compile-flags: -Zmiri-disable-isolation + +#![feature(backtrace)] + +use std::alloc::System; +use std::backtrace::Backtrace; + +#[global_allocator] +static GLOBAL_ALLOCATOR: System = System; + +fn main() { + eprint!("{}", Backtrace::capture()); +} diff --git a/tests/pass/backtrace-global-alloc.stderr b/tests/pass/backtrace-global-alloc.stderr new file mode 100644 index 00000000000..c48061d64d0 --- /dev/null +++ b/tests/pass/backtrace-global-alloc.stderr @@ -0,0 +1,28 @@ + 0: main + at $DIR/backtrace-global-alloc.rs:LL:CC + 1: >::call_once - shim(fn()) + at RUSTLIB/core/src/ops/function.rs:LL:CC + 2: std::sys_common::backtrace::__rust_begin_short_backtrace + at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC + 3: std::rt::lang_start::{closure#0} + at RUSTLIB/std/src/rt.rs:LL:CC + 4: std::ops::function::impls::call_once + at RUSTLIB/core/src/ops/function.rs:LL:CC + 5: std::panicking::r#try::do_call + at RUSTLIB/std/src/panicking.rs:LL:CC + 6: std::panicking::r#try + at RUSTLIB/std/src/panicking.rs:LL:CC + 7: std::panic::catch_unwind + at RUSTLIB/std/src/panic.rs:LL:CC + 8: std::rt::lang_start_internal::{closure#2} + at RUSTLIB/std/src/rt.rs:LL:CC + 9: std::panicking::r#try::do_call + at RUSTLIB/std/src/panicking.rs:LL:CC + 10: std::panicking::r#try + at RUSTLIB/std/src/panicking.rs:LL:CC + 11: std::panic::catch_unwind + at RUSTLIB/std/src/panic.rs:LL:CC + 12: std::rt::lang_start_internal + at RUSTLIB/std/src/rt.rs:LL:CC + 13: std::rt::lang_start + at RUSTLIB/std/src/rt.rs:LL:CC