Skip to content

Commit 3c67ab6

Browse files
committed
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`. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 7b790ad commit 3c67ab6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/tools/tidy/src/main.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use ignore::Walk;
55
use lazy_static::lazy_static;
66
use regex::Regex;
77
use std::collections::{BTreeSet, HashMap};
8-
use std::env;
98
use std::ffi::OsStr;
109
use std::fs;
1110
use std::io::Write;
@@ -100,7 +99,8 @@ fn check_entries(tests_path: &Path, bad: &mut bool) {
10099
}
101100
}
102101

103-
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");
104104
check_entries(&path, bad);
105105

106106
// the list of files in ui tests that are allowed to start with `issue-XXXX`
@@ -185,7 +185,7 @@ pub fn check(path: &Path, bless: bool, bad: &mut bool) {
185185
*/
186186
[
187187
"#;
188-
let tidy_src = PathBuf::from(env::args_os().nth(1).unwrap()).join("src/tools/tidy/src");
188+
let tidy_src = root_path.join("src/tools/tidy/src");
189189
// instead of overwriting the file, recreate it and use an "atomic rename"
190190
// so we don't bork things on panic or a contributor using Ctrl+C
191191
let blessed_issues_path = tidy_src.join("issues_blessed.txt");

0 commit comments

Comments
 (0)