From 9ad4ee7bc850372df056b14357e13708daff4f29 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Mon, 5 Dec 2022 11:58:52 +0000 Subject: [PATCH] chore: allow skipping certain files in third party tests --- tests/third_party_tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/third_party_tests.rs b/tests/third_party_tests.rs index f3a7f0f..9947e80 100644 --- a/tests/third_party_tests.rs +++ b/tests/third_party_tests.rs @@ -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