Skip to content

Commit 99a78f4

Browse files
committed
Move macOS test to its own file
1 parent 86e4a37 commit 99a78f4

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

tests/macos_frames.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copied 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, since it modifies the dSYM
3+
// for the entire test
4+
#[test]
5+
#[cfg(target_os = "macos")]
6+
fn simple_test() {
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+
{
18+
let _ = fs::OpenOptions::new()
19+
.read(false)
20+
.write(true)
21+
.truncate(true)
22+
.create(false)
23+
.open(&dsym_path)
24+
.unwrap();
25+
}
26+
27+
env::set_var("RUST_BACKTRACE", "1");
28+
29+
// We don't need to die of panic, just trigger a backtrace
30+
let _ = panic::catch_unwind(|| {
31+
assert!(false);
32+
});
33+
}

tests/smoke.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -248,35 +248,3 @@ fn is_serde() {
248248
is_serialize::<backtrace::Backtrace>();
249249
is_deserialize::<backtrace::Backtrace>();
250250
}
251-
252-
// Copied from https://github.com/rust-lang/rust/blob/2cb0b8582ebbf9784db9cec06fff517badbf4553/src/test/ui/issues/issue-45731.rs
253-
#[test]
254-
#[cfg(target_os = "macos")]
255-
fn simple_test() {
256-
use std::{env, fs, panic};
257-
258-
// Find our dSYM and replace the DWARF binary with an empty file
259-
let mut dsym_path = env::current_exe().unwrap();
260-
let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string();
261-
assert!(dsym_path.pop()); // Pop executable
262-
dsym_path.push(format!(
263-
"{}.dSYM/Contents/Resources/DWARF/{0}",
264-
executable_name
265-
));
266-
{
267-
let _ = fs::OpenOptions::new()
268-
.read(false)
269-
.write(true)
270-
.truncate(true)
271-
.create(false)
272-
.open(&dsym_path)
273-
.unwrap();
274-
}
275-
276-
env::set_var("RUST_BACKTRACE", "1");
277-
278-
// We don't need to die of panic, just trigger a backtrace
279-
let _ = panic::catch_unwind(|| {
280-
assert!(false);
281-
});
282-
}

0 commit comments

Comments
 (0)