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

Allow passing the --nocapture flag to compiletest #109407

Closed
peter-lyons-kehl opened this issue Mar 20, 2023 · 3 comments · Fixed by #109445
Closed

Allow passing the --nocapture flag to compiletest #109407

peter-lyons-kehl opened this issue Mar 20, 2023 · 3 comments · Fixed by #109445
Assignees
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@peter-lyons-kehl
Copy link
Contributor

peter-lyons-kehl commented Mar 20, 2023

  • x test tests/mir-opt --test-args=nocapture passes
  • x test tests/mir-opt --test-args=--nocapture fails

On recent master (commit 13b7aa4), with config.toml to avoid building LLVM:

[llvm]
download-ci-llvm = false

[rust]
# With this set to true, serde (as a part of rustc) failed to compile.
debug = true
channel = "nightly"

[target.x86_64-unknown-linux-gnu]
llvm-config = "/usr/bin/llvm-config"
> x test tests/mir-opt --test-args=--nocapture
...
thread 'main' panicked at 'UnrecognizedOption("nocapture")', src/tools/compiletest/src/main.rs:168:19
...

❯ x test tests/mir-opt --test-args=nocapture
...
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 235 filtered out; finished in 0.00s

Extra spin/Side note:
Contrary to the above, with --dry-run, both --test-args=nocapture and --test-args=--nocapture pass well:
x test tests/mir-opt --test-args=nocapture --dry-run and x test tests/mir-opt --test-args=--nocapture --dry-run.

All the same when invoking with ./x.py instead of x.

Also discussed at https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20debugging.20library.2Fcore.20in.20VS.20Code.3F/near/341923600.

@peter-lyons-kehl peter-lyons-kehl added the C-bug Category: This is a bug. label Mar 20, 2023
@jyn514 jyn514 added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 20, 2023
@jyn514
Copy link
Member

jyn514 commented Mar 20, 2023

I think --test-args=nocapture is not actually passing --nocapture through to libtest, it's just acting as a filter on the tests (like --test-args=issue-56414 would). looks like today the only way to configure this is through an env variable:

nocapture: match env::var("RUST_TEST_NOCAPTURE") {
Ok(val) => &val != "0",
Err(_) => false,

changing that to accept --nocapture seems useful 👍

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Mar 20, 2023
@Teapot4195
Copy link
Contributor

@rustbot claim

@peter-lyons-kehl peter-lyons-kehl changed the title x.py tests/mir-opt --test-args=--nocapture fails, but --test-args=nocapture succeeds Allow passing the --nocapture flag to compiletest Mar 21, 2023
@peter-lyons-kehl
Copy link
Contributor Author

Wow. Thank you.

@bors bors closed this as completed in df453d9 Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants