Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.
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
20 changes: 12 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
`src/math/mod.rs` accordingly. Also, uncomment the corresponding trait method
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/test-musl-serialized` to compare your
implementation against musl's
- Run `cargo test` to make sure it works. Full tests are only run when enabling
features, see [Testing](#testing) below.
- 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
corresponding issue.
Expand Down Expand Up @@ -66,12 +65,17 @@ Normal tests can be executed with:
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:
If you'd like to run tests with randomized inputs that get compared against
infinite-precision results, run:

```sh
cargo test --features libm-test/test-musl-serialized
cargo test --features libm-test/test-multiprecision,libm-test/build-musl --release
```

Note that you may need to pass `--release` to Cargo if there are errors related
to integer overflow.
The multiprecision tests use the [`rug`] crate for bindings to MPFR. MPFR can
be difficult to build on non-Unix systems, refer to [`gmp_mpfr_sys`] for help.

`build-musl` does not build with MSVC, Wasm, or Thumb.

[`rug`]: https://docs.rs/rug/latest/rug/
[`gmp_mpfr_sys`]: https://docs.rs/gmp-mpfr-sys/1.6.4/gmp_mpfr_sys/
5 changes: 0 additions & 5 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ case "$target" in
*windows-gnu) extra_flags="$extra_flags --exclude libm-macros" ;;
esac

if [ "$(uname -a)" = "Linux" ]; then
# also run the reference tests when we can. requires a Linux host.
extra_flags="$extra_flags --features libm-test/test-musl-serialized"
fi

# Make sure we can build with overriding features. We test the indibidual
# features it controls separately.
cargo check --no-default-features
Expand Down
1 change: 0 additions & 1 deletion crates/libm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ default = []

# Generate tests which are random inputs and the outputs are calculated with
# musl libc.
test-musl-serialized = ["rand"]
test-multiprecision = ["dep:az", "dep:rug"]

# Build our own musl for testing and benchmarks
Expand Down
Loading
Loading