Skip to content

libtest panics when running should_panic tests under QEMU armv7  #74820

Open
@rossmacarthur

Description

This currently works on stable but now fails on beta and nightly.

I tried this code:

// lib.rs
#[cfg(test)]
mod tests {
    #[test]
    #[should_panic]
    fn it_works() {
        panic!("this test should pass");
    }
}

And used cross v0.2.1 to test it

$ cross -v +beta test --target armv7-unknown-linux-musleabihf
+ "rustc" "--print" "sysroot"
+ "rustup" "toolchain" "list"
+ "rustup" "target" "list" "--toolchain" "beta-x86_64-unknown-linux-gnu"
+ "rustup" "component" "list" "--toolchain" "beta-x86_64-unknown-linux-gnu"
+ "/usr/bin/docker" "run" "--userns" "host" "-e" "RUST_BACKTRACE" "-e" "PKG_CONFIG_ALLOW_CROSS=1" "--rm" "--user" "1000:1000" "-e" "XARGO_HOME=/xargo" "-e" "CARGO_HOME=/cargo" "-e" "CARGO_TARGET_DIR=/target" "-e" "USER=ross" "-e" "CROSS_RUNNER=" "-v" "/home/ross/.xargo:/xargo:Z" "-v" "/home/ross/.cargo:/cargo:Z" "-v" "/cargo/bin" "-v" "/home/ross/arm-test:/project:Z" "-v" "/home/ross/.rustup/toolchains/beta-x86_64-unknown-linux-gnu:/rust:Z,ro" "-v" "/home/ross/arm-test/target:/target:Z" "-w" "/project" "-i" "-t" "rustembedded/cross:armv7-unknown-linux-musleabihf-0.2.1" "sh" "-c" "PATH=$PATH:/rust/bin cargo -v test --target armv7-unknown-linux-musleabihf"
       Fresh arm-test v0.1.0 (/project)
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running `qemu-arm /target/armv7-unknown-linux-musleabihf/debug/deps/arm_test-6cdb46f45d2b6f28`

running 1 test
test tests::it_works ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', src/libtest/lib.rs:556:30
error: test failed, to rerun pass '--lib'

I expected to see this happen: the test should pass and libtest should not panic.

Meta

rustc --version --verbose:

rustc 1.46.0-beta.2 (6f959902b 2020-07-23)
binary: rustc
commit-hash: 6f959902b3103c49ca981fbc01871589c3498489
commit-date: 2020-07-23
host: x86_64-unknown-linux-gnu
release: 1.46.0-beta.2
LLVM version: 10.0
Backtrace

$ RUST_BACKTRACE=full cross -v +beta test --target armv7-unknown-linux-musleabihf
+ "rustc" "--print" "sysroot"
+ "rustup" "toolchain" "list"
+ "rustup" "target" "list" "--toolchain" "beta-x86_64-unknown-linux-gnu"
+ "rustup" "component" "list" "--toolchain" "beta-x86_64-unknown-linux-gnu"
+ "/usr/bin/docker" "run" "--userns" "host" "-e" "RUST_BACKTRACE" "-e" "PKG_CONFIG_ALLOW_CROSS=1" "--rm" "--user" "1000:1000" "-e" "XARGO_HOME=/xargo" "-e" "CARGO_HOME=/cargo" "-e" "CARGO_TARGET_DIR=/target" "-e" "USER=ross" "-e" "CROSS_RUNNER=" "-v" "/home/ross/.xargo:/xargo:Z" "-v" "/home/ross/.cargo:/cargo:Z" "-v" "/cargo/bin" "-v" "/home/ross/arm-test:/project:Z" "-v" "/home/ross/.rustup/toolchains/beta-x86_64-unknown-linux-gnu:/rust:Z,ro" "-v" "/home/ross/arm-test/target:/target:Z" "-w" "/project" "-i" "-t" "rustembedded/cross:armv7-unknown-linux-musleabihf-0.2.1" "sh" "-c" "PATH=$PATH:/rust/bin cargo -v test --target armv7-unknown-linux-musleabihf"
       Fresh arm-test v0.1.0 (/project)
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running `qemu-arm /target/armv7-unknown-linux-musleabihf/debug/deps/arm_test-6cdb46f45d2b6f28`

