File tree Expand file tree Collapse file tree 6 files changed +44
-2
lines changed Expand file tree Collapse file tree 6 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 7878 - run : cargo test --no-default-features --features "dbghelp std"
7979 - run : cargo test --no-default-features --features "dbghelp std verify-winapi"
8080 - run : cargo test --manifest-path crates/cpp_smoke_test/Cargo.toml
81+ - run : cargo test --manifest-path crates/macos_frames_test/Cargo.toml
8182 - run : cargo test --features libbacktrace --manifest-path crates/without_debuginfo/Cargo.toml
8283 - run : cargo test --features "libbacktrace coresymbolication" --manifest-path crates/without_debuginfo/Cargo.toml
8384 - run : cargo test --features "libbacktrace gimli-symbolize" --manifest-path crates/without_debuginfo/Cargo.toml
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ edition = "2018"
1616
1717[workspace ]
1818members = [' crates/cpp_smoke_test' ]
19- exclude = [' crates/without_debuginfo' ]
19+ exclude = [' crates/without_debuginfo' , ' crates/macos_frames_test ' ]
2020
2121[dependencies ]
2222cfg-if = " 0.1.10"
Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ fn main() {
3636
3737 // `mmap` does not exist on Windows, so we use
3838 // the less efficient `read`-based code.
39- if target. contains ( "windows" ) {
39+ // Using `mmap` on macOS causes weird isseus - see
40+ // https://github.com/rust-lang/rust/pull/45866
41+ if target. contains ( "windows" ) || target. contains ( "darwin" ) {
4042 build. file ( "src/libbacktrace/read.c" ) ;
4143 } else {
4244 build. file ( "src/libbacktrace/mmapio.c" ) ;
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " macos_frames_test"
3+ version = " 0.1.0"
4+ authors = [
" Aaron Hill <[email protected] >" ]
5+ edition = " 2018"
6+
7+ [dependencies .backtrace ]
8+ path = " ../.."
Original file line number Diff line number Diff line change 1+ // intentionally blank
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 a crate by itself, since it modifies the dSYM for the entire test
3+ // output directory.
4+ //
5+ // Note that this crate is *not* part of the overall `backtrace-rs` workspace,
6+ // so that it gets its own 'target' directory. We manually invoke this test
7+ // in .github/workflows/main.yml by passing `--manifest-path` to Cargo
8+ #[ test]
9+ #[ cfg( target_os = "macos" ) ]
10+ fn backtrace_no_dsym ( ) {
11+ use std:: { env, fs, panic} ;
12+
13+ // Find our dSYM and replace the DWARF binary with an empty file
14+ let mut dsym_path = env:: current_exe ( ) . unwrap ( ) ;
15+ let executable_name = dsym_path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
16+ assert ! ( dsym_path. pop( ) ) ; // Pop executable
17+ dsym_path. push ( format ! (
18+ "{}.dSYM/Contents/Resources/DWARF/{0}" ,
19+ executable_name
20+ ) ) ;
21+ let _ = fs:: OpenOptions :: new ( )
22+ . read ( false )
23+ . write ( true )
24+ . truncate ( true )
25+ . create ( false )
26+ . open ( & dsym_path)
27+ . unwrap ( ) ;
28+
29+ backtrace:: Backtrace :: new ( ) ;
30+ }
You can’t perform that action at this time.
0 commit comments