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 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]