Skip to content

Commit e66f4d3

Browse files
Rollup merge of #126709 - Oneirical:exitestial-crisis, r=jieyouxu
Migrate `include_bytes_deps`, `optimization-remarks-dir-pgo`, `optimization-remarks-dir`, `issue-40535` and `rmeta-preferred` `run-make` tests 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). Needs BSD tryjob. try-job: aarch64-apple try-job: x86_64-msvc try-job: armhf-gnu try-job: test-various
2 parents 7a79392 + 3ea36f5 commit e66f4d3

File tree

19 files changed

+159
-70
lines changed

19 files changed

+159
-70
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,40 @@ 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+
closure: 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() && closure(&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` does not contain `expected`.
294+
pub fn not_contains<P: AsRef<Path>>(path: P, expected: &str) -> bool {
295+
!path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().contains(expected))
296+
}
297+
264298
/// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
265299
/// available on the platform!
266300
#[track_caller]

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ run-make/fmt-write-bloat/Makefile
4646
run-make/foreign-double-unwind/Makefile
4747
run-make/foreign-exceptions/Makefile
4848
run-make/foreign-rust-exceptions/Makefile
49-
run-make/include_bytes_deps/Makefile
5049
run-make/incr-add-rust-src-component/Makefile
5150
run-make/incr-foreign-head-span/Makefile
5251
run-make/interdependent-c-libraries/Makefile
@@ -64,7 +63,6 @@ run-make/issue-33329/Makefile
6463
run-make/issue-35164/Makefile
6564
run-make/issue-36710/Makefile
6665
run-make/issue-37839/Makefile
67-
run-make/issue-40535/Makefile
6866
run-make/issue-47551/Makefile
6967
run-make/issue-69368/Makefile
7068
run-make/issue-83045/Makefile
@@ -102,8 +100,6 @@ run-make/no-alloc-shim/Makefile
102100
run-make/no-builtins-attribute/Makefile
103101
run-make/no-duplicate-libs/Makefile
104102
run-make/obey-crate-type-flag/Makefile
105-
run-make/optimization-remarks-dir-pgo/Makefile
106-
run-make/optimization-remarks-dir/Makefile
107103
run-make/output-type-permutations/Makefile
108104
run-make/panic-abort-eh_frame/Makefile
109105
run-make/pass-linker-flags-flavor/Makefile
@@ -136,7 +132,6 @@ run-make/return-non-c-like-enum-from-c/Makefile
136132
run-make/rlib-format-packed-bundled-libs-2/Makefile
137133
run-make/rlib-format-packed-bundled-libs-3/Makefile
138134
run-make/rlib-format-packed-bundled-libs/Makefile
139-
run-make/rmeta-preferred/Makefile
140135
run-make/rustc-macro-dep-files/Makefile
141136
run-make/sanitizer-cdylib-link/Makefile
142137
run-make/sanitizer-dylib-link/Makefile
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// include_bytes! and include_str! in `main.rs`
2+
// should register the included file as of #24423,
3+
// and this test checks that this is still the case.
4+
// See https://github.com/rust-lang/rust/pull/24423
5+
6+
use run_make_support::{invalid_utf8_contains, rustc};
7+
8+
fn main() {
9+
rustc().emit("dep-info").input("main.rs").run();
10+
invalid_utf8_contains("main.d", "input.txt");
11+
invalid_utf8_contains("main.d", "input.bin");
12+
invalid_utf8_contains("main.d", "input.md");
13+
}

tests/run-make/include_bytes_deps/Makefile

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/run-make/issue-40535/Makefile

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)