From e882a6bed7fbe9a18f94553cceaa38288fa9ed16 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 28 Jul 2019 09:45:04 +0100 Subject: [PATCH 1/2] CI: Update run.sh and appveyor config for tests In order that we might succeed in getting through our tests, until we can properly diagnose and correct for whatever causes the dist tests alone to fail in such spectacular ways, limit the dist tests to a single thread to reduce the chance that they fail on Windows CI. Signed-off-by: Daniel Silverstone --- appveyor.yml | 18 +++++++++++++++++- ci/run.sh | 20 ++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a4464fc6b1..77ec9c1a6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -71,7 +71,23 @@ build: false test_script: - cargo build --release --target %TARGET% --locked - cargo run --release --target %TARGET% --locked -- --dump-testament - - cargo test --release --target %TARGET% + # The rest of this relies on the set of things to test not changing + # because I have no idea how to script it. TODO: Get someone to script it? + - cargo test --release --target %TARGET% -p download + - cargo test --release --target %TARGET% --bin rustup-init + - cargo test --release --target %TARGET% --lib --all + - cargo test --release --target %TARGET% --doc --all + - cargo test --release --target %TARGET% --test cli-exact + - cargo test --release --target %TARGET% --test cli-inst-interactive + - cargo test --release --target %TARGET% --test cli-misc + - cargo test --release --target %TARGET% --test cli-rustup + - cargo test --release --target %TARGET% --test cli-self-upd + - cargo test --release --target %TARGET% --test cli-v1 + - cargo test --release --target %TARGET% --test cli-v2 + - cargo test --release --target %TARGET% --test dist_install + - cargo test --release --target %TARGET% --test dist_manifest + - cargo test --release --target %TARGET% --test dist -- --test-threads 1 + - cargo test --release --target %TARGET% --test dist_transactions notifications: - provider: Webhook diff --git a/ci/run.sh b/ci/run.sh index 589984e2e6..649c2ea961 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -18,11 +18,23 @@ fi # shellcheck disable=SC2086 cargo build --locked -v --release --target "$TARGET" $FEATURES +runtest () { + # shellcheck disable=SC2086 + cargo test --release --target "$TARGET" $FEATURES "$@" +} + if [ -z "$SKIP_TESTS" ]; then # shellcheck disable=SC2086 cargo run --locked --release --target "$TARGET" $FEATURES -- --dump-testament - # shellcheck disable=SC2086 - cargo test --release -p download --target "$TARGET" $FEATURES - # shellcheck disable=SC2086 - cargo test --release --target "$TARGET" $FEATURES + runtest -p download + runtest --bin rustup-init + runtest --lib --all + runtest --doc --all + for TEST in $(cd tests; ls *.rs | cut -d. -f1); do + if [ "x$TEST" = "xdist" ]; then + runtest --test "$TEST" -- --test-threads 1 + else + runtest --test "$TEST" + fi + done fi From 89ab7bbcd4e371bcdc1414c86cdbca79607eaec3 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 28 Jul 2019 10:13:22 +0100 Subject: [PATCH 2/2] utils: Fix cargo home test In order to isolate this test from the test environment, if it is attempting to determine behaviour when the CARGO_HOME environment variable isn't present, it should ensure it's not present. In additon, we need to test against \.cargo for Windows and we need to allow for the `C:` in the second half of the test. Signed-off-by: Daniel Silverstone --- src/utils/utils.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 36e1f6cead..f3e0f75668 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -767,13 +767,14 @@ mod tests { #[test] fn test_cargo_home() { // CARGO_HOME unset, we'll get the default ending in /.cargo + env::remove_var("CARGO_HOME"); let cargo_home1 = cargo_home(); let ch = format!("{}", cargo_home1.unwrap().display()); - assert!(ch.contains("/.cargo")); + assert!(ch.contains("/.cargo") || ch.contains("\\.cargo")); env::set_var("CARGO_HOME", "/test"); let cargo_home2 = cargo_home(); - assert_eq!("/test", format!("{}", cargo_home2.unwrap().display())); + assert!(format!("{}", cargo_home2.unwrap().display()).contains("/test")); } #[test]