| |
@@ -2,8 +2,7 @@
|
| |
|
| |
|
| |
def test_cargo(evaluater):
|
| |
- build_rustflags = evaluater("%build_rustflags")[0]
|
| |
- assert evaluater("%__cargo")[0] == f"/usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='{build_rustflags}' /usr/bin/cargo"
|
| |
+ assert evaluater("%__cargo")[0] == "/usr/bin/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 /usr/bin/cargo"
|
| |
|
| |
|
| |
def test_cargo_to_rpm(evaluater):
|
| |
@@ -263,24 +262,41 @@
|
| |
cargo = evaluater("%__cargo")[0]
|
| |
cargo_common_opts = evaluater("%__cargo_common_opts")[0]
|
| |
|
| |
- assert evaluater("%cargo_build")[0] == f"{cargo} build {cargo_common_opts} --profile rpm"
|
| |
+ assert [line.rstrip() for line in evaluater("%cargo_build")[0].splitlines()] == [
|
| |
+ "(",
|
| |
+ "set -euo pipefail",
|
| |
+ "export RUSTFLAGS=\"--cap-lints=warn\"",
|
| |
+ " ".join([f"{cargo} build", cargo_common_opts, "--profile rpm"]),
|
| |
+ ")",
|
| |
+ ]
|
| |
|
| |
|
| |
def test_cargo_test(evaluater):
|
| |
cargo = evaluater("%__cargo")[0]
|
| |
cargo_common_opts = evaluater("%__cargo_common_opts")[0]
|
| |
|
| |
- assert evaluater("%cargo_test")[0] == f"{cargo} test {cargo_common_opts} --profile rpm --no-fail-fast"
|
| |
+ assert [line.rstrip() for line in evaluater("%cargo_test")[0].splitlines()] == [
|
| |
+ "(",
|
| |
+ "set -euo pipefail",
|
| |
+ "export RUSTFLAGS=\"--cap-lints=warn\"",
|
| |
+ "export RUSTDOCFLAGS=\"--cap-lints=warn\"",
|
| |
+ " ".join([f"{cargo} test", cargo_common_opts, "--profile rpm", "--no-fail-fast"]),
|
| |
+ ")",
|
| |
+ ]
|
| |
|
| |
|
| |
def test_cargo_test_with_args(evaluater):
|
| |
cargo = evaluater("%__cargo")[0]
|
| |
cargo_common_opts = evaluater("%__cargo_common_opts")[0]
|
| |
|
| |
- assert (
|
| |
- evaluater("%cargo_test -- -- --exact --skip foo")[0]
|
| |
- == f"{cargo} test {cargo_common_opts} --profile rpm --no-fail-fast -- --exact --skip foo"
|
| |
- )
|
| |
+ assert [line.rstrip() for line in evaluater("%cargo_test -- -- --exact --skip foo")[0].splitlines()] == [
|
| |
+ "(",
|
| |
+ "set -euo pipefail",
|
| |
+ "export RUSTFLAGS=\"--cap-lints=warn\"",
|
| |
+ "export RUSTDOCFLAGS=\"--cap-lints=warn\"",
|
| |
+ " ".join([f"{cargo} test", cargo_common_opts, "--profile rpm", "--no-fail-fast", "--", "--exact", "--skip", "foo"]),
|
| |
+ ")",
|
| |
+ ]
|
| |
|
| |
|
| |
def test_cargo_install(evaluater):
|
| |
@@ -297,6 +313,7 @@
|
| |
assert [line.rstrip() for line in evaluater("%cargo_install")[0].splitlines()] == [
|
| |
"(",
|
| |
"set -euo pipefail",
|
| |
+ "export RUSTFLAGS=\"--cap-lints=warn\"",
|
| |
f"if {cargo_is_lib} && [ 1 -eq 1 ] ; then",
|
| |
f" CRATE_NAME=$({cargo_to_rpm} --path Cargo.toml name)",
|
| |
f" CRATE_VERSION=$({cargo_to_rpm} --path Cargo.toml version)",
|
| |
This required to no longer set RUSTFLAGS explicitly in a few places to ensure they are not getting set three times:
Since RUSTFLAGS are already defined in the default build environment, no packages that ship binaries should be impacted by this change (except maybe for rare cases of environments where RUSTFLAGS is not set and the package uses the private "%__cargo" macro directly).