chore: allow skipping certain files in third party tests

This commit is contained in:
Ryan Chandler 2022-12-05 11:58:52 +00:00
parent 209196ab12
commit 9ad4ee7bc8
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -13,6 +13,7 @@ fn third_party_1_php_standard_library() {
"https://github.com/azjezz/psl.git",
"2.2.x",
&["src", "tests", "examples"],
&[]
);
}
@ -23,6 +24,7 @@ fn third_party_2_laravel_framework() {
"https://github.com/laravel/framework",
"9.x",
&["src", "tests"],
&[]
);
}
@ -33,10 +35,11 @@ fn third_party_3_symfony_framework() {
"https://github.com/symfony/symfony",
"6.3",
&["src/Symfony"],
&["src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php"]
);
}
fn test_repository(name: &str, repository: &str, branch: &str, directories: &[&str]) {
fn test_repository(name: &str, repository: &str, branch: &str, directories: &[&str], ignore: &[&str]) {
let out_dir = env::var_os("OUT_DIR").expect("failed to get OUT_DIR");
let out_path = PathBuf::from(out_dir).join(name);
@ -58,12 +61,12 @@ fn test_repository(name: &str, repository: &str, branch: &str, directories: &[&s
}
for dir in directories {
test_directory(out_path.clone(), out_path.join(dir));
test_directory(out_path.clone(), out_path.join(dir), ignore);
}
}
fn test_directory(root: PathBuf, directory: PathBuf) {
let mut entries = fs::read_dir(directory)
fn test_directory(root: PathBuf, directory: PathBuf, ignore: &[&str]) {
let mut entries = fs::read_dir(&directory)
.unwrap()
.flatten()
.map(|entry| entry.path())
@ -73,12 +76,12 @@ fn test_directory(root: PathBuf, directory: PathBuf) {
for entry in entries {
if entry.is_dir() {
test_directory(root.clone(), entry);
test_directory(root.clone(), entry, ignore);
continue;
}
if entry.is_file() && entry.extension().unwrap_or_default() == "php" {
if entry.is_file() && entry.extension().unwrap_or_default() == "php" && ! ignore.contains(&entry.as_path().strip_prefix(&root).unwrap().to_str().unwrap()) {
let name_entry = entry.clone();
let fullanme_string = name_entry.to_string_lossy();
let name = fullanme_string