Skip to content

Commit

Permalink
Merge pull request #319 from tgross35/test-feature
Browse files Browse the repository at this point in the history
Rename the `musl-bitwise-tests` feature to `test-musl-serialized`
  • Loading branch information
tgross35 authored Oct 26, 2024
2 parents e5aa09c + 739cad7 commit 52a82c5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
in `src/lib.rs`.
- Write some simple tests in your module (using `#[test]`)
- Run `cargo test` to make sure it works
- Run `cargo test --features libm-test/musl-bitwise-tests` to compare your
- Run `cargo test --features libm-test/test-musl-serialized` to compare your
implementation against musl's
- Send us a pull request! Make sure to run `cargo fmt` on your code before
sending the PR. Also include "closes #42" in the PR description to close the
Expand Down Expand Up @@ -80,15 +80,15 @@ let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 12

Normal tests can be executed with:

```
```sh
cargo test
```

If you'd like to run tests with randomized inputs that get compared against musl
itself, you'll need to be on a Linux system and then you can execute:

```
cargo test --features libm-test/musl-bitwise-tests
```sh
cargo test --features libm-test/test-musl-serialized
```

Note that you may need to pass `--release` to Cargo if there are errors related
Expand Down
4 changes: 2 additions & 2 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ $cmd --features 'unstable'
$cmd --release --features 'unstable'

# also run the reference tests
$cmd --features 'unstable libm-test/musl-bitwise-tests'
$cmd --release --features 'unstable libm-test/musl-bitwise-tests'
$cmd --features 'unstable libm-test/test-musl-serialized'
$cmd --release --features 'unstable libm-test/test-musl-serialized'
2 changes: 1 addition & 1 deletion crates/libm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ default = []

# Generate tests which are random inputs and the outputs are calculated with
# musl libc.
musl-bitwise-tests = ["rand"]
test-musl-serialized = ["rand"]

[dependencies]
libm = { path = "../.." }
Expand Down
4 changes: 2 additions & 2 deletions crates/libm-test/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fn main() {
#[cfg(feature = "musl-bitwise-tests")]
#[cfg(feature = "test-musl-serialized")]
musl_reference_tests::generate();
}

#[cfg(feature = "musl-bitwise-tests")]
#[cfg(feature = "test-musl-serialized")]
mod musl_reference_tests {
use rand::seq::SliceRandom;
use rand::Rng;
Expand Down
2 changes: 1 addition & 1 deletion crates/libm-test/tests/musl_biteq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520
#[cfg(not(target_arch = "powerpc64"))]
#[cfg(all(test, feature = "musl-bitwise-tests"))]
#[cfg(all(test, feature = "test-musl-serialized"))]
include!(concat!(env!("OUT_DIR"), "/musl-tests.rs"));

0 comments on commit 52a82c5

Please sign in to comment.