Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh the CI setup #224

Merged
merged 9 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 8 additions & 5 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion crates/libm-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ paste = "0.1.5"

[features]
default = []
stable = [ "libm/stable" ]
unstable = [ "libm/unstable" ]
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/math/lgamma_r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/math/lgammaf_r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -36,7 +36,7 @@ macro_rules! i {
};
}

#[cfg(feature = "checked")]
#[cfg(debug_assertions)]
macro_rules! i {
($array:expr, $index:expr) => {
*$array.get($index).unwrap()
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/math/rem_pio2_large.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/math/sincos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
4 changes: 2 additions & 2 deletions src/math/sincosf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}