running 1 test
test tests::it_works ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', src/libtest/lib.rs:556:30
stack backtrace:
   0:    0x580b4 - backtrace::backtrace::libunwind::trace::hd40b4f69fe271ed9
                       at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:    0x580b4 - backtrace::backtrace::trace_unsynchronized::h3ca9a364f54e964e
                       at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:    0x580b4 - std::sys_common::backtrace::_print_fmt::h982a8ae6b5f29f65
                       at src/libstd/sys_common/backtrace.rs:78
   3:    0x580b4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he8ccdc84a58ecc98
                       at src/libstd/sys_common/backtrace.rs:59
   4:    0x83040 - core::fmt::write::h23f93faacadec7cc
                       at src/libcore/fmt/mod.rs:1076
   5:    0x54940 - std::io::Write::write_fmt::haf0f338c5ed7de5f
                       at src/libstd/io/mod.rs:1537
   6:    0x5a88c - std::sys_common::backtrace::_print::h5683bffede5f926f
                       at src/libstd/sys_common/backtrace.rs:62
   7:    0x5a88c - std::sys_common::backtrace::print::h208a071bf789b7b7
                       at src/libstd/sys_common/backtrace.rs:49
   8:    0x5a88c - std::panicking::default_hook::{{closure}}::had93821ac17882da
                       at src/libstd/panicking.rs:198
   9:    0x5a558 - std::panicking::default_hook::ha27fdf8351cfa2f3
                       at src/libstd/panicking.rs:217
  10:    0x5af6c - std::panicking::rust_panic_with_hook::h5e82ec4b73107927
                       at src/libstd/panicking.rs:526
  11:    0x5ab6c - rust_begin_unwind
                       at src/libstd/panicking.rs:437
  12:    0x8170c - core::panicking::panic_fmt::h47be891d82598e44
                       at src/libcore/panicking.rs:85
  13:    0x81564 - core::option::expect_none_failed::h565bc8e7856c8fe7
                       at src/libcore/option.rs:1269
  14:    0x36e2c - core::result::Result<T,E>::unwrap::h916cdda944865138
                       at /rustc/6f959902b3103c49ca981fbc01871589c3498489/src/libcore/result.rs:1005
  15:    0x36e2c - test::run_test_in_process::h3c269a8ac50a2dd7
                       at src/libtest/lib.rs:556
  16:    0x36e2c - test::run_test::run_test_inner::{{closure}}::h15296ff2652b597f
                       at src/libtest/lib.rs:450
  17:    0x36424 - test::run_test::run_test_inner::hc9172a5fcccfeb6e
                       at src/libtest/lib.rs:475
  18:    0x34dd0 - test::run_test::h12bd73b7e259bc25
                       at src/libtest/lib.rs:505
  19:    0x264b4 - test::run_tests::ha1fdb36c7355f908
                       at src/libtest/lib.rs:284
  20:    0x264b4 - test::console::run_tests_console::he1caf03003813d3d
                       at src/libtest/console.rs:280
  21:    0x31b74 - test::test_main::hb716c54c676c2e08
                       at src/libtest/lib.rs:120
  22:    0x32c3c - test::test_main_static::hb9dfb706262f665b
                       at src/libtest/lib.rs:139
  23:    0x11970 - arm_test::main::he46c7a1e35416fc1
  24:    0x10f1c - std::rt::lang_start::{{closure}}::h250b51295a1aa3ab
                       at /rustc/6f959902b3103c49ca981fbc01871589c3498489/src/libstd/rt.rs:67
  25:    0x5b260 - std::rt::lang_start_internal::{{closure}}::h81f1dae74b28fcfc
                       at src/libstd/rt.rs:52
  26:    0x5b260 - std::panicking::try::do_call::ha6d54a9d8c9a8b73
                       at src/libstd/panicking.rs:348
  27:    0x5b260 - std::panicking::try::h018fe3feda747ef2
                       at src/libstd/panicking.rs:325
  28:    0x5b260 - std::panic::catch_unwind::hbcb5f8582e976c82
                       at src/libstd/panic.rs:394
  29:    0x5b260 - std::rt::lang_start_internal::h504aede73e26a7ed
                       at src/libstd/rt.rs:51
  30:    0x10ef0 - std::rt::lang_start::h5abd88271e1cf6f0
                       at /rustc/6f959902b3103c49ca981fbc01871589c3498489/src/libstd/rt.rs:67
  31:    0x119b8 - main
error: test failed, to rerun pass '--lib'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-bugCategory: This is a bug.ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsO-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions