diff --git a/Cargo.toml b/Cargo.toml index 2f68ecc..bd1bb80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,12 +26,11 @@ checked = [] [workspace] members = [ "crates/compiler-builtins-smoke-test", + "crates/libm-bench", ] [dev-dependencies] no-panic = "0.1.8" -rand = "0.6.5" -paste = "0.1.5" [build-dependencies] rand = { version = "0.6.5", optional = true } diff --git a/README.md b/README.md index edd54d4..8b93f26 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,11 @@ The API documentation can be found [here](https://docs.rs/libm). ## Benchmark [benchmark]: #benchmark -Run `cargo +nightly bench` -NOTE: remember to have nightly installed `rustup install nightly` +The benchmarks are located in `crates/libm-bench` and require a nightly Rust toolchain. +To run all benchmarks: + +> cargo +nightly bench --all ## Contributing diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e9cb916..c89346c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,7 +77,7 @@ jobs: vmImage: ubuntu-16.04 steps: - template: ci/azure-install-rust.yml - - bash: cargo bench + - bash: cargo bench --all displayName: "Benchmarks" variables: TOOLCHAIN: nightly diff --git a/ci/run.sh b/ci/run.sh index 42c2416..37ffb87 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -1,11 +1,15 @@ -#!/bin/sh +#!/usr/bin/env sh set -ex TARGET=$1 -cargo test --target $TARGET -cargo test --target $TARGET --release +CMD="cargo test --all --no-default-features --target $TARGET" -cargo test --features 'checked musl-reference-tests' --target $TARGET +$CMD +$CMD --release -cargo test --features 'checked musl-reference-tests' --target $TARGET --release +$CMD --features 'stable' +$CMD --release --features 'stable' + +$CMD --features 'stable checked musl-reference-tests' +$CMD --release --features 'stable checked musl-reference-tests' diff --git a/crates/libm-bench/Cargo.toml b/crates/libm-bench/Cargo.toml new file mode 100644 index 0000000..ba65dbd --- /dev/null +++ b/crates/libm-bench/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "libm-bench" +version = "0.1.0" +authors = ["Gonzalo Brito Gadeschi "] +edition = "2018" +license = "MIT OR Apache-2.0" + +[dependencies] +libm = { path = "../..", default-features = false } +rand = "0.6.5" +paste = "0.1.5" + +[features] +default = [] +stable = [ "libm/stable" ] diff --git a/benches/bench.rs b/crates/libm-bench/benches/bench.rs similarity index 98% rename from benches/bench.rs rename to crates/libm-bench/benches/bench.rs index 522ac4e..b6d8741 100644 --- a/benches/bench.rs +++ b/crates/libm-bench/benches/bench.rs @@ -1,7 +1,4 @@ #![feature(test)] - -extern crate paste; -extern crate rand; extern crate test; use rand::Rng;