Tweak testing and such:

* Don't run `intrinsics` tests on thumb
* Disable `compiler_builtins` attribute on `feature = "gen-tests"`
* Disable mangling on `feature = "gen-tests"` instead of `cfg(test)`
This commit is contained in:
Alex Crichton 2017-06-24 10:04:00 -07:00
parent 76430488e6
commit 734ec3d31c
5 changed files with 42 additions and 14 deletions

View File

@ -18,7 +18,12 @@ compiler-builtins = []
default = ["compiler-builtins"]
mem = []
rustbuild = ["compiler-builtins"]
# generate tests
#
# Note that this is an internal-only feature used in testing, this should not
# be relied on with crates.io! Enabling this may expose you to breaking
# changes.
gen-tests = ["cast", "rand"]
[target.'cfg(all(target_arch = "arm", not(any(target_env = "gnu", target_env = "musl")), target_os = "linux"))'.dev-dependencies]
@ -26,10 +31,8 @@ test = { git = "https://github.com/japaric/utest" }
utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japaric/utest" }
utest-macros = { git = "https://github.com/japaric/utest" }
[[example]]
name = "intrinsics"
required-features = ["c", "compiler-builtins"]
[workspace]

View File

@ -1,17 +1,25 @@
environment:
DEBUG_LTO_BUILD_DOESNT_WORK: 1
# It's... a little unclear why the memcpy symbols clash on linux but not on
# other platforms. Would be great to not differ on this though!
INTRINSICS_FAILS_WITH_MEM_FEATURE: 1
matrix:
- TARGET: i686-pc-windows-msvc
- TARGET: x86_64-pc-windows-msvc
# Ensure MinGW works, but we need to download the 32-bit MinGW compiler from a
# custom location.
#
# Note that the MinGW builds have tons of references to
# `rust_eh_unwind_resume` in the debug LTO builds that aren't optimized out,
# so we skip that test for now. Would be great to not skip it!
- TARGET: i686-pc-windows-gnu
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
MINGW_DIR: mingw32
DEBUG_LTO_BUILD_DOESNT_WORK: 1
- TARGET: x86_64-pc-windows-gnu
DEBUG_LTO_BUILD_DOESNT_WORK: 1
install:
- git submodule update --init

View File

@ -10,6 +10,10 @@ case $1 in
esac
INTRINSICS_FEATURES="c"
# Some architectures like ARM apparently seem to require the `mem` feature
# enabled to successfully compile the `intrinsics` example, and... we're not
# sure why!
if [ -z "$INTRINSICS_FAILS_WITH_MEM_FEATURE" ]; then
INTRINSICS_FEATURES="$INTRINSICS_FEATURES mem"
fi
@ -47,16 +51,13 @@ case $1 in
done
;;
*)
cargo test --no-default-features --features gen-tests --target $1
cargo test --no-default-features --features 'gen-tests c' --target $1
cargo test --no-default-features --features gen-tests --target $1 --release
cargo test --no-default-features --features 'gen-tests c' --target $1 --release
cargo test --features gen-tests --target $1
cargo test --features 'gen-tests c' --target $1
cargo test --features gen-tests --target $1 --release
cargo test --features 'gen-tests c' --target $1 --release
;;
esac
# Verify that we haven't drop any intrinsic/symbol
$cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
PREFIX=$(echo $1 | sed -e 's/unknown-//')-
case $1 in
armv7-*)
@ -105,7 +106,22 @@ done
rm -f $path
# Verify that there are no undefined symbols to `panic` within our implementations
# Verification of the `intrinsics` program doesn't work on thumb targets right
# now.
case $1 in
thumb*)
exit 0
;;
*)
;;
esac
# Verify that we haven't drop any intrinsic/symbol
$cargo build --features "$INTRINSICS_FEATURES" --target $1 --example intrinsics
# Verify that there are no undefined symbols to `panic` within our
# implementations
#
# TODO(#79) fix the undefined references problem for debug-assertions+lto
if [ -z "$DEBUG_LTO_BUILD_DOESNT_WORK" ]; then
RUSTFLAGS="-C debug-assertions=no" \

View File

@ -1,6 +1,7 @@
#![cfg_attr(not(stage0), deny(warnings))]
#![cfg_attr(not(test), no_std)]
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
#![cfg_attr(all(feature = "compiler-builtins",
not(feature = "gen-tests")), compiler_builtins)]
#![crate_name = "compiler_builtins"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",

View File

@ -240,7 +240,7 @@ macro_rules! intrinsics {
// This is the final catch-all rule. At this point we just generate an
// intrinsic with a conditional `#[no_mangle]` directive to avoid
// interfereing with duplicate symbols and whatnot.
// interfereing with duplicate symbols and whatnot during testing.
//
// After the intrinsic is defined we just continue with the rest of the
// input we were given.
@ -253,7 +253,7 @@ macro_rules! intrinsics {
$($rest:tt)*
) => (
$(#[$($attr)*])*
#[cfg_attr(not(test), no_mangle)]
#[cfg_attr(not(feature = "gen-tests"), no_mangle)]
pub extern $abi fn $name( $($argname: $ty),* ) -> $ret {
$($body)*
}