Rollup merge of #144173 - Kivooeo:tidy_checks, r=jieyouxu

Remove tidy checks for `tests/ui/issues/`

r? ``````````@jieyouxu``````````

As it is making cleanup efforts more difficult.

This change was discussed here [#t-compiler > Discussion for ui test suite improvements @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Discussion.20for.20ui.20test.20suite.20improvements/near/529566433)
This commit is contained in:
Matthias Krüger 2025-07-23 15:59:28 +02:00 committed by GitHub
commit 4177f199bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 1275 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,24 +1,12 @@
//! Tidy check to ensure below in UI test directories:
//! - the number of entries in each directory must be less than `ENTRY_LIMIT`
//! - there are no stray `.stderr` files
use std::collections::{BTreeSet, HashMap};
use std::collections::BTreeSet;
use std::ffi::OsStr;
use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
use ignore::Walk;
// FIXME: GitHub's UI truncates file lists that exceed 1000 entries, so these
// should all be 1000 or lower. Limits significantly smaller than 1000 are also
// desirable, because large numbers of files are unwieldy in general. See issue
// #73494.
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: u32 = 1616;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
"stderr", // expected stderr file, corresponds to a rs file
@ -54,42 +42,6 @@ const EXTENSION_EXCEPTION_PATHS: &[&str] = &[
"tests/ui/std/windows-bat-args3.bat", // tests escaping arguments through batch files
];
fn check_entries(tests_path: &Path, bad: &mut bool) {
let mut directories: HashMap<PathBuf, u32> = HashMap::new();
for entry in Walk::new(tests_path.join("ui")).flatten() {
let parent = entry.path().parent().unwrap().to_path_buf();
*directories.entry(parent).or_default() += 1;
}
let (mut max, mut max_issues) = (0, 0);
for (dir_path, count) in directories {
let is_issues_dir = tests_path.join("ui/issues") == dir_path;
let (limit, maxcnt) = if is_issues_dir {
(ISSUES_ENTRY_LIMIT, &mut max_issues)
} else {
(ENTRY_LIMIT, &mut max)
};
*maxcnt = (*maxcnt).max(count);
if count > limit {
tidy_error!(
bad,
"following path contains more than {} entries, \
you should move the test to some relevant subdirectory (current: {}): {}",
limit,
count,
dir_path.display()
);
}
}
if ISSUES_ENTRY_LIMIT > max_issues {
tidy_error!(
bad,
"`ISSUES_ENTRY_LIMIT` is too high (is {ISSUES_ENTRY_LIMIT}, should be {max_issues})"
);
}
}
pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
let issues_txt_header = r#"============================================================
NOTHING SHOULD EVER BE ADDED TO THIS LIST
@ -97,7 +49,6 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
"#;
let path = &root_path.join("tests");
check_entries(path, bad);
// the list of files in ui tests that are allowed to start with `issue-XXXX`
// BTreeSet because we would like a stable ordering so --bless works
@ -179,7 +130,9 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
.unwrap()
.replace(std::path::MAIN_SEPARATOR_STR, "/");
if !remaining_issue_names.remove(stripped_path.as_str()) {
if !remaining_issue_names.remove(stripped_path.as_str())
&& !stripped_path.starts_with("ui/issues/")
{
tidy_error!(
bad,
"file `tests/{stripped_path}` must begin with a descriptive name, consider `{{reason}}-issue-{issue_n}.rs`",

View file

@ -1147,6 +1147,12 @@ cc = ["@nnethercote"]
message = "Changes to the size of AST and/or HIR nodes."
cc = ["@nnethercote"]
[mentions."tests/ui/issues"]
message = """
This PR modifies `tests/ui/issues/`. If this PR is adding new tests to `tests/ui/issues/`,
please refrain from doing so, and instead add it to more descriptive subdirectories.
"""
[mentions."compiler/rustc_sanitizers"]
cc = ["@rcvalle"]