Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check suite_path exists in ef-tests Suite run #6303

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions testing/ef-tests/src/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ pub trait Suite {
///
/// This recursively finds every test description in the resulting path.
fn run(&self) {
// Build the path to the test suite directory
let suite_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("ethereum-tests")
.join(self.suite_name());

// todo: assert that the path exists
// Verify that the path exists
assert!(suite_path.exists(), "Test suite path does not exist: {:?}", suite_path);

// Find all files with the ".json" extension in the test suite directory
let test_cases = find_all_files_with_extension(&suite_path, ".json")
.into_iter()
.map(|test_case_path| {
Expand All @@ -40,8 +44,10 @@ pub trait Suite {
})
.collect();

// Run the test cases and collect the results
let results = Cases { test_cases }.run();

// Assert that all tests in the suite pass
assert_tests_pass(&self.suite_name(), &suite_path, &results);
}
}
Expand All @@ -53,5 +59,5 @@ fn find_all_files_with_extension(path: &Path, extension: &str) -> Vec<PathBuf> {
.filter_map(Result::ok)
.filter(|e| e.file_name().to_string_lossy().ends_with(extension))
.map(DirEntry::into_path)
.collect::<_>()
.collect()
}
Loading