Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures due to new cargo warning #239

Closed
taiki-e opened this issue Mar 3, 2024 · 1 comment
Closed

Test failures due to new cargo warning #239

taiki-e opened this issue Mar 3, 2024 · 1 comment

Comments

@taiki-e
Copy link
Owner

taiki-e commented Mar 3, 2024

cargo-hack supports cargo 1.26+, so our test crates usually don't set the edition. (edition field requires 1.31+)

However, the new cargo warning for the unset edition (rust-lang/cargo#13505, I think the warning itself is a good idea, except for a few small problems) pollutes the logs, and it confuses assertions.

I think a reasonable workaround is to check while excluding warnings. The potentially difficult part is that in some cases we want to check the content of warnings as well.

Ideally, I would like to see cargo provide a way to opt out of this warning, but I don't think that is realistic as I think cargo has never provided such a way in the past.

thread 'short_flag' panicked at tests/test.rs:1317:10:
assertion failed: `!self.stderr.contains(..)`:

EXPECTED:
------------------------------------------------------------
member2
------------------------------------------------------------

ACTUAL:
------------------------------------------------------------
info: running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo check -v --manifest-path member1/Cargo.toml` (1/1)
warning: /tmp/.tmp6qlpGb/dir/not_find_manifest/Cargo.toml: no edition set: defaulting to the 2015 edition
warning: /tmp/.tmp6qlpGb/member2/Cargo.toml: no edition set: defaulting to the 2015 edition
warning: /tmp/.tmp6qlpGb/member1/Cargo.toml: no edition set: defaulting to the 2015 edition
    Checking member1 v0.0.0 (/tmp/.tmp6qlpGb/member1)
     Running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name member1 --edition=2015 member1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="a"' --cfg 'feature="default"' -C metadata=154f9d0d15063b83 -C extra-filename=-154f9d0d15063b83 --out-dir /tmp/.tmp6qlpGb/target/debug/deps -L dependency=/tmp/.tmp6qlpGb/target/debug/deps`
     Running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name member1 --edition=2015 member1/src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="a"' --cfg 'feature="default"' -C metadata=ccedeb65f0fb4624 -C extra-filename=-ccedeb65f0fb4624 --out-dir /tmp/.tmp6qlpGb/target/debug/deps -L dependency=/tmp/.tmp6qlpGb/target/debug/deps --extern member1=/tmp/.tmp6qlpGb/target/debug/deps/libmember1-154f9d0d15063b83.rmeta`
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
@taiki-e
Copy link
Owner Author

taiki-e commented Mar 3, 2024

I think a reasonable workaround is to check while excluding warnings. The potentially difficult part is that in some cases we want to check the content of warnings as well.

This could probably be handled well if implemented to always ignore only warnings containing specific patterns ("no edition set: defaulting to the 2015 edition" in this case).

@taiki-e taiki-e closed this as completed in dcd655d Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant