File tree Expand file tree Collapse file tree 2 files changed +26
-33
lines changed Expand file tree Collapse file tree 2 files changed +26
-33
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments