about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-13 15:02:08 -0400
committerOneirical <manchot@videotron.ca>2024-07-08 10:14:42 -0400
commitf04d0c68eeeb32f2bf7477806482551f2a308ae0 (patch)
tree5b873939ab55d7abe9ce9436bb6ab3b5b17bbad0 /src
parent2dda1e31bead614a45e7f51c86dc14cf6a4ebe1c (diff)
rewrite sepcomp-inlining and -separate to rmake.rs
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/fs_wrapper.rs7
-rw-r--r--src/tools/run-make-support/src/lib.rs15
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt2
3 files changed, 14 insertions, 10 deletions
diff --git a/src/tools/run-make-support/src/fs_wrapper.rs b/src/tools/run-make-support/src/fs_wrapper.rs
index d65c10b17c9..0f0d6f6618c 100644
--- a/src/tools/run-make-support/src/fs_wrapper.rs
+++ b/src/tools/run-make-support/src/fs_wrapper.rs
@@ -25,13 +25,6 @@ pub fn create_file<P: AsRef<Path>>(path: P) {
         .expect(&format!("the file in path \"{}\" could not be created", path.as_ref().display()));
 }
 
-/// A wrapper around [`std::fs::File::open`] which includes the file path in the panic message.
-#[track_caller]
-pub fn open_file<P: AsRef<Path>>(path: P) -> fs::File {
-    fs::File::open(path.as_ref())
-        .expect(&format!("the file in path \"{}\" could not be opened", path.as_ref().display()))
-}
-
 /// A wrapper around [`std::fs::read`] which includes the file path in the panic message.
 #[track_caller]
 pub fn read<P: AsRef<Path>>(path: P) -> Vec<u8> {
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 068b022599e..3fdf94804f1 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -23,7 +23,6 @@ use std::path::{Path, PathBuf};
 
 pub use bstr;
 pub use gimli;
-pub use glob;
 pub use object;
 pub use regex;
 pub use wasmparser;
@@ -304,6 +303,20 @@ pub fn filename_not_in_denylist<P: AsRef<Path>, V: AsRef<[String]>>(path: P, exp
         .is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
 }
 
+/// Gathers all files in the current working directory that have the extension `ext`, and counts
+/// the number of lines within that contain a match with the regex pattern `re`.
+pub fn count_regex_matches_in_files_with_extension(re: &regex::Regex, ext: &str) -> usize {
+    let fetched_files = shallow_find_files(cwd(), |path| has_extension(path, ext));
+
+    let mut count = 0;
+    for file in fetched_files {
+        let content = fs_wrapper::read_to_string(file);
+        count += content.lines().filter(|line| re.is_match(&line)).count();
+    }
+
+    count
+}
+
 /// Use `cygpath -w` on a path to get a Windows path string back. This assumes that `cygpath` is
 /// available on the platform!
 #[track_caller]
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 233c2d0b808..184ef22317a 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -129,8 +129,6 @@ run-make/rustc-macro-dep-files/Makefile
 run-make/sanitizer-cdylib-link/Makefile
 run-make/sanitizer-dylib-link/Makefile
 run-make/sanitizer-staticlib-link/Makefile
-run-make/sepcomp-cci-copies/Makefile
-run-make/sepcomp-inlining/Makefile
 run-make/share-generics-dylib/Makefile
 run-make/silly-file-names/Makefile
 run-make/simd-ffi/Makefile