Skip to content

Commit

Permalink
check suite_path exists in ef-tests Suite run (#6303)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Jan 31, 2024
1 parent 262a9c1 commit e5cd8cc
Showing 1 changed file with 8 additions and 2 deletions.
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()
}

0 comments on commit e5cd8cc

Please sign in to comment.