Skip to content

Commit 1c12747

Browse files
committed
Migrate the bins check to diagnostics
1 parent e079ac7 commit 1c12747

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/tools/tidy/src/bins.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ pub use os_impl::*;
1212
mod os_impl {
1313
use std::path::Path;
1414

15+
use crate::diagnostics::DiagCtx;
16+
1517
pub fn check_filesystem_support(_sources: &[&Path], _output: &Path) -> bool {
1618
return false;
1719
}
1820

19-
pub fn check(_path: &Path, _bad: &mut bool) {}
21+
pub fn check(_path: &Path, _diag_ctx: DiagCtx) {}
2022
}
2123

2224
#[cfg(unix)]
@@ -36,6 +38,8 @@ mod os_impl {
3638

3739
use FilesystemSupport::*;
3840

41+
use crate::diagnostics::DiagCtx;
42+
3943
fn is_executable(path: &Path) -> std::io::Result<bool> {
4044
Ok(path.metadata()?.mode() & 0o111 != 0)
4145
}
@@ -106,14 +110,16 @@ mod os_impl {
106110
}
107111

108112
#[cfg(unix)]
109-
pub fn check(path: &Path, bad: &mut bool) {
113+
pub fn check(path: &Path, diag_ctx: DiagCtx) {
114+
let mut check = diag_ctx.start_check("bins");
115+
110116
use std::ffi::OsStr;
111117

112118
const ALLOWED: &[&str] = &["configure", "x"];
113119

114120
for p in RI_EXCLUSION_LIST {
115121
if !path.join(Path::new(p)).exists() {
116-
tidy_error!(bad, "rust-installer test bins missed: {p}");
122+
check.error(format!("rust-installer test bins missed: {p}"));
117123
}
118124
}
119125

@@ -153,7 +159,7 @@ mod os_impl {
153159
});
154160
let path_bytes = rel_path.as_os_str().as_bytes();
155161
if output.status.success() && output.stdout.starts_with(path_bytes) {
156-
tidy_error!(bad, "binary checked into source: {}", file.display());
162+
check.error(format!("binary checked into source: {}", file.display()));
157163
}
158164
}
159165
},

src/tools/tidy/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ fn main() {
133133
check!(unit_tests, &compiler_path, false);
134134
check!(unit_tests, &library_path, true);
135135

136-
// if bins::check_filesystem_support(&[&root_path], &output_directory) {
137-
// check!(bins, &root_path);
138-
// }
136+
if bins::check_filesystem_support(&[&root_path], &output_directory) {
137+
check!(bins, &root_path);
138+
}
139139

140140
check!(style, &src_path);
141141
check!(style, &tests_path);

0 commit comments

Comments
 (0)