Skip to content

Commit a5adac0

Browse files
authored
Rollup merge of #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 #122202
2 parents 9ac5cc8 + 7c13421 commit a5adac0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/tools/tidy/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn main() {
102102
check!(tests_placement, &root_path);
103103
check!(tests_revision_unpaired_stdout_stderr, &tests_path);
104104
check!(debug_artifacts, &tests_path);
105-
check!(ui_tests, &tests_path, bless);
105+
check!(ui_tests, &root_path, bless);
106106
check!(mir_opt_tests, &tests_path, bless);
107107
check!(rustdoc_gui_tests, &tests_path);
108108
check!(rustdoc_css_themes, &librustdoc_path);

src/tools/tidy/src/ui_tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ fn check_entries(tests_path: &Path, bad: &mut bool) {
9999
}
100100
}
101101

102-
pub fn check(path: &Path, bless: bool, bad: &mut bool) {
102+
pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
103+
let path = &root_path.join("tests");
103104
check_entries(&path, bad);
104105

105106
// the list of files in ui tests that are allowed to start with `issue-XXXX`
@@ -193,7 +194,7 @@ pub fn check(path: &Path, bless: bool, bad: &mut bool) {
193194
*/
194195
[
195196
"#;
196-
let tidy_src = std::env::current_dir().unwrap().join("src/tools/tidy/src");
197+
let tidy_src = root_path.join("src/tools/tidy/src");
197198
// instead of overwriting the file, recreate it and use an "atomic rename"
198199
// so we don't bork things on panic or a contributor using Ctrl+C
199200
let blessed_issues_path = tidy_src.join("issues_blessed.txt");

0 commit comments

Comments
 (0)