Merge pull request rust-lang/libm#224 from Lokathor/new-CI

Refresh the CI setup
This commit is contained in:
Alex Crichton 2019-09-09 10:59:45 -05:00 committed by GitHub
commit 709a1dc45a
11 changed files with 37 additions and 29 deletions

View file

@ -11,18 +11,16 @@ version = "0.2.0"
edition = "2018"
[features]
# only used to run our test suite
default = ['stable']
stable = []
default = []
# This tells the compiler to assume that a Nightly toolchain is being used and
# that it should activate any useful Nightly things accordingly.
unstable = []
# Generate tests which are random inputs and the outputs are calculated with
# musl libc.
musl-reference-tests = ['rand']
# Used checked array indexing instead of unchecked array indexing in this
# library.
checked = []
[workspace]
members = [
"crates/compiler-builtins-smoke-test",

View file

@ -49,8 +49,6 @@ jobs:
displayName: "Install rust wasm target"
- script: cargo build --target wasm32-unknown-unknown
displayName: "Build for wasm"
- script: cargo build --target wasm32-unknown-unknown --no-default-features
displayName: "Build for wasm (no default features)"
variables:
TOOLCHAIN: nightly

View file

@ -3,13 +3,16 @@
set -ex
TARGET=$1
CMD="cargo test --all --no-default-features --target $TARGET"
CMD="cargo test --all --target $TARGET"
# stable by default
$CMD
$CMD --release
$CMD --features 'stable'
$CMD --release --features 'stable'
# unstable with a feature
$CMD --features 'unstable'
$CMD --release --features 'unstable'
$CMD --features 'stable checked musl-reference-tests'
$CMD --release --features 'stable checked musl-reference-tests'
# also run the reference tests
$CMD --features 'unstable musl-reference-tests'
$CMD --release --features 'unstable musl-reference-tests'

View file

@ -12,4 +12,4 @@ paste = "0.1.5"
[features]
default = []
stable = [ "libm/stable" ]
unstable = [ "libm/unstable" ]

View file

@ -2,9 +2,18 @@
#![deny(warnings)]
#![no_std]
#![cfg_attr(
all(target_arch = "wasm32", not(feature = "stable")),
all(target_arch = "wasm32", feature = "unstable"),
feature(core_intrinsics)
)]
#![allow(clippy::unreadable_literal)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::needless_return)]
#![allow(clippy::int_plus_one)]
#![allow(clippy::deprecated_cfg_attr)]
#![allow(clippy::mixed_case_hex_literals)]
#![allow(clippy::float_cmp)]
#![allow(clippy::eq_op)]
#![allow(clippy::assign_op_pattern)]
mod math;

View file

@ -270,9 +270,9 @@ pub fn lgamma_r(mut x: f64) -> (f64, i32) {
p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));
r += -0.5 * y + p1 / p2;
}
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
_ => unreachable!(),
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
_ => {}
}
} else if ix < 0x40200000 {

View file

@ -205,9 +205,9 @@ pub fn lgammaf_r(mut x: f32) -> (f32, i32) {
p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));
r += -0.5 * y + p1 / p2;
}
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
_ => unreachable!(),
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
_ => {}
}
} else if ix < 0x41000000 {

View file

@ -6,7 +6,7 @@ macro_rules! force_eval {
};
}
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
macro_rules! i {
($array:expr, $index:expr) => {
unsafe { *$array.get_unchecked($index) }
@ -36,7 +36,7 @@ macro_rules! i {
};
}
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
macro_rules! i {
($array:expr, $index:expr) => {
*$array.get($index).unwrap()
@ -60,7 +60,7 @@ macro_rules! i {
macro_rules! llvm_intrinsically_optimized {
(#[cfg($($clause:tt)*)] $e:expr) => {
#[cfg(all(not(feature = "stable"), $($clause)*))]
#[cfg(all(feature = "unstable", $($clause)*))]
{
if true { // thwart the dead code lint
$e

View file

@ -461,9 +461,9 @@ pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) ->
i!(y, 2, =, -fw);
}
}
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
_ => unreachable!(),
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
_ => {}
}
n & 7

View file

@ -51,9 +51,9 @@ pub fn sincos(x: f64) -> (f64, f64) {
1 => (c, -s),
2 => (-s, -c),
3 => (-c, s),
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
_ => unreachable!(),
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
_ => (0.0, 1.0),
}
}

View file

@ -115,9 +115,9 @@ pub fn sincosf(x: f32) -> (f32, f32) {
1 => (c, -s),
2 => (-s, -c),
3 => (-c, s),
#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
_ => unreachable!(),
#[cfg(not(feature = "checked"))]
#[cfg(not(debug_assertions))]
_ => (0.0, 1.0),
}
}