Skip to content

Commit 997edab

Browse files
committed
Move macOS dSYM test to its own directory
1 parent 99a78f4 commit 997edab

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

tests/macos_frames.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/macos_frames/main.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Based on from https://github.com/rust-lang/rust/blob/2cb0b8582ebbf9784db9cec06fff517badbf4553/src/test/ui/issues/issue-45731.rs
2+
// This needs to go in its own file in its own directory, since it modifies the dSYM
3+
// for the entire directory
4+
#[test]
5+
#[cfg(target_os = "macos")]
6+
fn backtrace_no_dsym() {
7+
use std::{env, fs, panic};
8+
9+
// Find our dSYM and replace the DWARF binary with an empty file
10+
let mut dsym_path = env::current_exe().unwrap();
11+
let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string();
12+
assert!(dsym_path.pop()); // Pop executable
13+
dsym_path.push(format!(
14+
"{}.dSYM/Contents/Resources/DWARF/{0}",
15+
executable_name
16+
));
17+
let _ = fs::OpenOptions::new()
18+
.read(false)
19+
.write(true)
20+
.truncate(true)
21+
.create(false)
22+
.open(&dsym_path)
23+
.unwrap();
24+
25+
backtrace::Backtrace::new();
26+
}

0 commit comments

Comments
 (0)