Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/tools/tidy/src/known_bug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@ use crate::walk::*;

pub fn check(filepath: &Path, bad: &mut bool) {
walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| {
let file = entry.path();
if !contents.lines().any(|line| line.starts_with("//@ known-bug: ")) {
let file: &Path = entry.path();

// files in "auxiliary" do not need to crash by themselves
let test_path_segments =
file.iter().map(|s| s.to_string_lossy().into()).collect::<Vec<String>>();
let test_path_segments_str =
test_path_segments.iter().map(|s| s.as_str()).collect::<Vec<&str>>();

if !matches!(test_path_segments_str[..], [
..,
"tests",
"crashes",
"auxiliary",
_aux_file_rs
Comment on lines +11 to +22
Copy link
Member

@jieyouxu jieyouxu Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I think the aux test file check be simplified to something like

let crashes_aux_dir_prefix = test_root.join("crashes").join("auxiliary"); // probably  pass this as a ref

let is_crashes_aux_file = file.starts_with(crashes_aux_dir_prefix);

If we don't support arbitrary nested auxiliary folders in tests/crashes.

Collecting into Vec<String> in test_path_segments would do a bunch of small string allocations, right?

]) && !contents.lines().any(|line| line.starts_with("//@ known-bug: "))
{
tidy_error!(
bad,
"{} crash/ice test does not have a \"//@ known-bug: \" directive",
Expand Down
Loading