Skip to content
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
280 changes: 35 additions & 245 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,264 +1,63 @@
language: rust
sudo: false

# We support too many combinations of Rust releases, crate features, operating
# systems, and architectures to even remotely test all combinations.
# Yet it turns out we can test most of these independent of each other, because
# they serve different goals or test different pieces of code.
#
# RUST RELEASES
# Goal: make sure we don't use language features unavailable on a certain
# version, and build without warnings.
# We have different builders use 4 Rust releases, a pinned stable release,
# the latest stable, beta and nightly.
#
# ARCHITECTURES
# Goal: test against issues caused by differences in endianness, pointer sizes,
# etc.
# We run tests on 4 different architectures.
# - x64_84, default on Travis (Linux) and AppVeyor (Windows)
# - i686, second AppVeyor (Windows) configuration
# - MIPS, big-endian Linux emulated with QEMU (thanks to Trust)
# - ARMv7, Android emulated with QEMU (thanks to Trust)
#
# OPERATING SYSTEMS
# Goal: test on many operating systems, to verify the OsRng code, which is
# mostly architecture-independent.
# We run tests on Linux, OS X, Windows, Android (emulated), and Node.js (using
# cargo-web).
# One builder cross-compiles for many of the remaining OSes, which ensures we
# keep building, but doesn't run tests.
# OSes supported by Rand but which we can't cross-compile because there
# is no pre-built standard library available: Dragonfly BSD, Haiku, OpenBSD.
#
# CRATE FEATURES, TESTS, AND SUB-CRATES
# Goal: Run unit tests, doctests, examples, and test benchmarks for all crates,
# in configurations that cover all interesting combinations of features.
# Tests run on rand:
# - test no_std support, but only the unit tests:
# `cargo test --tests --no-default-features`
# - test no_std support, including the alloc feature:
# cargo test --tests --no-default-features --features=alloc
# - run unit tests and doctests with all features which are available on stable:
# `cargo test --features=serde1,log`
# - test examples:
# `cargo test --examples`
# Additional tests on nightly:
# - run unit tests and doctests with all features which are available on nightly:
# `cargo test --all-features`
# - run benchmarks as tests:
# `cargo test --benches --features=nightly`
# Tests on subcrates:
# - select crates via --manifest-path (more reliable than --package)
# - test appropriate feature matrix
#
# TODO: SIMD support on stable releases
# NOTE: SIMD support is unreliable on nightly; we track the latest release
# NOTE: Test for alloc feature in no_std is not included here because it depends
# on the alloc crate stabilized in Rust 1.36.
# Since most OS-specific code has moved to the getrandom crate, we require
# few target-specific tests here.

matrix:
include:
- rust: 1.32.0
env: DESCRIPTION="Linux, 1.32.0"
name: "Linux, 1.32.0"
env: ALLOC=0
os: linux
script:
# Differs from standard script: rand_pcg features
- cargo test --tests --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
# TODO: cannot test rand_pcg due to explicit dependency on i128
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml

- rust: 1.32.0
env: DESCRIPTION="OSX, 1.32.0"
os: osx
script:
# Differs from standard script: rand_pcg features
- cargo test --tests --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
# TODO: cannot test rand_pcg due to explicit dependency on i128
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml

- rust: stable
env: DESCRIPTION="Linux, stable"
name: "Linux, stable"

- rust: stable
env: DESCRIPTION="OSX+iOS, stable"
name: "OSX+iOS, stable"
os: osx
install:
- rustup target add aarch64-apple-ios
script:
# Differs from standard script: includes aarch64-apple-ios cross-build
- cargo test --tests --no-default-features
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
- bash utils/ci/script.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need macOS and iOS tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know; possibly not. These aren't too slow in any case (unlike the WASM tests).

- cargo build --target=aarch64-apple-ios

- rust: beta
env: DESCRIPTION="Linux, beta"
name: "Linux, beta"

- rust: nightly
os: linux
env: DESCRIPTION="Linux, nightly, docs"
name: "Linux, nightly, docs"
env: NIGHTLY=1
install:
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
- cargo deadlinks -V
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
# Differs from standard script: all features, doc build
- cargo test --tests --no-default-features --features=alloc
- cargo test --all-features
- cargo test --benches --features=nightly
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
- bash utils/ci/script.sh
# remove cached documentation, otherwise files from previous PRs can get included
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc
after_success:
- travis-cargo --only nightly doc-upload

- rust: nightly
os: osx
env: DESCRIPTION="OSX, nightly, docs"
install:
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
- cargo deadlinks -V
script:
# Differs from standard script: all features, doc build
- cargo test --tests --no-default-features --features=alloc
- cargo test --all-features
- cargo test --benches --features=nightly
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
# remove cached documentation, otherwise files from previous PRs can get included
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc

