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

x.py test --bless tidy step does not work outside of root dir #122202

Closed
pnkfelix opened this issue Mar 8, 2024 · 2 comments · Fixed by #122209
Closed

x.py test --bless tidy step does not work outside of root dir #122202

pnkfelix opened this issue Mar 8, 2024 · 2 comments · Fixed by #122209
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Mar 8, 2024

I tried this: In a subdirectory root/objdir/, after a successful build, I then did ../x.py test --stage 1 --bless

I expected to see this happen: The test files that need updating get updated.

Instead, this happened: tidy panicked

[...]
tidy check
thread 'ui_tests (tests)' panicked at src/tools/tidy/src/ui_tests.rs:191:77:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/tools/tidy/src/main.rs:55:61:
called `Result::unwrap()` on an `Err` value: Any { .. }

I believe this is because of this code, which seems to contain an assumption that the current_dir will be the root of the source tree, which is not true in general for x.py:

let tidy_src = std::env::current_dir().unwrap().join("src/tools/tidy/src");

@pnkfelix pnkfelix added the C-bug Category: This is a bug. label Mar 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 8, 2024
@jieyouxu jieyouxu added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 8, 2024
@erer1243
Copy link
Contributor

erer1243 commented Mar 9, 2024

x.py in general assumes you are in the root. It's not just tidy. E.g. building from a subdir will not use the existing build artifacts in /build

@onur-ozkan
Copy link
Member

x.py in general assumes you are in the root.

Not really. Many people work from outside the root (including me). Path for the build directory is entirely different story and can be configured.

@bors bors closed this as completed in a5adac0 Mar 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 9, 2024
Rollup merge of rust-lang#122209 - onur-ozkan:fix-tidy-path-resolution, r=compiler-errors

fix incorrect path resolution in tidy

Previously, reading the current path from the environment led to failure when invoking x from outside the source root. This change fixes this issue by passing the already resolved root path into `ui_tests::check`.

Fixes rust-lang#122202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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.

5 participants