mirror of
https://github.com/rust-lang/cargo
synced 2024-10-03 22:43:59 +00:00
Auto merge of #14128 - eth3lbert:snapbox-profile, r=weihanglo
test: migrate profile* to snapbox ### What does this PR try to resolve? Part of https://github.com/rust-lang/cargo/issues/14039. Migrate following to snapbox: - `tests/testsuite/profile_config.rs` - `tests/testsuite/profile_custom.rs` - `tests/testsuite/profile_overrides.rs` - `tests/testsuite/profile_targets.rs` - `tests/testsuite/profile_trim_paths.rs` - `tests/testsuite/profiles.rs`
This commit is contained in:
commit
e18afe264e
|
@ -1,10 +1,9 @@
|
|||
//! Tests for profiles defined in config files.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::paths::CargoPathExt;
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::{basic_lib_manifest, paths, project};
|
||||
use cargo_test_support::{basic_lib_manifest, paths, project, str};
|
||||
use cargo_util_schemas::manifest::TomlDebugInfo;
|
||||
|
||||
// TODO: this should be remove once -Zprofile-rustflags is stabilized
|
||||
|
@ -33,18 +32,23 @@ fn rustflags_works_with_zflag() {
|
|||
p.cargo("check -v")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[..]feature `profile-rustflags` is required[..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] config profile `dev` is not valid (defined in `[ROOT]/foo/.cargo/config.toml`)
|
||||
|
||||
Caused by:
|
||||
feature `profile-rustflags` is required
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check -v -Zprofile-rustflags")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.change_file(
|
||||
|
@ -60,12 +64,11 @@ fn rustflags_works_with_zflag() {
|
|||
|
||||
p.cargo("check -v")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -95,17 +98,14 @@ fn profile_config_validate_warnings() {
|
|||
)
|
||||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[WARNING] unused config key `profile.dev.bad-key` in `[..].cargo/config.toml`
|
||||
[WARNING] unused config key `profile.dev.package.bar.bad-key-bar` in `[..].cargo/config.toml`
|
||||
[WARNING] unused config key `profile.dev.build-override.bad-key-bo` in `[..].cargo/config.toml`
|
||||
[COMPILING] foo [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
p.cargo("build").with_stderr_data(str![[r#"
|
||||
[WARNING] unused config key `profile.dev.bad-key` in `[ROOT]/foo/.cargo/config.toml`
|
||||
[WARNING] unused config key `profile.dev.build-override.bad-key-bo` in `[ROOT]/foo/.cargo/config.toml`
|
||||
[WARNING] unused config key `profile.dev.package.bar.bad-key-bar` in `[ROOT]/foo/.cargo/config.toml`
|
||||
[COMPILING] foo v0.5.0 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered()).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -132,14 +132,13 @@ fn profile_config_error_paths() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] error in [..]/foo/.cargo/config.toml: could not load config key `profile.dev`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `profile.dev`
|
||||
|
||||
Caused by:
|
||||
error in [..]/home/.cargo/config.toml: `profile.dev.rpath` expected true/false, but found a string
|
||||
",
|
||||
)
|
||||
error in [ROOT]/home/.cargo/config.toml: `profile.dev.rpath` expected true/false, but found a string
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -159,14 +158,13 @@ fn profile_config_validate_errors() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] config profile `dev` is not valid (defined in `[..]/foo/.cargo/config.toml`)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] config profile `dev` is not valid (defined in `[ROOT]/foo/.cargo/config.toml`)
|
||||
|
||||
Caused by:
|
||||
`panic` may not be specified in a `package` profile
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -186,14 +184,13 @@ fn profile_config_syntax_errors() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] error in [..]/.cargo/config.toml: could not load config key `profile.dev`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] error in [ROOT]/foo/.cargo/config.toml: could not load config key `profile.dev`
|
||||
|
||||
Caused by:
|
||||
error in [..]/foo/.cargo/config.toml: `profile.dev.codegen-units` expected an integer, but found a string
|
||||
",
|
||||
)
|
||||
error in [ROOT]/foo/.cargo/config.toml: `profile.dev.codegen-units` expected an integer, but found a string
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -231,12 +228,12 @@ fn profile_config_override_spec_multiple() {
|
|||
// much of a problem.
|
||||
p.cargo("build -v")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[ERROR] multiple package overrides in profile `dev` match package `bar v0.5.0 ([..])`
|
||||
found package specs: bar, bar@0.5.0",
|
||||
)
|
||||
[ERROR] multiple package overrides in profile `dev` match package `bar v0.5.0 ([ROOT]/foo/bar)`
|
||||
found package specs: bar, bar@0.5.0
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -264,22 +261,12 @@ fn profile_config_all_options() {
|
|||
|
||||
p.cargo("build --release -v")
|
||||
.env_remove("CARGO_INCREMENTAL")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo [..] \
|
||||
-C opt-level=1 \
|
||||
-C panic=abort \
|
||||
-C lto[..]\
|
||||
-C codegen-units=2 \
|
||||
-C debuginfo=2 [..]\
|
||||
-C debug-assertions=on \
|
||||
-C overflow-checks=off [..]\
|
||||
-C rpath [..]\
|
||||
-C incremental=[..]
|
||||
[FINISHED] `release` profile [optimized + debuginfo] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C opt-level=1 -C panic=abort -C lto[..]-C codegen-units=2 -C debuginfo=2 [..]-C debug-assertions=on -C overflow-checks=off [..]-C rpath --out-dir [ROOT]/foo/target/release/deps -C incremental=[ROOT]/foo/target/release/incremental[..]`
|
||||
[FINISHED] `release` profile [optimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -318,18 +305,19 @@ fn profile_config_override_precedence() {
|
|||
.build();
|
||||
|
||||
p.cargo("build -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `rustc --crate-name bar [..] -C opt-level=2[..]-C codegen-units=2 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=2 [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]",
|
||||
)
|
||||
[COMPILING] bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc --crate-name bar [..] -C opt-level=2[..]-C codegen-units=2 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=2 [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn profile_config_no_warn_unknown_override() {
|
||||
let p = project()
|
||||
|
@ -371,7 +359,12 @@ fn profile_config_mixed_types() {
|
|||
.build();
|
||||
|
||||
p.cargo("build -v")
|
||||
.with_stderr_contains("[..]-C opt-level=3 [..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.5.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-C opt-level=3 [..]`
|
||||
[FINISHED] `dev` profile [optimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -486,10 +479,16 @@ fn named_env_profile() {
|
|||
p.cargo("build -v --profile=other")
|
||||
.env("CARGO_PROFILE_OTHER_CODEGEN_UNITS", "1")
|
||||
.env("CARGO_PROFILE_OTHER_INHERITS", "dev")
|
||||
.with_stderr_contains("[..]-C codegen-units=1 [..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-C codegen-units=1 [..]`
|
||||
[FINISHED] `other` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn test_with_dev_profile() {
|
||||
// The `test` profile inherits from `dev` for both local crates and
|
||||
|
@ -512,20 +511,19 @@ fn test_with_dev_profile() {
|
|||
.build();
|
||||
p.cargo("test --lib --no-run -v")
|
||||
.env("CARGO_PROFILE_DEV_DEBUG", "0")
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[DOWNLOADING] [..]
|
||||
[DOWNLOADED] [..]
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] somedep v1.0.0 (registry `dummy-registry`)
|
||||
[COMPILING] somedep v1.0.0
|
||||
[RUNNING] `rustc --crate-name somedep [..]
|
||||
[COMPILING] foo v0.1.0 [..]
|
||||
[RUNNING] `rustc --crate-name foo [..]
|
||||
[FINISHED] [..]
|
||||
[EXECUTABLE] `[..]/target/debug/deps/foo-[..][EXE]`
|
||||
",
|
||||
)
|
||||
[RUNNING] `rustc --crate-name somedep [..]`
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]`
|
||||
[FINISHED] `test` profile [unoptimized] target(s) in [ELAPSED]s
|
||||
[EXECUTABLE] `[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
|
||||
"#]])
|
||||
.with_stdout_does_not_contain("[..] -C debuginfo=0[..]")
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
//! Tests for named profiles.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::paths::CargoPathExt;
|
||||
use cargo_test_support::{basic_lib_manifest, project};
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::{basic_lib_manifest, project, str};
|
||||
|
||||
#[cargo_test]
|
||||
fn inherits_on_release() {
|
||||
|
@ -26,11 +25,10 @@ fn inherits_on_release() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] `inherits` must not be specified in root profile `release`
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -55,12 +53,10 @@ fn missing_inherits() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] profile `release-lto` is missing an `inherits` directive \
|
||||
(`inherits` is required for all profiles except `dev` or `release`)
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `release-lto` is missing an `inherits` directive (`inherits` is required for all profiles except `dev` or `release`)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -86,16 +82,15 @@ fn invalid_profile_name() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] invalid character `.` in profile name: `.release-lto`, allowed characters are letters, numbers, underscore, and hyphen
|
||||
--> Cargo.toml:8:26
|
||||
|
|
||||
8 | [profile.'.release-lto']
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -126,13 +121,13 @@ fn invalid_dir_name() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] failed to parse manifest at [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
Invalid character `.` in dir-name: `.subdir`",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -158,15 +153,13 @@ fn dir_name_disabled() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
dir-name=\"lto\" in profile `release-lto` is not currently allowed, \
|
||||
directory names are tied to the profile name for custom profiles
|
||||
",
|
||||
)
|
||||
dir-name="lto" in profile `release-lto` is not currently allowed, directory names are tied to the profile name for custom profiles
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -192,10 +185,10 @@ fn invalid_inherits() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"error: profile `release-lto` inherits from `.release`, \
|
||||
but that profile is not defined",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `release-lto` inherits from `.release`, but that profile is not defined
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -221,11 +214,10 @@ fn non_existent_inherits() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `release-lto` inherits from `non-existent`, but that profile is not defined
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -251,11 +243,10 @@ fn self_inherits() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile inheritance loop detected with profile `release-lto` inheriting `release-lto`
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -285,11 +276,10 @@ fn inherits_loop() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile inheritance loop detected with profile `release-lto2` inheriting `release-lto`
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -335,32 +325,36 @@ fn overrides_with_custom() {
|
|||
// profile overrides are inherited between profiles using inherits and have a
|
||||
// higher priority than profile options provided by custom profiles
|
||||
p.cargo("build -v")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] xxx [..]
|
||||
[COMPILING] yyy [..]
|
||||
[COMPILING] foo [..]
|
||||
[COMPILING] xxx v0.5.0 ([ROOT]/foo/xxx)
|
||||
[COMPILING] yyy v0.5.0 ([ROOT]/foo/yyy)
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name xxx [..] -C codegen-units=5 [..]`
|
||||
[RUNNING] `rustc --crate-name yyy [..] -C codegen-units=3 [..]`
|
||||
[RUNNING] `rustc --crate-name foo [..] -C codegen-units=7 [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||
",
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
|
||||
// This also verifies that the custom profile names appears in the finished line.
|
||||
p.cargo("build --profile=other -v")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[COMPILING] xxx [..]
|
||||
[COMPILING] yyy [..]
|
||||
[COMPILING] foo [..]
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[COMPILING] xxx v0.5.0 ([ROOT]/foo/xxx)
|
||||
[COMPILING] yyy v0.5.0 ([ROOT]/foo/yyy)
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name xxx [..] -C codegen-units=5 [..]`
|
||||
[RUNNING] `rustc --crate-name yyy [..] -C codegen-units=6 [..]`
|
||||
[RUNNING] `rustc --crate-name foo [..] -C codegen-units=2 [..]`
|
||||
[FINISHED] `other` profile [unoptimized + debuginfo] target(s) in [..]
|
||||
",
|
||||
[FINISHED] `other` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -383,38 +377,38 @@ fn conflicting_usage() {
|
|||
|
||||
p.cargo("build --profile=dev --release")
|
||||
.with_status(1)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the argument '--profile <PROFILE-NAME>' cannot be used with '--release'
|
||||
|
||||
Usage: cargo[EXE] build --profile <PROFILE-NAME>
|
||||
|
||||
For more information, try '--help'.",
|
||||
)
|
||||
For more information, try '--help'.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("install --profile=release --debug")
|
||||
.with_status(1)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the argument '--profile <PROFILE-NAME>' cannot be used with '--debug'
|
||||
|
||||
Usage: cargo[EXE] install --profile <PROFILE-NAME> [CRATE[@<VER>]]...
|
||||
|
||||
For more information, try '--help'.",
|
||||
)
|
||||
For more information, try '--help'.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("check --profile=dev --release")
|
||||
.with_status(1)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] the argument '--profile <PROFILE-NAME>' cannot be used with '--release'
|
||||
|
||||
Usage: cargo[EXE] check --profile <PROFILE-NAME>
|
||||
|
||||
For more information, try '--help'.",
|
||||
)
|
||||
For more information, try '--help'.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -438,54 +432,49 @@ fn clean_custom_dirname() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --release")
|
||||
.with_stdout("")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([..])
|
||||
[FINISHED] `release` profile [optimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("clean -p foo").run();
|
||||
|
||||
p.cargo("build --release")
|
||||
.with_stdout("")
|
||||
.with_stderr(
|
||||
"\
|
||||
[FINISHED] `release` profile [optimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("clean -p foo --release").run();
|
||||
|
||||
p.cargo("build --release")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([..])
|
||||
[FINISHED] `release` profile [optimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("build")
|
||||
.with_stdout("")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([..])
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stdout_data("")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("build --profile=other")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([..])
|
||||
[FINISHED] `other` profile [optimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `other` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
p.cargo("clean").arg("--release").run();
|
||||
|
@ -498,7 +487,10 @@ fn clean_custom_dirname() {
|
|||
|
||||
// This should clean 'other'
|
||||
p.cargo("clean --profile=other")
|
||||
.with_stderr("[REMOVED] [..] files, [..] total")
|
||||
.with_stderr_data(str![[r#"
|
||||
[REMOVED] [FILE_NUM] files, [FILE_SIZE]B total
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
assert!(p.build_dir().join("debug").is_dir());
|
||||
assert!(!p.build_dir().join("other").is_dir());
|
||||
|
@ -520,12 +512,18 @@ fn unknown_profile() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --profile alpha")
|
||||
.with_stderr("[ERROR] profile `alpha` is not defined")
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `alpha` is not defined
|
||||
|
||||
"#]])
|
||||
.with_status(101)
|
||||
.run();
|
||||
// Clean has a separate code path, need to check it too.
|
||||
p.cargo("clean --profile alpha")
|
||||
.with_stderr("[ERROR] profile `alpha` is not defined")
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `alpha` is not defined
|
||||
|
||||
"#]])
|
||||
.with_status(101)
|
||||
.run();
|
||||
}
|
||||
|
@ -550,15 +548,18 @@ fn reserved_profile_names() {
|
|||
|
||||
p.cargo("build --profile=doc")
|
||||
.with_status(101)
|
||||
.with_stderr("error: profile `doc` is reserved and not allowed to be explicitly specified")
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile `doc` is reserved and not allowed to be explicitly specified
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
// Not an exhaustive list, just a sample.
|
||||
for name in ["build", "cargo", "check", "rustc", "CaRgO_startswith"] {
|
||||
p.cargo(&format!("build --profile={}", name))
|
||||
.with_status(101)
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
error: profile name `{}` is reserved
|
||||
[ERROR] profile name `{}` is reserved
|
||||
Please choose a different name.
|
||||
See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configuring profiles.
|
||||
",
|
||||
|
@ -586,7 +587,7 @@ See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configur
|
|||
let highlight = "^".repeat(name.len());
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
[ERROR] profile name `{name}` is reserved
|
||||
Please choose a different name.
|
||||
|
@ -618,8 +619,7 @@ See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configur
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] profile name `debug` is reserved
|
||||
To configure the default development profile, use the name `dev` as in [profile.dev]
|
||||
See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configuring profiles.
|
||||
|
@ -628,8 +628,8 @@ See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configur
|
|||
8 | [profile.debug]
|
||||
| ^^^^^
|
||||
|
|
||||
",
|
||||
)
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,13 @@ fn legacy_commands_support_custom() {
|
|||
}
|
||||
pb.arg("--profile=super-dev")
|
||||
.arg("-v")
|
||||
.with_stderr_contains("[RUNNING] [..]codegen-units=3[..]")
|
||||
.with_stderr_data(str![
|
||||
r#"
|
||||
...
|
||||
[RUNNING] [..]codegen-units=3[..]
|
||||
...
|
||||
"#
|
||||
])
|
||||
.run();
|
||||
p.build_dir().rm_rf();
|
||||
}
|
||||
|
@ -686,12 +692,11 @@ fn legacy_rustc() {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("rustc --profile dev -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.1.0 [..]
|
||||
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=3[..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]-C codegen-units=3[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
//! Tests for profile overrides (build-override and per-package overrides).
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::{basic_lib_manifest, basic_manifest, project};
|
||||
use cargo_test_support::{basic_lib_manifest, basic_manifest, project, str};
|
||||
|
||||
#[cargo_test]
|
||||
fn profile_override_basic() {
|
||||
|
@ -33,15 +32,15 @@ fn profile_override_basic() {
|
|||
.build();
|
||||
|
||||
p.cargo("check -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[CHECKING] bar [..]
|
||||
[CHECKING] bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc --crate-name bar [..] -C opt-level=3 [..]`
|
||||
[CHECKING] foo [..]
|
||||
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C opt-level=1 [..]`
|
||||
[FINISHED] `dev` profile [optimized + debuginfo] target(s) in [..]",
|
||||
)
|
||||
[FINISHED] `dev` profile [optimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -74,20 +73,18 @@ fn profile_override_warnings() {
|
|||
.file("bar/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[WARNING] profile package spec `bar@1.2.3` in profile `dev` \
|
||||
has a version or URL that does not match any of the packages: \
|
||||
bar v0.5.0 ([..]/foo/bar)
|
||||
p.cargo("build").with_stderr_data(str![[r#"
|
||||
...
|
||||
[WARNING] profile package spec `bar@1.2.3` in profile `dev` has a version or URL that does not match any of the packages: bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[WARNING] profile package spec `bart` in profile `dev` did not match any packages
|
||||
|
||||
<tab>Did you mean `bar`?
|
||||
Did you mean `bar`?
|
||||
[WARNING] profile package spec `no-suggestion` in profile `dev` did not match any packages
|
||||
[COMPILING] [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
[COMPILING] bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -134,7 +131,13 @@ fn profile_override_bad_settings() {
|
|||
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(format!("Caused by:\n {}", expected))
|
||||
.with_stderr_data(format!(
|
||||
"\
|
||||
...
|
||||
Caused by:\n {}
|
||||
",
|
||||
expected
|
||||
))
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
@ -221,24 +224,25 @@ fn profile_override_hierarchy() {
|
|||
// m2: 2 (as [profile.dev.package.m2])
|
||||
// m1: 1 (as [profile.dev])
|
||||
|
||||
p.cargo("build -v").with_stderr_unordered("\
|
||||
p.cargo("build -v")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 4 packages to latest compatible versions
|
||||
[COMPILING] m3 [..]
|
||||
[COMPILING] dep [..]
|
||||
[RUNNING] `rustc --crate-name m3 --edition=2015 m3/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=4 [..]
|
||||
[RUNNING] `rustc --crate-name dep[..]dep/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=3 [..]
|
||||
[RUNNING] `rustc --crate-name m3 --edition=2015 m3/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=1 [..]
|
||||
[RUNNING] `rustc --crate-name build_script_build --edition=2015 m1/build.rs [..] --crate-type bin --emit=[..]link[..]-C codegen-units=4 [..]
|
||||
[COMPILING] m2 [..]
|
||||
[RUNNING] `rustc --crate-name build_script_build --edition=2015 m2/build.rs [..] --crate-type bin --emit=[..]link[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..]/m1-[..]/build-script-build`
|
||||
[RUNNING] `[..]/m2-[..]/build-script-build`
|
||||
[RUNNING] `rustc --crate-name m2 --edition=2015 m2/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=2 [..]
|
||||
[COMPILING] m1 [..]
|
||||
[RUNNING] `rustc --crate-name m1 --edition=2015 m1/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=1 [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
",
|
||||
)
|
||||
[COMPILING] m3 v0.5.0 ([ROOT]/foo/m3)
|
||||
[COMPILING] dep v0.5.0 ([ROOT]/dep)
|
||||
[RUNNING] `rustc --crate-name m3 --edition=2015 m3/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=4 [..]`
|
||||
[RUNNING] `rustc --crate-name dep [..][ROOT]/dep/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=3 [..]`
|
||||
[RUNNING] `rustc --crate-name m3 --edition=2015 m3/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=1 [..]`
|
||||
[RUNNING] `rustc --crate-name build_script_build --edition=2015 m1/build.rs [..] --crate-type bin --emit=[..]link[..]-C codegen-units=4 [..]`
|
||||
[COMPILING] m2 v0.0.1 ([ROOT]/foo/m2)
|
||||
[RUNNING] `rustc --crate-name build_script_build --edition=2015 m2/build.rs [..] --crate-type bin --emit=[..]link[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[ROOT]/foo/target/debug/build/m1-[HASH]/build-script-build`
|
||||
[RUNNING] `[ROOT]/foo/target/debug/build/m2-[HASH]/build-script-build`
|
||||
[RUNNING] `rustc --crate-name m2 --edition=2015 m2/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=2 [..]`
|
||||
[COMPILING] m1 v0.0.1 ([ROOT]/foo/m1)
|
||||
[RUNNING] `rustc --crate-name m1 --edition=2015 m1/src/lib.rs [..] --crate-type lib --emit=[..]link[..]-C codegen-units=1 [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -270,11 +274,12 @@ fn profile_override_spec_multiple() {
|
|||
|
||||
p.cargo("check -v")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[ERROR] multiple package overrides in profile `dev` match package `bar v0.5.0 ([..])`
|
||||
found package specs: bar, bar@0.5.0",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
...
|
||||
[ERROR] multiple package overrides in profile `dev` match package `bar v0.5.0 ([ROOT]/foo/bar)`
|
||||
found package specs: bar, bar@0.5.0
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -302,7 +307,12 @@ fn profile_override_spec_with_version() {
|
|||
.build();
|
||||
|
||||
p.cargo("check -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]bar/src/lib.rs [..] -C codegen-units=2 [..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
...
|
||||
[CHECKING] bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc [..]bar/src/lib.rs [..] -C codegen-units=2 [..]`
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -330,7 +340,12 @@ fn profile_override_spec_with_partial_version() {
|
|||
.build();
|
||||
|
||||
p.cargo("check -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]bar/src/lib.rs [..] -C codegen-units=2 [..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
...
|
||||
[CHECKING] bar v0.5.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc [..]bar/src/lib.rs [..] -C codegen-units=2 [..]`
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -393,11 +408,19 @@ fn profile_override_spec() {
|
|||
.build();
|
||||
|
||||
p.cargo("check -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]dep1/src/lib.rs [..] -C codegen-units=1 [..]")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]dep2/src/lib.rs [..] -C codegen-units=2 [..]")
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
...
|
||||
[RUNNING] `rustc [..][ROOT]/dep1/src/lib.rs [..] -C codegen-units=1 [..]`
|
||||
[RUNNING] `rustc [..][ROOT]/dep2/src/lib.rs [..] -C codegen-units=2 [..]`
|
||||
...
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn override_proc_macro() {
|
||||
Package::new("shared", "1.0.0").publish();
|
||||
|
@ -450,13 +473,18 @@ fn override_proc_macro() {
|
|||
|
||||
p.cargo("check -v")
|
||||
// Shared built for the proc-macro.
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]--crate-name shared [..]-C codegen-units=4[..]")
|
||||
.with_stderr_data(str![[r#"
|
||||
...
|
||||
[RUNNING] `rustc [..]--crate-name shared [..] -C codegen-units=4[..]`
|
||||
...
|
||||
[RUNNING] `rustc [..]--crate-name pm [..] -C codegen-units=4[..]`
|
||||
...
|
||||
"#]])
|
||||
// Shared built for the library.
|
||||
.with_stderr_line_without(
|
||||
&["[RUNNING] `rustc --crate-name shared --edition=2015"],
|
||||
&["-C codegen-units"],
|
||||
)
|
||||
.with_stderr_contains("[RUNNING] `rustc [..]--crate-name pm [..]-C codegen-units=4[..]")
|
||||
.with_stderr_line_without(
|
||||
&["[RUNNING] `rustc [..]--crate-name foo"],
|
||||
&["-C codegen-units"],
|
||||
|
@ -485,13 +513,12 @@ fn no_warning_ws() {
|
|||
.build();
|
||||
|
||||
p.cargo("check -p b")
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[CHECKING] b [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[CHECKING] b v0.1.0 ([ROOT]/foo/b)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
//! example, the `test` profile applying to test targets, but not other
|
||||
//! targets, etc.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::{basic_manifest, project, Project};
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::{basic_manifest, project, str, Project};
|
||||
|
||||
fn all_target_project() -> Project {
|
||||
// This abuses the `codegen-units` setting so that we can verify exactly
|
||||
|
@ -78,6 +77,7 @@ fn all_target_project() -> Project {
|
|||
.build()
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn profile_selection_build() {
|
||||
let p = all_target_project();
|
||||
|
@ -89,32 +89,34 @@ fn profile_selection_build() {
|
|||
// - We make sure that the build dependencies bar, bdep, and build.rs
|
||||
// are built with debuginfo=0.
|
||||
p.cargo("build -vv")
|
||||
.with_stderr_unordered("\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
"
|
||||
)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.with_stderr_does_not_contain("[..] -C debuginfo=0[..]")
|
||||
.run();
|
||||
p.cargo("build -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -124,33 +126,39 @@ fn profile_selection_build_release() {
|
|||
let p = all_target_project();
|
||||
|
||||
// `build --release`
|
||||
p.cargo("build --release -vv").with_stderr_unordered("\
|
||||
p.cargo("build --release -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] foo [..]
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
").run();
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
p.cargo("build --release -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn profile_selection_build_all_targets() {
|
||||
let p = all_target_project();
|
||||
|
@ -185,17 +193,17 @@ fn profile_selection_build_all_targets() {
|
|||
// bin dev build
|
||||
// example dev build
|
||||
p.cargo("build --all-targets -vv")
|
||||
.with_stderr_unordered("\
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build`
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort -C embed-bitcode=[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
|
@ -205,19 +213,21 @@ fn profile_selection_build_all_targets() {
|
|||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
"
|
||||
)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.with_stderr_does_not_contain("[..] -C debuginfo=0[..]")
|
||||
.run();
|
||||
p.cargo("build -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -255,17 +265,18 @@ fn profile_selection_build_all_targets_release() {
|
|||
// bin release test (bench/test de-duped)
|
||||
// bin release build
|
||||
// example release build
|
||||
p.cargo("build --all-targets --release -vv").with_stderr_unordered("\
|
||||
p.cargo("build --all-targets --release -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build`
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C embed-bitcode=[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C embed-bitcode=[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=6 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
|
||||
|
@ -275,16 +286,20 @@ fn profile_selection_build_all_targets_release() {
|
|||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
").run();
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
p.cargo("build --all-targets --release -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -313,45 +328,50 @@ fn profile_selection_test() {
|
|||
// bin test test
|
||||
// bin test build
|
||||
//
|
||||
p.cargo("test -vv").with_stderr_unordered("\
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/test1-[..]`
|
||||
[DOCTEST] foo
|
||||
[RUNNING] `[..] rustdoc [..]--test [..]
|
||||
").run();
|
||||
p.cargo("test -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/test1-[..]`
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C embed-bitcode=[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/test1-[HASH][EXE]`
|
||||
[DOCTEST] foo
|
||||
[RUNNING] `[..] rustdoc [..]--test [..]
|
||||
",
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
p.cargo("test -vv")
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/deps/test1-[HASH][EXE]`
|
||||
[DOCTEST] foo
|
||||
[RUNNING] `[..] rustdoc [..]--test [..]
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -381,45 +401,50 @@ fn profile_selection_test_release() {
|
|||
// bin release test
|
||||
// bin release build
|
||||
//
|
||||
p.cargo("test --release -vv").with_stderr_unordered("\
|
||||
p.cargo("test --release -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C opt-level=3[..]-C codegen-units=2[..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build`
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C opt-level=3[..]-C codegen-units=2[..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/test1-[..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/test1-[HASH][EXE]`
|
||||
[DOCTEST] foo
|
||||
[RUNNING] `[..] rustdoc [..]--test [..]`
|
||||
").run();
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
p.cargo("test --release -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/foo-[..]`
|
||||
[RUNNING] `[..]/deps/test1-[..]`
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/test1-[HASH][EXE]`
|
||||
[DOCTEST] foo
|
||||
[RUNNING] `[..] rustdoc [..]--test [..]
|
||||
",
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -448,40 +473,45 @@ fn profile_selection_bench() {
|
|||
// bin bench test(bench)
|
||||
// bin bench build
|
||||
//
|
||||
p.cargo("bench -vv").with_stderr_unordered("\
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=4 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..]target/release/build/foo-[..]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=4 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
|
||||
[FINISHED] `bench` profile [optimized] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..] --bench`
|
||||
[RUNNING] `[..]/deps/foo-[..] --bench`
|
||||
[RUNNING] `[..]/deps/bench1-[..] --bench`
|
||||
").run();
|
||||
p.cargo("bench -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `bench` profile [optimized] [..]
|
||||
[RUNNING] `[..]/deps/foo-[..] --bench`
|
||||
[RUNNING] `[..]/deps/foo-[..] --bench`
|
||||
[RUNNING] `[..]/deps/bench1-[..] --bench`
|
||||
",
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C embed-bitcode=[..]-C codegen-units=4 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort -C embed-bitcode=[..]-C codegen-units=4 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=6 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=4 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]`
|
||||
[FINISHED] `bench` profile [optimized] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE] --bench`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE] --bench`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/bench1-[HASH][EXE] --bench`
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
p.cargo("bench -vv")
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `bench` profile [optimized] target(s) in [ELAPSED]s
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE] --bench`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/foo-[HASH][EXE] --bench`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/deps/bench1-[HASH][EXE] --bench`
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -514,40 +544,45 @@ fn profile_selection_check_all_targets() {
|
|||
// bin dev check
|
||||
// bin dev-panic check-test (checking bin as a unittest)
|
||||
//
|
||||
p.cargo("check --all-targets -vv").with_stderr_unordered("\
|
||||
p.cargo("check --all-targets -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[COMPILING] bdep[..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build`
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C embed-bitcode=[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C embed-bitcode=[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort -C embed-bitcode=[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
").run();
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
// Starting with Rust 1.27, rustc emits `rmeta` files for bins, so
|
||||
// everything should be completely fresh. Previously, bins were being
|
||||
// rechecked.
|
||||
// See PR rust-lang/rust#49289 and issue rust-lang/cargo#3624.
|
||||
p.cargo("check --all-targets -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -560,17 +595,18 @@ fn profile_selection_check_all_targets_release() {
|
|||
// This is a pretty straightforward variant of
|
||||
// `profile_selection_check_all_targets` that uses `release` instead of
|
||||
// `dev` for all targets.
|
||||
p.cargo("check --all-targets --release -vv").with_stderr_unordered("\
|
||||
p.cargo("check --all-targets --release -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[COMPILING] bdep[..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link [..]-C codegen-units=6 [..]
|
||||
[COMPILING] foo [..]
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
|
||||
[RUNNING] `[..]target/release/build/foo-[..]/build-script-build`
|
||||
[RUNNING] `[..][ROOT]/foo/target/release/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3[..]-C codegen-units=2 [..]
|
||||
|
@ -580,17 +616,21 @@ fn profile_selection_check_all_targets_release() {
|
|||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]metadata -C opt-level=3[..]-C codegen-units=2 --test [..]
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--crate-type bin --emit=[..]metadata -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin --emit=[..]metadata -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
").run();
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
|
||||
p.cargo("check --all-targets --release -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `release` profile [optimized] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -620,34 +660,39 @@ fn profile_selection_check_all_targets_test() {
|
|||
// bench test-panic check-test
|
||||
// bin test-panic check-test
|
||||
//
|
||||
p.cargo("check --all-targets --profile=test -vv").with_stderr_unordered("\
|
||||
p.cargo("check --all-targets --profile=test -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[COMPILING] bdep[..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build`
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] [..]
|
||||
").run();
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name test1 --edition=2015 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name foo --edition=2015 src/main.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name bench1 --edition=2015 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[RUNNING] `[..] rustc --crate-name ex1 --edition=2015 examples/ex1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]--test [..]`
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
|
||||
p.cargo("check --all-targets --profile=test -vv")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[FRESH] bar [..]
|
||||
[FRESH] bdep [..]
|
||||
[FRESH] foo [..]
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] [..]
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[FRESH] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[FRESH] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[FRESH] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
@ -666,22 +711,25 @@ fn profile_selection_doc() {
|
|||
// foo custom dev* link For build.rs
|
||||
//
|
||||
// `*` = wants panic, but it is cleared when args are built.
|
||||
p.cargo("doc -vv").with_stderr_unordered("\
|
||||
p.cargo("doc -vv")
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 3 packages to latest compatible versions
|
||||
[COMPILING] bar [..]
|
||||
[DOCUMENTING] bar [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[DOCUMENTING] bar v0.0.1 ([ROOT]/foo/bar)
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `rustdoc [..]--crate-name bar bar/src/lib.rs [..]
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
|
||||
[COMPILING] bdep [..]
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]
|
||||
[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build`
|
||||
[RUNNING] `[..] rustc --crate-name bar --edition=2015 bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
|
||||
[COMPILING] bdep v0.0.1 ([ROOT]/foo/bdep)
|
||||
[RUNNING] `[..] rustc --crate-name bdep --edition=2015 bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `[..] rustc --crate-name build_script_build --edition=2015 build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 [..]`
|
||||
[RUNNING] `[..][ROOT]/foo/target/debug/build/foo-[HASH]/build-script-build`
|
||||
[foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
|
||||
[DOCUMENTING] foo [..]
|
||||
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] [..]
|
||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
||||
").run();
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||
|
||||
"#]].unordered())
|
||||
.run();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//! Tests for `-Ztrim-paths`.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::basic_manifest;
|
||||
use cargo_test_support::compare::assert_e2e;
|
||||
use cargo_test_support::git;
|
||||
|
@ -31,13 +29,13 @@ fn gated_manifest() {
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
feature `trim-paths` is required",
|
||||
)
|
||||
feature `trim-paths` is required
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -57,13 +55,13 @@ fn gated_config_toml() {
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[ERROR] config profile `dev` is not valid (defined in `[CWD]/.cargo/config.toml`)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] config profile `dev` is not valid (defined in `[ROOT]/foo/.cargo/config.toml`)
|
||||
|
||||
Caused by:
|
||||
feature `trim-paths` is required",
|
||||
)
|
||||
feature `trim-paths` is required
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -84,18 +82,16 @@ fn release_profile_default_to_object() {
|
|||
|
||||
p.cargo("build --release --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `release` profile [..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")]
|
||||
fn one_option() {
|
||||
let build = |option| {
|
||||
|
@ -123,14 +119,15 @@ fn one_option() {
|
|||
for option in ["macro", "diagnostics", "object", "all"] {
|
||||
build(option)
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope={option} \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[ROOT]/foo=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]",
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
",
|
||||
))
|
||||
.run();
|
||||
}
|
||||
|
@ -161,15 +158,12 @@ fn multiple_options() {
|
|||
|
||||
p.cargo("build --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=diagnostics,macro,object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=diagnostics,macro,object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -197,15 +191,12 @@ fn profile_merge_works() {
|
|||
|
||||
p.cargo("build -v -Ztrim-paths --profile custom")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=diagnostics \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `custom` profile [..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `custom` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -234,31 +225,25 @@ fn registry_dependency() {
|
|||
.file("src/main.rs", "fn main() { bar::f(); }")
|
||||
.build();
|
||||
|
||||
let registry_src = paths::home().join(".cargo/registry/src");
|
||||
let registry_src = registry_src.display();
|
||||
|
||||
p.cargo("run --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stdout("-[..]/bar-0.0.1/src/lib.rs") // Omit the hash of Source URL
|
||||
.with_stderr(&format!(
|
||||
"\
|
||||
[UPDATING] [..]
|
||||
.with_stdout_data(str![[r#"
|
||||
[..]/bar-0.0.1/src/lib.rs
|
||||
|
||||
"#]]) // Omit the hash of Source URL
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] `dummy-registry` index
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] bar v0.0.1 ([..])
|
||||
[DOWNLOADED] bar v0.0.1 (registry `dummy-registry`)
|
||||
[COMPILING] bar v0.0.1
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix={registry_src}= \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]
|
||||
[RUNNING] `target/debug/foo[EXE]`"
|
||||
))
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -292,29 +277,23 @@ fn git_dependency() {
|
|||
.file("src/main.rs", "fn main() { bar::f(); }")
|
||||
.build();
|
||||
|
||||
let git_checkouts_src = paths::home().join(".cargo/git/checkouts");
|
||||
let git_checkouts_src = git_checkouts_src.display();
|
||||
|
||||
p.cargo("run --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stdout("bar-[..]/[..]/src/lib.rs") // Omit the hash of Source URL and commit
|
||||
.with_stderr(&format!(
|
||||
"\
|
||||
[UPDATING] git repository `{url}`
|
||||
.with_stdout_data(str![[r#"
|
||||
[..]/[..]/src/lib.rs
|
||||
|
||||
"#]]) // Omit the hash of Source URL and commit
|
||||
.with_stderr_data(str![[r#"
|
||||
[UPDATING] git repository `[ROOTURL]/bar`
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] bar v0.0.1 ({url}[..])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix={git_checkouts_src}= \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]
|
||||
[RUNNING] `target/debug/foo[EXE]`"
|
||||
))
|
||||
[COMPILING] bar v0.0.1 ([ROOTURL]/bar#[..])
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/home/.cargo/git/checkouts= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -346,35 +325,30 @@ fn path_dependency() {
|
|||
|
||||
p.cargo("run --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stdout("cocktail-bar/src/lib.rs")
|
||||
.with_stderr(&format!(
|
||||
"\
|
||||
.with_stdout_data(str![[r#"
|
||||
cocktail-bar/src/lib.rs
|
||||
|
||||
"#]])
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] bar v0.0.1 ([..]/cocktail-bar)
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]
|
||||
[RUNNING] `target/debug/foo[EXE]`"
|
||||
))
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/foo/cocktail-bar)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")]
|
||||
fn path_dependency_outside_workspace() {
|
||||
let bar = project()
|
||||
let _bar = project()
|
||||
.at("bar")
|
||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||
.file("src/lib.rs", r#"pub fn f() { println!("{}", file!()); }"#)
|
||||
.build();
|
||||
let bar_path = bar.url().to_file_path().unwrap();
|
||||
let bar_path = bar_path.display();
|
||||
|
||||
let p = project()
|
||||
.file(
|
||||
|
@ -397,26 +371,24 @@ fn path_dependency_outside_workspace() {
|
|||
|
||||
p.cargo("run --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stdout("bar-0.0.1/src/lib.rs")
|
||||
.with_stderr(&format!(
|
||||
"\
|
||||
.with_stdout_data(str![[r#"
|
||||
bar-0.0.1/src/lib.rs
|
||||
|
||||
"#]])
|
||||
.with_stderr_data(str![[r#"
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] bar v0.0.1 ([..]/bar)
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix={bar_path}=bar-0.0.1 \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]
|
||||
[RUNNING] `target/debug/foo[EXE]`"
|
||||
))
|
||||
[COMPILING] bar v0.0.1 ([ROOT]/bar)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/bar=bar-0.0.1 --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[RUNNING] `target/debug/foo[EXE]`
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")]
|
||||
fn diagnostics_works() {
|
||||
Package::new("bar", "0.0.1")
|
||||
|
@ -451,21 +423,14 @@ fn diagnostics_works() {
|
|||
&["[..]bar-0.0.1/src/lib.rs:1[..]"],
|
||||
&[&format!("{registry_src}")],
|
||||
)
|
||||
.with_stderr_contains("[..]unused_variables[..]")
|
||||
.with_stderr_contains(&format!(
|
||||
"\
|
||||
[RUNNING] [..]rustc [..]\
|
||||
-Zremap-path-scope=diagnostics \
|
||||
--remap-path-prefix={registry_src}= \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]",
|
||||
))
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[RUNNING] [..]rustc [..]\
|
||||
-Zremap-path-scope=diagnostics \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
...
|
||||
[RUNNING] `[..] rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/home/.cargo/registry/src= --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[WARNING] unused variable: `unused`
|
||||
...
|
||||
[RUNNING] `[..] rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -534,7 +499,6 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) ->
|
|||
|
||||
let registry_src = paths::home().join(".cargo/registry/src");
|
||||
let registry_src_bytes = registry_src.as_os_str().as_bytes();
|
||||
let registry_src = registry_src.display();
|
||||
let rust_src = "/lib/rustc/src/rust".as_bytes();
|
||||
|
||||
Package::new("bar", "0.0.1")
|
||||
|
@ -583,19 +547,20 @@ fn object_works_helper(split_debuginfo: &str, run: impl Fn(&std::path::Path) ->
|
|||
.arg("--config")
|
||||
.arg(r#"profile.dev.trim-paths="object""#)
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
[COMPILING] bar v0.0.1
|
||||
[RUNNING] `rustc [..]-C split-debuginfo={split_debuginfo} [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix={registry_src}= \
|
||||
--remap-path-prefix=[ROOT]/home/.cargo/registry/src= \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-C split-debuginfo={split_debuginfo} [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[ROOT]/foo=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]
|
||||
[FINISHED] `dev` profile [..]",
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
",
|
||||
))
|
||||
.run();
|
||||
|
||||
|
@ -761,13 +726,12 @@ fn lldb_works_after_trimmed() {
|
|||
|
||||
p.cargo("build --verbose -Ztrim-paths")
|
||||
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[RUNNING] `rustc [..]\
|
||||
-Zremap-path-scope=object \
|
||||
--remap-path-prefix=[CWD]=. \
|
||||
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[ROOT]/foo=. --remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
let bin_path = p.bin("foo");
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
//! Tests for profiles.
|
||||
|
||||
#![allow(deprecated)]
|
||||
|
||||
use cargo_test_support::prelude::*;
|
||||
use cargo_test_support::registry::Package;
|
||||
use cargo_test_support::{project, rustc_host};
|
||||
use cargo_test_support::{project, rustc_host, str};
|
||||
use std::env;
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -27,22 +26,12 @@ fn profile_overrides() {
|
|||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] test v0.0.0 ([CWD])
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
|
||||
--emit=[..]link[..]\
|
||||
-C opt-level=1[..]\
|
||||
-C debug-assertions=on[..] \
|
||||
-C metadata=[..] \
|
||||
-C rpath \
|
||||
--out-dir [..] \
|
||||
-L dependency=[CWD]/target/debug/deps`
|
||||
[FINISHED] `dev` profile [optimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
p.cargo("build -v").with_stderr_data(str![[r#"
|
||||
[COMPILING] test v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..] -C opt-level=1[..] -C debug-assertions=on[..] -C metadata=[..] -C rpath --out-dir [ROOT]/foo/target/debug/deps [..] -L dependency=[ROOT]/foo/target/debug/deps`
|
||||
[FINISHED] `dev` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -64,20 +53,12 @@ fn opt_level_override_0() {
|
|||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] test v0.0.0 ([CWD])
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
|
||||
--emit=[..]link[..]\
|
||||
-C debuginfo=2 [..]\
|
||||
-C metadata=[..] \
|
||||
--out-dir [..] \
|
||||
-L dependency=[CWD]/target/debug/deps`
|
||||
[FINISHED] [..] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
p.cargo("build -v").with_stderr_data(str![[r#"
|
||||
[COMPILING] test v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C debuginfo=2 [..] -C metadata=[..] --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]).run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
@ -98,20 +79,12 @@ fn debug_override_1() {
|
|||
)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] test v0.0.0 ([CWD])
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
|
||||
--emit=[..]link[..]\
|
||||
-C debuginfo=1 [..]\
|
||||
-C metadata=[..] \
|
||||
--out-dir [..] \
|
||||
-L dependency=[CWD]/target/debug/deps`
|
||||
[FINISHED] [..] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
p.cargo("build -v").with_stderr_data(str![[r#"
|
||||
[COMPILING] test v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C debuginfo=1 [..]-C metadata=[..] --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]]).run();
|
||||
}
|
||||
|
||||
fn check_opt_level_override(profile_level: &str, rustc_level: &str) {
|
||||
|
@ -136,9 +109,9 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) {
|
|||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("build -v")
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
[COMPILING] test v0.0.0 ([CWD])
|
||||
[COMPILING] test v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
|
||||
--emit=[..]link \
|
||||
-C opt-level={level}[..]\
|
||||
|
@ -146,8 +119,8 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) {
|
|||
-C debug-assertions=on[..] \
|
||||
-C metadata=[..] \
|
||||
--out-dir [..] \
|
||||
-L dependency=[CWD]/target/debug/deps`
|
||||
[FINISHED] [..] target(s) in [..]
|
||||
-L dependency=[ROOT]/foo/target/debug/deps`
|
||||
[FINISHED] `dev` profile [..]+ debuginfo] target(s) in [ELAPSED]s
|
||||
",
|
||||
level = rustc_level
|
||||
))
|
||||
|
@ -211,10 +184,10 @@ fn top_level_overrides_deps() {
|
|||
.file("foo/src/lib.rs", "")
|
||||
.build();
|
||||
p.cargo("build -v --release")
|
||||
.with_stderr(&format!(
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] foo v0.0.0 ([CWD]/foo)
|
||||
[COMPILING] foo v0.0.0 ([ROOT]/foo/foo)
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 foo/src/lib.rs [..]\
|
||||
--crate-type dylib --crate-type rlib \
|
||||
--emit=[..]link \
|
||||
|
@ -222,20 +195,20 @@ fn top_level_overrides_deps() {
|
|||
-C opt-level=1[..]\
|
||||
-C debuginfo=2 [..]\
|
||||
-C metadata=[..] \
|
||||
--out-dir [CWD]/target/release/deps \
|
||||
-L dependency=[CWD]/target/release/deps`
|
||||
[COMPILING] test v0.0.0 ([CWD])
|
||||
--out-dir [ROOT]/foo/target/release/deps \
|
||||
-L dependency=[ROOT]/foo/target/release/deps`
|
||||
[COMPILING] test v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name test --edition=2015 src/lib.rs [..]--crate-type lib \
|
||||
--emit=[..]link \
|
||||
-C opt-level=1[..]\
|
||||
-C debuginfo=2 [..]\
|
||||
-C metadata=[..] \
|
||||
--out-dir [..] \
|
||||
-L dependency=[CWD]/target/release/deps \
|
||||
--extern foo=[CWD]/target/release/deps/\
|
||||
-L dependency=[ROOT]/foo/target/release/deps \
|
||||
--extern foo=[ROOT]/foo/target/release/deps/\
|
||||
{prefix}foo[..]{suffix} \
|
||||
--extern foo=[CWD]/target/release/deps/libfoo.rlib`
|
||||
[FINISHED] `release` profile [optimized + debuginfo] target(s) in [..]
|
||||
--extern foo=[ROOT]/foo/target/release/deps/libfoo.rlib`
|
||||
[FINISHED] `release` profile [optimized + debuginfo] target(s) in [ELAPSED]s
|
||||
",
|
||||
prefix = env::consts::DLL_PREFIX,
|
||||
suffix = env::consts::DLL_SUFFIX
|
||||
|
@ -282,16 +255,16 @@ fn profile_in_non_root_manifest_triggers_a_warning() {
|
|||
|
||||
p.cargo("build -v")
|
||||
.cwd("bar")
|
||||
.with_stderr(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] profiles for the non root package will be ignored, specify profiles at the workspace root:
|
||||
package: [..]
|
||||
workspace: [..]
|
||||
package: [ROOT]/foo/bar/Cargo.toml
|
||||
workspace: [ROOT]/foo/Cargo.toml
|
||||
[LOCKING] 2 packages to latest compatible versions
|
||||
[COMPILING] bar v0.1.0 ([..])
|
||||
[COMPILING] bar v0.1.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc [..]`
|
||||
[FINISHED] `dev` profile [unoptimized] target(s) in [..]",
|
||||
)
|
||||
[FINISHED] `dev` profile [unoptimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -326,12 +299,12 @@ fn profile_in_virtual_manifest_works() {
|
|||
|
||||
p.cargo("build -v")
|
||||
.cwd("bar")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] bar v0.1.0 ([..])
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] bar v0.1.0 ([ROOT]/foo/bar)
|
||||
[RUNNING] `rustc [..]`
|
||||
[FINISHED] `dev` profile [optimized] target(s) in [..]",
|
||||
)
|
||||
[FINISHED] `dev` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -355,15 +328,13 @@ fn profile_lto_string_bool_dev() {
|
|||
|
||||
p.cargo("build")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
`lto` setting of string `\"true\"` for `dev` profile is not a valid setting, \
|
||||
must be a boolean (`true`/`false`) or a string (`\"thin\"`/`\"fat\"`/`\"off\"`) or omitted.
|
||||
",
|
||||
)
|
||||
`lto` setting of string `"true"` for `dev` profile is not a valid setting, must be a boolean (`true`/`false`) or a string (`"thin"`/`"fat"`/`"off"`) or omitted.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -389,12 +360,13 @@ fn profile_panic_test_bench() {
|
|||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] `panic` setting is ignored for `bench` profile
|
||||
[WARNING] `panic` setting is ignored for `test` profile
|
||||
",
|
||||
)
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -417,7 +389,10 @@ fn profile_doc_deprecated() {
|
|||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.with_stderr_contains("[WARNING] profile `doc` is deprecated and has no effect")
|
||||
.with_stderr_data(str![[r#"
|
||||
[WARNING] profile `doc` is deprecated and has no effect
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -445,23 +420,26 @@ fn panic_unwind_does_not_build_twice() {
|
|||
.build();
|
||||
|
||||
p.cargo("test -v --tests --no-run")
|
||||
.with_stderr_unordered(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib [..]
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..] --test [..]
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin [..]
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..] --test [..]
|
||||
[RUNNING] `rustc --crate-name t1 --edition=2015 tests/t1.rs [..]
|
||||
[FINISHED] [..]
|
||||
[EXECUTABLE] `[..]/target/debug/deps/t1-[..][EXE]`
|
||||
[EXECUTABLE] `[..]/target/debug/deps/foo-[..][EXE]`
|
||||
[EXECUTABLE] `[..]/target/debug/deps/foo-[..][EXE]`
|
||||
",
|
||||
.with_stderr_data(
|
||||
str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]--crate-type lib [..]`
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..] --test [..]`
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..]--crate-type bin [..]`
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/main.rs [..] --test [..]`
|
||||
[RUNNING] `rustc --crate-name t1 --edition=2015 tests/t1.rs [..]`
|
||||
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
[EXECUTABLE] `[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[EXECUTABLE] `[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]`
|
||||
[EXECUTABLE] `[ROOT]/foo/target/debug/deps/t1-[HASH][EXE]`
|
||||
|
||||
"#]]
|
||||
.unordered(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn debug_0_report() {
|
||||
// The finished line handles 0 correctly.
|
||||
|
@ -482,13 +460,12 @@ fn debug_0_report() {
|
|||
.build();
|
||||
|
||||
p.cargo("build -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.1.0 [..]
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]
|
||||
[FINISHED] `dev` profile [unoptimized] target(s) in [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs [..]`
|
||||
[FINISHED] `dev` profile [unoptimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.with_stderr_does_not_contain("-C debuginfo")
|
||||
.run();
|
||||
}
|
||||
|
@ -513,13 +490,12 @@ fn thin_lto_works() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --release -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] top [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] top v0.5.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C lto=thin [..]`
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -542,13 +518,12 @@ fn strip_works() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --release -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C strip=symbols [..]`
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -572,13 +547,12 @@ fn strip_passes_unknown_option_to_rustc() {
|
|||
|
||||
p.cargo("build --release -v")
|
||||
.with_status(101)
|
||||
.with_stderr_contains(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C strip=unknown [..]`
|
||||
error: incorrect value `unknown` for [..] `strip` [..] was expected
|
||||
",
|
||||
)
|
||||
[ERROR] incorrect value `unknown` for [..] `strip` [..] was expected
|
||||
...
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -601,16 +575,16 @@ fn strip_accepts_true_to_strip_symbols() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --release -v")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C strip=symbols [..]`
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn strip_accepts_false_to_disable_strip() {
|
||||
let p = project()
|
||||
|
@ -650,11 +624,21 @@ fn strip_debuginfo_in_release() {
|
|||
.build();
|
||||
|
||||
p.cargo("build --release -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C strip=debuginfo[..]`
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
p.cargo("build --release -v --target")
|
||||
.arg(rustc_host())
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc [..] -C strip=debuginfo[..]`
|
||||
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -677,10 +661,16 @@ fn strip_debuginfo_without_debug() {
|
|||
.build();
|
||||
|
||||
p.cargo("build -v")
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] -C strip=debuginfo[..]`")
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.1.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C strip=debuginfo[..]`
|
||||
[FINISHED] `dev` profile [unoptimized] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn do_not_strip_debuginfo_with_requested_debug() {
|
||||
let p = project()
|
||||
|
@ -739,13 +729,12 @@ fn rustflags_works() {
|
|||
|
||||
p.cargo("build -v")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -769,13 +758,12 @@ fn rustflags_works_with_env() {
|
|||
p.cargo("build -v")
|
||||
.env("CARGO_PROFILE_DEV_RUSTFLAGS", "-C link-dead-code=yes")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo [..]
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.with_stderr_data(str![[r#"
|
||||
[COMPILING] foo v0.0.1 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..] -C link-dead-code=yes [..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -800,21 +788,17 @@ fn rustflags_requires_cargo_feature() {
|
|||
p.cargo("build -v")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
feature `profile-rustflags` is required
|
||||
|
||||
The package requires the Cargo feature called `profile-rustflags`, but that feature is \
|
||||
not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = [\"profile-rustflags\"]` to the top of Cargo.toml \
|
||||
(above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option \
|
||||
for more information about the status of this feature.
|
||||
",
|
||||
)
|
||||
The package requires the Cargo feature called `profile-rustflags`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = ["profile-rustflags"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
|
||||
Package::new("bar", "1.0.0").publish();
|
||||
|
@ -836,24 +820,21 @@ Caused by:
|
|||
p.cargo("check")
|
||||
.masquerade_as_nightly_cargo(&["profile-rustflags"])
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
error: failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||
|
||||
Caused by:
|
||||
feature `profile-rustflags` is required
|
||||
|
||||
The package requires the Cargo feature called `profile-rustflags`, but that feature is \
|
||||
not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = [\"profile-rustflags\"]` to the top of Cargo.toml \
|
||||
(above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option \
|
||||
for more information about the status of this feature.
|
||||
",
|
||||
)
|
||||
The package requires the Cargo feature called `profile-rustflags`, but that feature is not stabilized in this version of Cargo (1.[..]).
|
||||
Consider adding `cargo-features = ["profile-rustflags"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
|
||||
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option for more information about the status of this feature.
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
#[cargo_test]
|
||||
fn debug_options_valid() {
|
||||
let build = |option| {
|
||||
|
@ -886,7 +867,13 @@ fn debug_options_valid() {
|
|||
("full", "2"),
|
||||
] {
|
||||
build(option)
|
||||
.with_stderr_contains(&format!("[RUNNING] `rustc [..]-C debuginfo={cli} [..]"))
|
||||
.with_stderr_data(&format!(
|
||||
"\
|
||||
...
|
||||
[RUNNING] `rustc [..]-C debuginfo={cli} [..]`
|
||||
...
|
||||
"
|
||||
))
|
||||
.run();
|
||||
}
|
||||
build("none")
|
||||
|
|
Loading…
Reference in a new issue