- rust: nightly
env: DESCRIPTION="WASM via emscripten, stdweb and wasm-bindgen"
install:
- rustup target add wasm32-unknown-unknown
- rustup target add wasm32-unknown-emscripten
- nvm install 9
- ./utils/ci/install_cargo_web.sh
- cargo web prepare-emscripten
- cargo web -V
- cargo list | grep install-update || cargo install -f cargo-update
- cargo install-update -i cargo-update wasm-bindgen-cli wasm-pack
addons:
chrome: stable
script:
# Testing wasm32-unknown-emscripten fails because of rust-lang/rust#49877
# However, we can still build and link all tests to make sure that works.
# This is actually useful as it finds stuff such as rust-random/rand#669
- EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" cargo web test --target wasm32-unknown-emscripten --no-run
#- cargo web test --target wasm32-unknown-emscripten
#- cargo web test --nodejs --target wasm32-unknown-emscripten
#- cargo build --target wasm32-unknown-unknown # without any features
- cargo build --target wasm32-unknown-unknown --features=wasm-bindgen
- cargo web test --target wasm32-unknown-unknown --features=stdweb
- cargo build --manifest-path tests/wasm_bindgen/Cargo.toml --target wasm32-unknown-unknown
- wasm-bindgen --nodejs target/wasm32-unknown-unknown/debug/rand_wasm_bindgen_test.wasm --out-dir tests/wasm_bindgen/js
- node tests/wasm_bindgen/js/index.js
- wasm-pack test --node tests/wasm_bindgen

- rust: nightly
env: DESCRIPTION="cross-platform builder (doesn't run tests)"
install:
- rustup target add x86_64-sun-solaris
- rustup target add x86_64-unknown-cloudabi
- rustup target add x86_64-unknown-freebsd
#- rustup target add x86_64-unknown-fuchsia
- rustup target add x86_64-unknown-netbsd
- rustup target add x86_64-unknown-redox
script:
# Test the top-level crate with all features:
- cargo build --target=x86_64-sun-solaris --all-features
- cargo build --target=x86_64-unknown-cloudabi --all-features
- cargo build --target=x86_64-unknown-freebsd --all-features
#- cargo build --target=x86_64-unknown-fuchsia --all-features
- cargo build --target=x86_64-unknown-netbsd --all-features
- cargo build --target=x86_64-unknown-redox --all-features

# Trust cross-built/emulated targets. We must repeat all non-default values.
- rust: stable
sudo: required
dist: trusty
services: docker
env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh
# This target catches endianness issues
- rust: stable
sudo: required
dist: trusty
services: docker
env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi
name: "Linux (MIPS, big-endian)"
env: TARGET=mips-unknown-linux-gnu
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh

# This target checks we really can build no_std binaries
- rust: nightly
env: DESCRIPTION="no_std platform test"
name: "no_std platform test"
install:
- rustup target add thumbv6m-none-eabi
script:
Expand All @@ -267,44 +66,35 @@ matrix:

- rust: nightly
os: linux
env: DESCRIPTION="Miri, nightly"
name: "Miri, nightly"
script:
- sh utils/ci/miri.sh

- rust: nightly
os: linux
name: "Minimal dep versions"
script:
- cargo generate-lockfile -Z minimal-versions
- bash utils/ci/script.sh

before_install:
- set -e
- rustup self update

script:
- cargo test --tests --no-default-features
- cargo test --tests --no-default-features --features getrandom
- cargo test --tests --no-default-features --features=alloc
# TODO: add simd_support feature:
- cargo test --features=serde1,log
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
- bash utils/ci/script.sh

after_script: set +e

cache:
cargo: true
directories:
- .local/share/cargo-web
# Cache: this seems to do more harm than good
#cache:
#cargo: true
#directories:
#- .local/share/cargo-web

before_cache:
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo
#before_cache:
## Travis can't cache files that are not readable by "others"
#- chmod -R a+r $HOME/.cargo

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rand_pcg = { path = "rand_pcg", version = "0.2", optional = true }
# This is a dependency because: we forward wasm feature flags
# This is renamed because: we need getrandom to depend on rand_core/getrandom
getrandom_package = { version = "0.1.1", package = "getrandom", optional = true }
log = { version = "0.4", optional = true }
log = { version = "0.4.4", optional = true }

[dependencies.packed_simd]
# NOTE: so far no version works reliably due to dependence on unstable features
Expand Down
7 changes: 5 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ install:
build: false

test_script:
- cargo test --tests --no-default-features --features alloc
# TODO: use --all-features once simd_support is sufficiently stable:
- cargo test --tests --no-default-features
- cargo test --tests --no-default-features --features=alloc,getrandom
# all stable features:
- cargo test --features=serde1,log
- cargo test --benches --features=nightly
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_distr/Cargo.toml
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
Expand All @@ -46,4 +48,5 @@ test_script:
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
4 changes: 3 additions & 1 deletion rand_distr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ rand = { path = "..", version = "0.7" }
[dev-dependencies]
rand_pcg = { version = "0.2", path = "../rand_pcg" }
# Histogram implementation for testing uniformity
average = "0.9.2"
average = "0.10.0"
# Not a direct dependency but required to boost the minimum version:
conv = "0.3.2"
6 changes: 4 additions & 2 deletions rand_isaac/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ serde1 = ["serde", "rand_core/serde1"]

[dependencies]
rand_core = { path = "../rand_core", version = "0.5" }
serde = { version = "1", features = ["derive"], optional = true }
serde = { version = "1.0.63", features = ["derive"], optional = true }
# Not a direct dependency but required to boost the minimum version:
serde_derive = { version = "1.0.63", optional = true }

[dev-dependencies]
# This is for testing serde, unfortunately we can't specify feature-gated dev
# deps yet, see: https://github.com/rust-lang/cargo/issues/1596
bincode = "1"
bincode = "1.1.4"
Loading