Skip to content

Commit

Permalink
Auto merge of #127098 - Oneirical:big-test-party, r=<try>
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jul 3, 2024
2 parents c872a14 + 8378da4 commit 0e21599
Show file tree
Hide file tree
Showing 4 changed files with 577 additions and 148 deletions.
36 changes: 36 additions & 0 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,42 @@ pub fn test_while_readonly<P: AsRef<Path>, F: FnOnce() + std::panic::UnwindSafe>
success.unwrap();
}

/// Browse the directory `path` non-recursively and return all files which respect the parameters
/// outlined by `closure`.
#[track_caller]
pub fn shallow_find_files<P: AsRef<Path>, F: Fn(&PathBuf) -> bool>(
path: P,
filter: F,
) -> Vec<PathBuf> {
let mut matching_files = Vec::new();
for entry in fs_wrapper::read_dir(path) {
let entry = entry.expect("failed to read directory entry.");
let path = entry.path();

if path.is_file() && filter(&path) {
matching_files.push(path);
}
}
matching_files
}

/// Returns true if the filename at `path` starts with `prefix`.
pub fn has_prefix<P: AsRef<Path>>(path: P, prefix: &str) -> bool {
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().starts_with(prefix))
}

/// Returns true if the filename at `path` has the extension `extension`.
pub fn has_extension<P: AsRef<Path>>(path: P, extension: &str) -> bool {
path.as_ref().extension().is_some_and(|ext| ext == extension)
}

/// Returns true if the filename at `path` is not in `expected`.
pub fn filename_not_in_denylist<P: AsRef<Path>>(path: P, expected: &Vec<String>) -> bool {
path.as_ref()
.file_name()
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
}

/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
/// available on the platform!
#[track_caller]
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ run-make/no-duplicate-libs/Makefile
run-make/obey-crate-type-flag/Makefile
run-make/optimization-remarks-dir-pgo/Makefile
run-make/optimization-remarks-dir/Makefile
run-make/output-type-permutations/Makefile
run-make/panic-abort-eh_frame/Makefile
run-make/pass-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile
Expand Down
147 changes: 0 additions & 147 deletions tests/run-make/output-type-permutations/Makefile

This file was deleted.

Loading

0 comments on commit 0e21599

Please sign in to comment.