Skip to content

Commit

Permalink
Write backtrace fmt test using relative paths
Browse files Browse the repository at this point in the history
For some reason the absolute paths were formatted differently on the
armhf-gnu target.

    thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
      left: `"Backtrace [\n    { fn: \"__rust_maybe_catch_panic\" },\n    { fn: \"std::rt::lang_start_internal\", file: \"./rust/rt.rs\", line: 300 },\n    { fn: \"std::rt::lang_start\", file: \"./rust/rt.rs\", line: 400 },\n]"`,
     right: `"Backtrace [\n    { fn: \"__rust_maybe_catch_panic\" },\n    { fn: \"std::rt::lang_start_internal\", file: \"/rust/rt.rs\", line: 300 },\n    { fn: \"std::rt::lang_start\", file: \"/rust/rt.rs\", line: 400 },\n]"`', src/libstd/backtrace.rs:486:5
  • Loading branch information
dtolnay committed Mar 9, 2020
1 parent 33600e4 commit a2364dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libstd/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ fn test_debug() {
frame: RawFrame::Fake,
symbols: vec![BacktraceSymbol {
name: Some(b"std::backtrace::Backtrace::create".to_vec()),
filename: Some(BytesOrWide::Bytes(b"/rust/backtrace.rs".to_vec())),
filename: Some(BytesOrWide::Bytes(b"rust/backtrace.rs".to_vec())),
lineno: Some(100),
}],
},
Expand All @@ -462,12 +462,12 @@ fn test_debug() {
symbols: vec![
BacktraceSymbol {
name: Some(b"std::rt::lang_start_internal".to_vec()),
filename: Some(BytesOrWide::Bytes(b"/rust/rt.rs".to_vec())),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(300),
},
BacktraceSymbol {
name: Some(b"std::rt::lang_start".to_vec()),
filename: Some(BytesOrWide::Bytes(b"/rust/rt.rs".to_vec())),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(400),
},
],
Expand All @@ -479,8 +479,8 @@ fn test_debug() {
#[rustfmt::skip]
let expected = "Backtrace [\
\n { fn: \"__rust_maybe_catch_panic\" },\
\n { fn: \"std::rt::lang_start_internal\", file: \"/rust/rt.rs\", line: 300 },\
\n { fn: \"std::rt::lang_start\", file: \"/rust/rt.rs\", line: 400 },\
\n { fn: \"std::rt::lang_start_internal\", file: \"rust/rt.rs\", line: 300 },\
\n { fn: \"std::rt::lang_start\", file: \"rust/rt.rs\", line: 400 },\
\n]";

assert_eq!(format!("{:#?}", backtrace), expected);
Expand Down

0 comments on commit a2364dc

Please sign in to comment.