diff options
Diffstat (limited to 'third_party/rust/wast/tests/parse-fail.rs')
-rw-r--r-- | third_party/rust/wast/tests/parse-fail.rs | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/third_party/rust/wast/tests/parse-fail.rs b/third_party/rust/wast/tests/parse-fail.rs index 3ae1817a4a..a8d4f34456 100644 --- a/third_party/rust/wast/tests/parse-fail.rs +++ b/third_party/rust/wast/tests/parse-fail.rs @@ -4,46 +4,28 @@ //! Use `BLESS=1` in the environment to auto-update `*.err` files. Be sure to //! look at the diff! -use rayon::prelude::*; +use libtest_mimic::{Arguments, Trial}; use std::env; use std::path::{Path, PathBuf}; fn main() { let mut tests = Vec::new(); find_tests("tests/parse-fail".as_ref(), &mut tests); - let filter = std::env::args().nth(1); - let bless = env::var("BLESS").is_ok(); - let tests = tests - .iter() - .filter(|test| { - if let Some(filter) = &filter { - if let Some(s) = test.file_name().and_then(|s| s.to_str()) { - if !s.contains(filter) { - return false; - } - } - } - true - }) - .collect::<Vec<_>>(); - - println!("running {} tests\n", tests.len()); - - let errors = tests - .par_iter() - .filter_map(|test| run_test(test, bless).err()) - .collect::<Vec<_>>(); - if !errors.is_empty() { - for msg in errors.iter() { - eprintln!("{}", msg); - } - - panic!("{} tests failed", errors.len()) + let mut trials = Vec::new(); + for test in tests { + let trial = Trial::test(format!("{test:?}"), move || { + run_test(&test, bless).map_err(|e| format!("{e:?}").into()) + }); + trials.push(trial); } - println!("test result: ok. {} passed\n", tests.len()); + let mut args = Arguments::from_args(); + if cfg!(target_family = "wasm") && !cfg!(target_feature = "atomics") { + args.test_threads = Some(1); + } + libtest_mimic::run(&args, trials).exit(); } fn run_test(test: &Path, bless: bool) -> anyhow::Result<()> { |