How to skip/disable unit test cases while rustc testing using the package Cargo.toml file

I see the following tidy package's unit test failures when running rust tests:

python3 src/bootstrap/bootstrap.py test --exclude src/tools/tidy --no-fail-fast --bless --target x86_64-unknown-linux-gnu

Testing tidy (stage0 -> stage1, x86_64-unknown-linux-gnu)
Compiling tidy v0.1.0 (/home/rust/src/tools/tidy)
Finished release [optimized] target(s) in 15.14s

 Running unittests src/lib.rs (build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps/tidy-268e857e44aa5cf1)

uploaded "/home/rust/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps/tidy-268e857e44aa5cf1", waiting for result
thread 'main' panicked at src/tools/remote-test-client/src/main.rs:310:9:
client.read_exact(&mut header) failed with failed to fill whole buffer
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
error: test failed, to rerun pass --lib

 Running unittests src/main.rs (build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps/rust_tidy-f166db05696a5b67)

uploaded "/home/rust/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps/rust_tidy-f166db05696a5b67", waiting for result
thread 'main' panicked at src/tools/remote-test-client/src/main.rs:310:9:
client.read_exact(&mut header) failed with failed to fill whole buffer
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

error: test failed, to rerun pass --bin rust-tidy
Build completed unsuccessfully in 0:17:28

I was trying to skip/disable those unit tests using Cargo.toml file in src/tools/tidy/Cargo.toml as mentioned below(bold lines added):

My Cargo.toml file with above mentioned changes is as follows:

[package]
name = "tidy"
version = "0.1.0"
edition = "2021"
autobins = false

[dependencies]
cargo_metadata = "0.15"
regex = "1"
miropt-test-tools = { path = "../miropt-test-tools" }
walkdir = "2"
ignore = "0.4.18"
semver = "1.0"
termcolor = "1.1.3"
rustc-hash = "1.1.0"

[[bin]]
name = "rust-tidy"
path = "src/main.rs"
test = false

[lib]
path = "src/lib.rs"
test = false

Still I see the same failures. How to disable the unit tests of a package using Cargo.toml file. Please let me know if I am missing something or doing anything wrong.

Thanks.

I don't know what bootstrap.py is doing here, but I'd expect that what's going on is that lib.test = false only disables testing by default, not when overridden on the command line. There is no way to unconditionally remove a target from testing.

Actually, I am executing rustc bootstrapping tests and these unit test fails.

I have exclude the tidy package via --exclude src/tools/tidy arg in the command but it still executes the tests. Is there any other way to disable tidy unit test cases?

For questions about building rustc, you might get more answers in the Rust internals forum.

Tidy unit tests can be skiped using --exclude tidyselftest

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.