From 49da56132b8cc746a16536a0966e27c01c55c147 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 28 Aug 2019 16:05:53 +0100 Subject: [PATCH 1/5] Travis CI: update scripts; remove redundencies --- .travis.yml | 123 ++++----------------------------------------- appveyor.yml | 7 ++- utils/ci/script.sh | 64 +++++++++++++++++------ 3 files changed, 63 insertions(+), 131 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3790dc0804..f7fffc985a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,54 +51,15 @@ sudo: false # 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. matrix: include: - rust: 1.32.0 - env: DESCRIPTION="Linux, 1.32.0" + env: DESCRIPTION="Linux, 1.32.0", 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" + env: DESCRIPTION="OSX, 1.32.0", ALLOC=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" @@ -109,22 +70,7 @@ matrix: 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 - cargo build --target=aarch64-apple-ios - rust: beta @@ -132,29 +78,14 @@ matrix: - rust: nightly os: linux - env: DESCRIPTION="Linux, nightly, docs" + env: DESCRIPTION="Linux, nightly, docs", 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 @@ -164,27 +95,12 @@ matrix: - rust: nightly os: osx - env: DESCRIPTION="OSX, nightly, docs" + env: DESCRIPTION="OSX, nightly, docs", NIGHTLY=1 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 + - 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 @@ -245,8 +161,7 @@ matrix: install: - sh utils/ci/install.sh - source ~/.cargo/env || true - script: - - bash utils/ci/script.sh + - rust: stable sudo: required dist: trusty @@ -255,8 +170,7 @@ matrix: install: - sh utils/ci/install.sh - source ~/.cargo/env || true - script: - - bash utils/ci/script.sh + - rust: nightly env: DESCRIPTION="no_std platform test" install: @@ -276,24 +190,7 @@ before_install: - 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 diff --git a/appveyor.yml b/appveyor.yml index ef0b4bff66b..a4cfbeed61d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 @@ -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 diff --git a/utils/ci/script.sh b/utils/ci/script.sh index 852a850bd3c..7a90fa984ea 100644 --- a/utils/ci/script.sh +++ b/utils/ci/script.sh @@ -2,23 +2,55 @@ set -ex +# ----- Options ----- + +# TARGET enables cross-building +if [ -z $TARGET ]; then + CARGO=cargo +else + CARGO="cross --target $TARGET" +fi + +# ALLOC defaults on; is disabled for rustc < 1.36 +if [ -z $ALLOC ]; then + ALLOC=1 +fi + +# NIGHTLY defaults off + + +# ----- Script ----- + main() { - cross test --target $TARGET --tests --no-default-features - # TODO: add simd_support feature: - cross test --target $TARGET --features=log - cross test --target $TARGET --examples - cross test --target $TARGET --manifest-path rand_core/Cargo.toml - cross test --target $TARGET --manifest-path rand_core/Cargo.toml --features=serde1 - cross test --target $TARGET --manifest-path rand_core/Cargo.toml --no-default-features - cross test --target $TARGET --manifest-path rand_distr/Cargo.toml - cross test --target $TARGET --manifest-path rand_isaac/Cargo.toml --features=serde1 - cross test --target $TARGET --manifest-path rand_pcg/Cargo.toml --features=serde1 - cross test --target $TARGET --manifest-path rand_xorshift/Cargo.toml --features=serde1 - cross test --target $TARGET --manifest-path rand_xoshiro/Cargo.toml --features=serde1 - cross test --target $TARGET --manifest-path rand_chacha/Cargo.toml - cross test --target $TARGET --manifest-path rand_hc/Cargo.toml - cross test --target $TARGET --manifest-path rand_os/Cargo.toml - cross test --target $TARGET --manifest-path rand_jitter/Cargo.toml + if [ "0$NIGHTLY" -ge 1 ]; then + $CARGO test --all-features + $CARGO test --benches --features=nightly + else + # all stable features: + $CARGO test --features=serde1,log,small_rng + fi + + if [ "$ALLOC" -ge 1 ]; then + $CARGO test --tests --no-default-features --features=alloc,getrandom,small_rng + fi + + $CARGO test --tests --no-default-features + $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_core/Cargo.toml --no-default-features --features=getrandom + + $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 } # we don't run the "test phase" when doing deploys From 9fb16583033ddad22e99d505897b0fbd293e15aa Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 28 Aug 2019 16:15:10 +0100 Subject: [PATCH 2/5] Travis CI: reduce target list and disable caching --- .travis.yml | 143 +++++----------------------------------------------- 1 file changed, 13 insertions(+), 130 deletions(-) diff --git a/.travis.yml b/.travis.yml index f7fffc985a2..811e772b21e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,66 +1,15 @@ 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 +# 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", ALLOC=0 os: linux - - rust: 1.32.0 - env: DESCRIPTION="OSX, 1.32.0", ALLOC=0 - os: osx - - rust: stable env: DESCRIPTION="Linux, stable" @@ -93,66 +42,7 @@ matrix: after_success: - travis-cargo --only nightly doc-upload - - rust: nightly - os: osx - env: DESCRIPTION="OSX, nightly, docs", NIGHTLY=1 - install: - - cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks - - cargo deadlinks -V - script: - - 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 - - - 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. + # This target catches endianness issues - rust: stable sudo: required dist: trusty @@ -162,15 +52,7 @@ matrix: - sh utils/ci/install.sh - source ~/.cargo/env || true - - rust: stable - sudo: required - dist: trusty - services: docker - env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi - install: - - sh utils/ci/install.sh - - source ~/.cargo/env || true - + # This target checks we really can build no_std binaries - rust: nightly env: DESCRIPTION="no_std platform test" install: @@ -194,14 +76,15 @@ script: 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: From bc693232f201d7aae4a5f8af307113491d6eceae Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 28 Aug 2019 16:40:08 +0100 Subject: [PATCH 3/5] Travis CI: fixes --- .travis.yml | 4 ++-- utils/ci/script.sh | 41 +++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 811e772b21e..f603df94d6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ sudo: false matrix: include: - rust: 1.32.0 - env: DESCRIPTION="Linux, 1.32.0", ALLOC=0 + env: DESCRIPTION="Linux, 1.32.0" ALLOC=0 os: linux - rust: stable @@ -27,7 +27,7 @@ matrix: - rust: nightly os: linux - env: DESCRIPTION="Linux, nightly, docs", NIGHTLY=1 + env: DESCRIPTION="Linux, nightly, docs" NIGHTLY=1 install: - cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks - cargo deadlinks -V diff --git a/utils/ci/script.sh b/utils/ci/script.sh index 7a90fa984ea..0af8ab3228f 100644 --- a/utils/ci/script.sh +++ b/utils/ci/script.sh @@ -8,7 +8,8 @@ set -ex if [ -z $TARGET ]; then CARGO=cargo else - CARGO="cross --target $TARGET" + CARGO=cross + TARGET="--target $TARGET" fi # ALLOC defaults on; is disabled for rustc < 1.36 @@ -23,34 +24,34 @@ fi main() { if [ "0$NIGHTLY" -ge 1 ]; then - $CARGO test --all-features - $CARGO test --benches --features=nightly + $CARGO test $TARGET --all-features + $CARGO test $TARGET --benches --features=nightly else # all stable features: - $CARGO test --features=serde1,log,small_rng + $CARGO test $TARGET --features=serde1,log,small_rng fi if [ "$ALLOC" -ge 1 ]; then - $CARGO test --tests --no-default-features --features=alloc,getrandom,small_rng + $CARGO test $TARGET --tests --no-default-features --features=alloc,getrandom,small_rng + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc fi - $CARGO test --tests --no-default-features - $CARGO test --examples + $CARGO test $TARGET --tests --no-default-features + $CARGO test $TARGET --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_core/Cargo.toml --no-default-features --features=getrandom + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=getrandom - $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 + $CARGO test $TARGET --manifest-path rand_distr/Cargo.toml + $CARGO test $TARGET --manifest-path rand_isaac/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_pcg/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_xorshift/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_xoshiro/Cargo.toml + $CARGO test $TARGET --manifest-path rand_chacha/Cargo.toml + $CARGO test $TARGET --manifest-path rand_hc/Cargo.toml + $CARGO test $TARGET --manifest-path rand_jitter/Cargo.toml + $CARGO test $TARGET --manifest-path rand_os/Cargo.toml } # we don't run the "test phase" when doing deploys From 94aa8fa9f1d592857a5aa0a4e9a681cfa482e91a Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Wed, 28 Aug 2019 16:36:20 +0100 Subject: [PATCH 4/5] Add testing of minimal versions Closes #741 This seems to require a couple of hacks unfortunately. --- .travis.yml | 7 +++++++ Cargo.toml | 2 +- rand_distr/Cargo.toml | 4 +++- rand_isaac/Cargo.toml | 6 ++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f603df94d6a..f3112de0632 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,6 +66,13 @@ matrix: env: DESCRIPTION="Miri, nightly" script: - sh utils/ci/miri.sh + + - rust: nightly + os: linux + env: DESCRIPTION="Minimal dep versions" + script: + - cargo generate-lockfile -Z minimal-versions + - bash utils/ci/script.sh before_install: - set -e diff --git a/Cargo.toml b/Cargo.toml index b87559abdfe..2cc2d9181d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/rand_distr/Cargo.toml b/rand_distr/Cargo.toml index 315a5b06095..3eab050ef9c 100644 --- a/rand_distr/Cargo.toml +++ b/rand_distr/Cargo.toml @@ -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" diff --git a/rand_isaac/Cargo.toml b/rand_isaac/Cargo.toml index c11c305ab17..a63ab18147e 100644 --- a/rand_isaac/Cargo.toml +++ b/rand_isaac/Cargo.toml @@ -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" From e13b8532c4cf6f96023ca5fc650bc2c3eaf3571c Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 31 Aug 2019 10:16:11 +0100 Subject: [PATCH 5/5] Address review feedback --- .travis.yml | 21 ++++++++++++--------- utils/ci/script.sh | 36 ++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3112de0632..bb4ce0fb9fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,15 @@ sudo: false matrix: include: - rust: 1.32.0 - env: DESCRIPTION="Linux, 1.32.0" ALLOC=0 + name: "Linux, 1.32.0" + env: ALLOC=0 os: linux - 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 @@ -23,11 +24,12 @@ matrix: - cargo build --target=aarch64-apple-ios - rust: beta - env: DESCRIPTION="Linux, beta" + name: "Linux, beta" - rust: nightly os: linux - env: DESCRIPTION="Linux, nightly, docs" NIGHTLY=1 + name: "Linux, nightly, docs" + env: NIGHTLY=1 install: - cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks - cargo deadlinks -V @@ -47,14 +49,15 @@ matrix: sudo: required dist: trusty services: docker - env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu + name: "Linux (MIPS, big-endian)" + env: TARGET=mips-unknown-linux-gnu install: - sh utils/ci/install.sh - source ~/.cargo/env || true # 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: @@ -63,13 +66,13 @@ matrix: - rust: nightly os: linux - env: DESCRIPTION="Miri, nightly" + name: "Miri, nightly" script: - sh utils/ci/miri.sh - rust: nightly os: linux - env: DESCRIPTION="Minimal dep versions" + name: "Minimal dep versions" script: - cargo generate-lockfile -Z minimal-versions - bash utils/ci/script.sh diff --git a/utils/ci/script.sh b/utils/ci/script.sh index 0af8ab3228f..bd011d57d58 100644 --- a/utils/ci/script.sh +++ b/utils/ci/script.sh @@ -25,33 +25,33 @@ fi main() { if [ "0$NIGHTLY" -ge 1 ]; then $CARGO test $TARGET --all-features - $CARGO test $TARGET --benches --features=nightly + $CARGO test $TARGET --benches --features=nightly else # all stable features: - $CARGO test $TARGET --features=serde1,log,small_rng + $CARGO test $TARGET --features=serde1,log,small_rng fi if [ "$ALLOC" -ge 1 ]; then - $CARGO test $TARGET --tests --no-default-features --features=alloc,getrandom,small_rng - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc + $CARGO test $TARGET --tests --no-default-features --features=alloc,getrandom,small_rng + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc fi - $CARGO test $TARGET --tests --no-default-features - $CARGO test $TARGET --examples + $CARGO test $TARGET --tests --no-default-features + $CARGO test $TARGET --examples - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features - $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=getrandom + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features + $CARGO test $TARGET --manifest-path rand_core/Cargo.toml --no-default-features --features=getrandom - $CARGO test $TARGET --manifest-path rand_distr/Cargo.toml - $CARGO test $TARGET --manifest-path rand_isaac/Cargo.toml --features=serde1 - $CARGO test $TARGET --manifest-path rand_pcg/Cargo.toml --features=serde1 - $CARGO test $TARGET --manifest-path rand_xorshift/Cargo.toml --features=serde1 - $CARGO test $TARGET --manifest-path rand_xoshiro/Cargo.toml - $CARGO test $TARGET --manifest-path rand_chacha/Cargo.toml - $CARGO test $TARGET --manifest-path rand_hc/Cargo.toml - $CARGO test $TARGET --manifest-path rand_jitter/Cargo.toml - $CARGO test $TARGET --manifest-path rand_os/Cargo.toml + $CARGO test $TARGET --manifest-path rand_distr/Cargo.toml + $CARGO test $TARGET --manifest-path rand_isaac/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_pcg/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_xorshift/Cargo.toml --features=serde1 + $CARGO test $TARGET --manifest-path rand_xoshiro/Cargo.toml + $CARGO test $TARGET --manifest-path rand_chacha/Cargo.toml + $CARGO test $TARGET --manifest-path rand_hc/Cargo.toml + $CARGO test $TARGET --manifest-path rand_jitter/Cargo.toml + $CARGO test $TARGET --manifest-path rand_os/Cargo.toml } # we don't run the "test phase" when doing deploys