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

Support a non-exiting run mode #39

Merged
merged 1 commit into from
Oct 8, 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: 5 additions & 5 deletions crates/conformance-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ impl Config {
}
}

/// Run the conformance tests
/// Run the conformance tests and return the results.
pub fn run_tests(
config: Config,
run: impl Fn(Test) -> anyhow::Result<()> + Send + Clone + 'static,
) -> anyhow::Result<()> {
) -> anyhow::Result<libtest_mimic::Conclusion> {
let tests_dir = download_tests(&config.version)?;
run_tests_from(tests_dir, config, run)
}

/// Run the conformance tests located in the given directory
/// Run the conformance tests located in the given directory and returns the Conclusion
pub fn run_tests_from(
tests_dir: impl AsRef<Path>,
config: Config,
run: impl Fn(Test) -> anyhow::Result<()> + Send + Clone + 'static,
) -> anyhow::Result<()> {
) -> anyhow::Result<libtest_mimic::Conclusion> {
let trials = tests_iter(tests_dir)?
.map(|test| {
let run = run.clone();
Expand All @@ -56,7 +56,7 @@ pub fn run_tests_from(
.with_ignored_flag(config.ignored.contains(&name))
})
.collect();
libtest_mimic::run(&Default::default(), trials).exit();
Ok(libtest_mimic::run(&Default::default(), trials))
}

/// Download the conformance tests and return the path to the directory where they are written to
Expand Down