]> git.proxmox.com Git - cargo.git/commitdiff
Auto merge of #3510 - froydnj:cross-compilation-test-checking, r=alexcrichton
authorbors <bors@rust-lang.org>
Mon, 9 Jan 2017 04:20:40 +0000 (04:20 +0000)
committerbors <bors@rust-lang.org>
Mon, 9 Jan 2017 04:20:40 +0000 (04:20 +0000)
handle cross-compilation test failure more gracefully

The current cross-compilation test module fails every test if an appropriate cross standard library is not found.  This behavior is unhelpful, because the failures are verbose, unexpected, and there's no
obvious way to make them go away.

Instead, it would be better to check once before all the tests that an appropriate cross-compilation setup is available.  Once that check has been done, a single test can fail with an appropriate `panic!` message while the other tests silently pass.  The `panic!` message can inform the user about their options, either setting an appropriate environment variable, or using rustup to install the necessary cross standard library.

Assuming the user has rustup installed, the single failure now looks
something like:

```
thread 'plugin_deps' panicked at 'Cannot cross compile to i686-unknown-linux-gnu.

This failure can be safely ignored. If you would prefer to not see this
failure, you can set the environment variable CFG_DISABLE_CROSS_TESTS to "1".

Alternatively, you can install the necessary libraries for cross-compilation with

    rustup toolchain install stable-i686-unknown-linux-gnu
', tests/cross-compile.rs:87
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

The code is admittedly gnarly, with synchronization and `unsafe` sections, but I wasn't sure how to make it any better. Suggestions welcome!

Fixes #3086.


Trivial merge