mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
remove or change lib.plugin related test
This commit is contained in:
parent
1f48eab757
commit
8056001e8a
@ -2177,61 +2177,6 @@ fn shared_dep_with_a_build_script() {
|
|||||||
p.cargo("build -v").run();
|
p.cargo("build -v").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn transitive_dep_host() {
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.5.0"
|
|
||||||
edition = "2015"
|
|
||||||
authors = []
|
|
||||||
build = "build.rs"
|
|
||||||
|
|
||||||
[build-dependencies.b]
|
|
||||||
path = "b"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.file("build.rs", "fn main() {}")
|
|
||||||
.file(
|
|
||||||
"a/Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "a"
|
|
||||||
version = "0.5.0"
|
|
||||||
edition = "2015"
|
|
||||||
authors = []
|
|
||||||
links = "foo"
|
|
||||||
build = "build.rs"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("a/build.rs", "fn main() {}")
|
|
||||||
.file("a/src/lib.rs", "")
|
|
||||||
.file(
|
|
||||||
"b/Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "b"
|
|
||||||
version = "0.5.0"
|
|
||||||
edition = "2015"
|
|
||||||
authors = []
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "b"
|
|
||||||
plugin = true
|
|
||||||
|
|
||||||
[dependencies.a]
|
|
||||||
path = "../a"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("b/src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
p.cargo("build").run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn test_a_lib_with_a_build_command() {
|
fn test_a_lib_with_a_build_command() {
|
||||||
let p = project()
|
let p = project()
|
||||||
|
@ -883,47 +883,6 @@ fn build_script_only_host() {
|
|||||||
p.cargo("build -v --target").arg(&target).run();
|
p.cargo("build -v --target").arg(&target).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn plugin_build_script_right_arch() {
|
|
||||||
if cross_compile::disabled() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
edition = "2015"
|
|
||||||
authors = []
|
|
||||||
build = "build.rs"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("build.rs", "fn main() {}")
|
|
||||||
.file("src/lib.rs", "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
p.cargo("build -v --target")
|
|
||||||
.arg(cross_compile::alternate())
|
|
||||||
.with_stderr(
|
|
||||||
"\
|
|
||||||
[WARNING] support for rustc plugins has been removed from rustc. library `foo` should not specify `plugin = true`
|
|
||||||
[WARNING] support for `plugin = true` will be removed from cargo in the future
|
|
||||||
[COMPILING] foo v0.0.1 ([..])
|
|
||||||
[RUNNING] `rustc [..] build.rs [..]`
|
|
||||||
[RUNNING] `[..]/build-script-build`
|
|
||||||
[RUNNING] `rustc [..] src/lib.rs [..]`
|
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn build_script_with_platform_specific_dependencies() {
|
fn build_script_with_platform_specific_dependencies() {
|
||||||
if cross_compile::disabled() {
|
if cross_compile::disabled() {
|
||||||
|
@ -345,6 +345,28 @@ fn proc_macro_crate_type_warning() {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn lib_plugin_unused_key_warning() {
|
||||||
|
let foo = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2015"
|
||||||
|
[lib]
|
||||||
|
plugin = true
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
foo.cargo("check")
|
||||||
|
.with_stderr_contains("[WARNING] unused manifest key: lib.plugin")
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn proc_macro_crate_type_warning_plugin() {
|
fn proc_macro_crate_type_warning_plugin() {
|
||||||
let foo = project()
|
let foo = project()
|
||||||
@ -357,20 +379,12 @@ fn proc_macro_crate_type_warning_plugin() {
|
|||||||
edition = "2015"
|
edition = "2015"
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["proc-macro"]
|
crate-type = ["proc-macro"]
|
||||||
plugin = true
|
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
foo.cargo("check")
|
foo.cargo("check")
|
||||||
.with_stderr_contains(
|
|
||||||
"[WARNING] support for rustc plugins has been removed from rustc. \
|
|
||||||
library `foo` should not specify `plugin = true`")
|
|
||||||
.with_stderr_contains(
|
|
||||||
"[WARNING] support for `plugin = true` will be removed from cargo in the future")
|
|
||||||
.with_stderr_contains(
|
|
||||||
"[WARNING] proc-macro library `foo` should not specify `plugin = true`")
|
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`")
|
"[WARNING] library `foo` should only specify `proc-macro = true` instead of setting `crate-type`")
|
||||||
.run();
|
.run();
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
//! Tests for setting custom rustc flags.
|
//! Tests for setting custom rustc flags.
|
||||||
|
|
||||||
use cargo_test_support::registry::Package;
|
use cargo_test_support::registry::Package;
|
||||||
use cargo_test_support::{
|
use cargo_test_support::{basic_manifest, paths, project, project_in_home, rustc_host};
|
||||||
basic_lib_manifest, basic_manifest, paths, project, project_in_home, rustc_host,
|
|
||||||
};
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
@ -114,76 +112,6 @@ fn env_rustflags_build_script_dep() {
|
|||||||
foo.cargo("check").env("RUSTFLAGS", "--cfg foo").run();
|
foo.cargo("check").env("RUSTFLAGS", "--cfg foo").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn env_rustflags_plugin() {
|
|
||||||
// RUSTFLAGS should be passed to rustc for plugins
|
|
||||||
// when --target is not specified.
|
|
||||||
// In this test if --cfg foo is not passed the build will fail.
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
#[cfg(not(foo))]
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
p.cargo("check").env("RUSTFLAGS", "--cfg foo").run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn env_rustflags_plugin_dep() {
|
|
||||||
// RUSTFLAGS should be passed to rustc for plugins
|
|
||||||
// when --target is not specified.
|
|
||||||
// In this test if --cfg foo is not passed the build will fail.
|
|
||||||
let foo = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
|
|
||||||
[dependencies.bar]
|
|
||||||
path = "../bar"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "fn foo() {}")
|
|
||||||
.build();
|
|
||||||
let _bar = project()
|
|
||||||
.at("bar")
|
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn bar() { }
|
|
||||||
#[cfg(not(foo))]
|
|
||||||
fn bar() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
foo.cargo("check").env("RUSTFLAGS", "--cfg foo").run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn env_rustflags_normal_source_with_target() {
|
fn env_rustflags_normal_source_with_target() {
|
||||||
let p = project()
|
let p = project()
|
||||||
@ -345,84 +273,6 @@ fn env_rustflags_build_script_dep_with_target() {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn env_rustflags_plugin_with_target() {
|
|
||||||
// RUSTFLAGS should not be passed to rustc for plugins
|
|
||||||
// when --target is specified.
|
|
||||||
// In this test if --cfg foo is passed the build will fail.
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let host = rustc_host();
|
|
||||||
p.cargo("check --target")
|
|
||||||
.arg(host)
|
|
||||||
.env("RUSTFLAGS", "--cfg foo")
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn env_rustflags_plugin_dep_with_target() {
|
|
||||||
// RUSTFLAGS should not be passed to rustc for plugins
|
|
||||||
// when --target is specified.
|
|
||||||
// In this test if --cfg foo is passed the build will fail.
|
|
||||||
let foo = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
|
|
||||||
[dependencies.bar]
|
|
||||||
path = "../bar"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "fn foo() {}")
|
|
||||||
.build();
|
|
||||||
let _bar = project()
|
|
||||||
.at("bar")
|
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn bar() { }
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn bar() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let host = rustc_host();
|
|
||||||
foo.cargo("check --target")
|
|
||||||
.arg(host)
|
|
||||||
.env("RUSTFLAGS", "--cfg foo")
|
|
||||||
.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn env_rustflags_recompile() {
|
fn env_rustflags_recompile() {
|
||||||
let p = project().file("src/lib.rs", "").build();
|
let p = project().file("src/lib.rs", "").build();
|
||||||
@ -583,90 +433,6 @@ fn build_rustflags_build_script_dep() {
|
|||||||
foo.cargo("check").run();
|
foo.cargo("check").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn build_rustflags_plugin() {
|
|
||||||
// RUSTFLAGS should be passed to rustc for plugins
|
|
||||||
// when --target is not specified.
|
|
||||||
// In this test if --cfg foo is not passed the build will fail.
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
#[cfg(not(foo))]
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
".cargo/config.toml",
|
|
||||||
r#"
|
|
||||||
[build]
|
|
||||||
rustflags = ["--cfg", "foo"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
p.cargo("check").run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn build_rustflags_plugin_dep() {
|
|
||||||
// RUSTFLAGS should be passed to rustc for plugins
|
|
||||||
// when --target is not specified.
|
|
||||||
// In this test if --cfg foo is not passed the build will fail.
|
|
||||||
let foo = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
|
|
||||||
[dependencies.bar]
|
|
||||||
path = "../bar"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "fn foo() {}")
|
|
||||||
.file(
|
|
||||||
".cargo/config.toml",
|
|
||||||
r#"
|
|
||||||
[build]
|
|
||||||
rustflags = ["--cfg", "foo"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
let _bar = project()
|
|
||||||
.at("bar")
|
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn bar() { }
|
|
||||||
#[cfg(not(foo))]
|
|
||||||
fn bar() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
foo.cargo("check").run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn build_rustflags_normal_source_with_target() {
|
fn build_rustflags_normal_source_with_target() {
|
||||||
let p = project()
|
let p = project()
|
||||||
@ -800,92 +566,6 @@ fn build_rustflags_build_script_dep_with_target() {
|
|||||||
foo.cargo("check --target").arg(host).run();
|
foo.cargo("check --target").arg(host).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn build_rustflags_plugin_with_target() {
|
|
||||||
// RUSTFLAGS should not be passed to rustc for plugins
|
|
||||||
// when --target is specified.
|
|
||||||
// In this test if --cfg foo is passed the build will fail.
|
|
||||||
let p = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
".cargo/config.toml",
|
|
||||||
r#"
|
|
||||||
[build]
|
|
||||||
rustflags = ["--cfg", "foo"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let host = rustc_host();
|
|
||||||
p.cargo("check --target").arg(host).run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
|
||||||
fn build_rustflags_plugin_dep_with_target() {
|
|
||||||
// RUSTFLAGS should not be passed to rustc for plugins
|
|
||||||
// when --target is specified.
|
|
||||||
// In this test if --cfg foo is passed the build will fail.
|
|
||||||
let foo = project()
|
|
||||||
.file(
|
|
||||||
"Cargo.toml",
|
|
||||||
r#"
|
|
||||||
[package]
|
|
||||||
name = "foo"
|
|
||||||
version = "0.0.1"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "foo"
|
|
||||||
plugin = true
|
|
||||||
|
|
||||||
[dependencies.bar]
|
|
||||||
path = "../bar"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "fn foo() {}")
|
|
||||||
.file(
|
|
||||||
".cargo/config.toml",
|
|
||||||
r#"
|
|
||||||
[build]
|
|
||||||
rustflags = ["--cfg", "foo"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
let _bar = project()
|
|
||||||
.at("bar")
|
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn bar() { }
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn bar() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let host = rustc_host();
|
|
||||||
foo.cargo("check --target").arg(host).run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn build_rustflags_recompile() {
|
fn build_rustflags_recompile() {
|
||||||
let p = project().file("src/lib.rs", "").build();
|
let p = project().file("src/lib.rs", "").build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user