Skip to content

Commit 87c83f3

Browse files
committed
Auto merge of #127098 - Oneirical:big-test-party, r=<try>
Migrate `output-type-permutations` `run-make` test to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: armhf-gnu try-job: aarch64-apple try-job: test-various
2 parents e2cf31a + db010c6 commit 87c83f3

File tree

4 files changed

+577
-148
lines changed

4 files changed

+577
-148
lines changed

src/tools/run-make-support/src/lib.rs

+36
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,42 @@ pub fn test_while_readonly<P: AsRef<Path>, F: FnOnce() + std::panic::UnwindSafe>
261261
success.unwrap();
262262
}
263263

264+
/// Browse the directory `path` non-recursively and return all files which respect the parameters
265+
/// outlined by `closure`.
266+
#[track_caller]
267+
pub fn shallow_find_files<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
268+
path: P,
269+
filter: F,
270+
) -> Vec<PathBuf> {
271+
let mut matching_files = Vec::new();
272+
for entry in fs_wrapper::read_dir(path) {
273+
let entry = entry.expect("failed to read directory entry.");
274+
let path = entry.path();
275+
276+
if path.is_file() && filter(&path) {
277+
matching_files.push(path);
278+
}
279+
}
280+
matching_files
281+
}
282+
283+
/// Returns true if the filename at `path` starts with `prefix`.
284+
pub fn has_prefix<P: AsRef<Path>>(path: P, prefix: &str) -> bool {
285+
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().starts_with(prefix))
286+
}
287+
288+
/// Returns true if the filename at `path` has the extension `extension`.
289+
pub fn has_extension<P: AsRef<Path>>(path: P, extension: &str) -> bool {
290+
path.as_ref().extension().is_some_and(|ext| ext == extension)
291+
}
292+
293+
/// Returns true if the filename at `path` is not in `expected`.
294+
pub fn filename_not_in_denylist<P: AsRef<Path>>(path: P, expected: &[String]) -> bool {
295+
path.as_ref()
296+
.file_name()
297+
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
298+
}
299+
264300
/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
265301
/// available on the platform!
266302
#[track_caller]

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ run-make/no-duplicate-libs/Makefile
104104
run-make/obey-crate-type-flag/Makefile
105105
run-make/optimization-remarks-dir-pgo/Makefile
106106
run-make/optimization-remarks-dir/Makefile
107-
run-make/output-type-permutations/Makefile
108107
run-make/panic-abort-eh_frame/Makefile
109108
run-make/pass-linker-flags-flavor/Makefile
110109
run-make/pass-linker-flags-from-dep/Makefile

tests/run-make/output-type-permutations/Makefile

-147
This file was deleted.

0 commit comments

Comments
 (0)