wasmtime_test_util/
wast.rs

1use anyhow::{Context, Result};
2use serde::de::DeserializeOwned;
3use serde_derive::Deserialize;
4use std::fmt;
5use std::fs;
6use std::path::Path;
7use std::path::PathBuf;
8
9/// Limits for running wast tests.
10///
11/// This is useful for sharing between `tests/wast.rs` and fuzzing, for
12/// example, and is used as the minimum threshold for configuration when
13/// fuzzing.
14///
15/// Note that it's ok to increase these numbers if a test comes along and needs
16/// it, they're just here as empirically found minimum thresholds so far and
17/// they're not too scientific.
18pub mod limits {
19    pub const MEMORY_SIZE: usize = 805 << 16;
20    pub const MEMORIES: u32 = 450;
21    pub const TABLES: u32 = 200;
22    pub const MEMORIES_PER_MODULE: u32 = 9;
23    pub const TABLES_PER_MODULE: u32 = 5;
24    pub const COMPONENT_INSTANCES: u32 = 50;
25    pub const CORE_INSTANCES: u32 = 900;
26    pub const TABLE_ELEMENTS: usize = 1000;
27    pub const CORE_INSTANCE_SIZE: usize = 64 * 1024;
28    pub const TOTAL_STACKS: u32 = 10;
29}
30
31/// Local all `*.wast` tests under `root` which should be the path to the root
32/// of the wasmtime repository.
33pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
34    let mut tests = Vec::new();
35
36    let spec_tests = root.join("tests/spec_testsuite");
37    add_tests(
38        &mut tests,
39        &spec_tests,
40        &FindConfig::Infer(spec_test_config),
41    )
42    .with_context(|| format!("failed to add tests from `{}`", spec_tests.display()))?;
43
44    let misc_tests = root.join("tests/misc_testsuite");
45    add_tests(&mut tests, &misc_tests, &FindConfig::InTest)
46        .with_context(|| format!("failed to add tests from `{}`", misc_tests.display()))?;
47
48    let cm_tests = root.join("tests/component-model/test");
49    add_tests(
50        &mut tests,
51        &cm_tests,
52        &FindConfig::Infer(component_test_config),
53    )
54    .with_context(|| format!("failed to add tests from `{}`", cm_tests.display()))?;
55    Ok(tests)
56}
57
58enum FindConfig {
59    InTest,
60    Infer(fn(&Path) -> TestConfig),
61}
62
63fn add_tests(tests: &mut Vec<WastTest>, path: &Path, config: &FindConfig) -> Result<()> {
64    for entry in path.read_dir().context("failed to read directory")? {
65        let entry = entry.context("failed to read directory entry")?;
66        let path = entry.path();
67        if entry
68            .file_type()
69            .context("failed to get file type")?
70            .is_dir()
71        {
72            add_tests(tests, &path, config).context("failed to read sub-directory")?;
73            continue;
74        }
75
76        if path.extension().and_then(|s| s.to_str()) != Some("wast") {
77            continue;
78        }
79
80        let contents =
81            fs::read_to_string(&path).with_context(|| format!("failed to read test: {path:?}"))?;
82        let config = match config {
83            FindConfig::InTest => parse_test_config(&contents, ";;!")
84                .with_context(|| format!("failed to parse test configuration: {path:?}"))?,
85            FindConfig::Infer(f) => f(&path),
86        };
87        tests.push(WastTest {
88            path,
89            contents,
90            config,
91        })
92    }
93    Ok(())
94}
95
96fn spec_test_config(test: &Path) -> TestConfig {
97    let mut ret = TestConfig::default();
98    ret.spec_test = Some(true);
99    match spec_proposal_from_path(test) {
100        Some("wide-arithmetic") => {
101            ret.wide_arithmetic = Some(true);
102        }
103        Some("threads") => {
104            ret.threads = Some(true);
105            ret.reference_types = Some(false);
106        }
107        Some("custom-page-sizes") => {
108            ret.custom_page_sizes = Some(true);
109            ret.multi_memory = Some(true);
110            ret.memory64 = Some(true);
111
112            // See commentary below in `wasm-3.0` case for why these "hog
113            // memory"
114            if test.ends_with("memory_max.wast") || test.ends_with("memory_max_i64.wast") {
115                ret.hogs_memory = Some(true);
116            }
117        }
118        Some("custom-descriptors") => {
119            ret.custom_descriptors = Some(true);
120        }
121        Some(proposal) => panic!("unsupported proposal {proposal:?}"),
122        None => {
123            ret.reference_types = Some(true);
124            ret.simd = Some(true);
125            ret.simd = Some(true);
126            ret.relaxed_simd = Some(true);
127            ret.multi_memory = Some(true);
128            ret.gc = Some(true);
129            ret.reference_types = Some(true);
130            ret.memory64 = Some(true);
131            ret.tail_call = Some(true);
132            ret.extended_const = Some(true);
133            ret.exceptions = Some(true);
134
135            if test.parent().unwrap().ends_with("legacy") {
136                ret.legacy_exceptions = Some(true);
137            }
138
139            // These tests technically don't actually hog any memory but they
140            // do have a module definition with a table/memory that is the
141            // maximum size. These modules fail to compile in the pooling
142            // allocator which has limits on the minimum size of
143            // memories/tables by default.
144            //
145            // Pretend that these hog memory to avoid running the tests in the
146            // pooling allocator.
147            if test.ends_with("memory.wast")
148                || test.ends_with("table.wast")
149                || test.ends_with("memory64.wast")
150                || test.ends_with("table64.wast")
151            {
152                ret.hogs_memory = Some(true);
153            }
154        }
155    }
156
157    ret
158}
159
160fn component_test_config(test: &Path) -> TestConfig {
161    let mut ret = TestConfig::default();
162    ret.spec_test = Some(true);
163    ret.reference_types = Some(true);
164    ret.multi_memory = Some(true);
165
166    if let Some(parent) = test.parent() {
167        if parent.ends_with("async") {
168            ret.component_model_async = Some(true);
169            ret.component_model_async_builtins = Some(true);
170        }
171    }
172
173    ret
174}
175
176/// Parse test configuration from the specified test, comments starting with
177/// `;;!`.
178pub fn parse_test_config<T>(wat: &str, comment: &'static str) -> Result<T>
179where
180    T: DeserializeOwned,
181{
182    // The test config source is the leading lines of the WAT file that are
183    // prefixed with `;;!`.
184    let config_lines: Vec<_> = wat
185        .lines()
186        .take_while(|l| l.starts_with(comment))
187        .map(|l| &l[comment.len()..])
188        .collect();
189    let config_text = config_lines.join("\n");
190
191    toml::from_str(&config_text).context("failed to parse the test configuration")
192}
193
194/// A `*.wast` test with its path, contents, and configuration.
195#[derive(Clone)]
196pub struct WastTest {
197    pub path: PathBuf,
198    pub contents: String,
199    pub config: TestConfig,
200}
201
202impl fmt::Debug for WastTest {
203    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
204        f.debug_struct("WastTest")
205            .field("path", &self.path)
206            .field("contents", &"...")
207            .field("config", &self.config)
208            .finish()
209    }
210}
211
212macro_rules! foreach_config_option {
213    ($m:ident) => {
214        $m! {
215            memory64
216            custom_page_sizes
217            multi_memory
218            threads
219            shared_everything_threads
220            gc
221            function_references
222            relaxed_simd
223            reference_types
224            tail_call
225            extended_const
226            wide_arithmetic
227            hogs_memory
228            nan_canonicalization
229            component_model_async
230            component_model_async_builtins
231            component_model_async_stackful
232            component_model_threading
233            component_model_error_context
234            component_model_gc
235            simd
236            gc_types
237            exceptions
238            legacy_exceptions
239            stack_switching
240            spec_test
241            custom_descriptors
242        }
243    };
244}
245
246macro_rules! define_test_config {
247    ($($option:ident)*) => {
248        /// Per-test configuration which is written down in the test file itself for
249        /// `misc_testsuite/**/*.wast` or in `spec_test_config` above for spec tests.
250        #[derive(Debug, PartialEq, Default, Deserialize, Clone)]
251        #[serde(deny_unknown_fields)]
252        pub struct TestConfig {
253            $(pub $option: Option<bool>,)*
254        }
255
256        impl TestConfig {
257            $(
258                pub fn $option(&self) -> bool {
259                    self.$option.unwrap_or(false)
260                }
261            )*
262        }
263    }
264}
265
266foreach_config_option!(define_test_config);
267
268impl TestConfig {
269    /// Returns an iterator over each option.
270    pub fn options_mut(&mut self) -> impl Iterator<Item = (&'static str, &mut Option<bool>)> {
271        macro_rules! mk {
272            ($($option:ident)*) => {
273                [
274                    $((stringify!($option), &mut self.$option),)*
275                ].into_iter()
276            }
277        }
278        foreach_config_option!(mk)
279    }
280}
281
282/// Configuration that spec tests can run under.
283#[derive(Debug)]
284pub struct WastConfig {
285    /// Compiler chosen to run this test.
286    pub compiler: Compiler,
287    /// Whether or not the pooling allocator is enabled.
288    pub pooling: bool,
289    /// What garbage collector is being used.
290    pub collector: Collector,
291}
292
293/// Different compilers that can be tested in Wasmtime.
294#[derive(PartialEq, Debug, Copy, Clone)]
295pub enum Compiler {
296    /// Cranelift backend.
297    ///
298    /// This tests the Cranelift code generator for native platforms. This
299    /// notably excludes Pulley since that's listed separately below even though
300    /// Pulley is a backend of Cranelift. This is only used for native code
301    /// generation such as x86_64.
302    CraneliftNative,
303
304    /// Winch backend.
305    ///
306    /// This tests the Winch backend for native platforms. Currently Winch
307    /// primarily supports x86_64.
308    Winch,
309
310    /// Pulley interpreter.
311    ///
312    /// This tests the Cranelift pulley backend plus the pulley execution
313    /// environment of the output bytecode. Note that this is separate from
314    /// `Cranelift` above to be able to test both on platforms where Cranelift
315    /// has native codegen support.
316    CraneliftPulley,
317}
318
319impl Compiler {
320    /// Returns whether this compiler is known to fail for the provided
321    /// `TestConfig`.
322    ///
323    /// This function will determine if the configuration of the test provided
324    /// is known to guarantee fail. This effectively tracks the proposal support
325    /// for each compiler backend/runtime and tests whether `config` enables or
326    /// disables features that aren't supported.
327    ///
328    /// Note that this is closely aligned with
329    /// `Config::compiler_panicking_wasm_features`.
330    pub fn should_fail(&self, config: &TestConfig) -> bool {
331        match self {
332            Compiler::CraneliftNative => config.legacy_exceptions(),
333
334            Compiler::Winch => {
335                if config.gc()
336                    || config.tail_call()
337                    || config.function_references()
338                    || config.gc()
339                    || config.relaxed_simd()
340                    || config.gc_types()
341                    || config.exceptions()
342                    || config.legacy_exceptions()
343                    || config.stack_switching()
344                    || config.legacy_exceptions()
345                    || config.component_model_async()
346                {
347                    return true;
348                }
349
350                if cfg!(target_arch = "aarch64") {
351                    return config.wide_arithmetic()
352                        || (config.simd() && !config.spec_test())
353                        || config.threads();
354                }
355
356                !cfg!(target_arch = "x86_64")
357            }
358
359            Compiler::CraneliftPulley => {
360                config.threads() || config.legacy_exceptions() || config.stack_switching()
361            }
362        }
363    }
364
365    /// Returns whether this compiler configuration supports the current host
366    /// architecture.
367    pub fn supports_host(&self) -> bool {
368        match self {
369            Compiler::CraneliftNative => {
370                cfg!(target_arch = "x86_64")
371                    || cfg!(target_arch = "aarch64")
372                    || cfg!(target_arch = "riscv64")
373                    || cfg!(target_arch = "s390x")
374            }
375            Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"),
376            Compiler::CraneliftPulley => true,
377        }
378    }
379}
380
381#[derive(PartialEq, Debug, Copy, Clone)]
382pub enum Collector {
383    Auto,
384    Null,
385    DeferredReferenceCounting,
386}
387
388impl WastTest {
389    /// Returns whether this test exercises the GC types and might want to use
390    /// multiple different garbage collectors.
391    pub fn test_uses_gc_types(&self) -> bool {
392        self.config.gc() || self.config.function_references()
393    }
394
395    /// Returns the optional spec proposal that this test is associated with.
396    pub fn spec_proposal(&self) -> Option<&str> {
397        spec_proposal_from_path(&self.path)
398    }
399
400    /// Returns whether this test should fail under the specified extra
401    /// configuration.
402    pub fn should_fail(&self, config: &WastConfig) -> bool {
403        if !config.compiler.supports_host() {
404            return true;
405        }
406
407        // Some tests are known to fail with the pooling allocator
408        if config.pooling {
409            let unsupported = [
410                // allocates too much memory for the pooling configuration here
411                "misc_testsuite/memory64/more-than-4gb.wast",
412                // shared memories + pooling allocator aren't supported yet
413                "misc_testsuite/memory-combos.wast",
414                "misc_testsuite/threads/atomics-end-of-memory.wast",
415                "misc_testsuite/threads/LB.wast",
416                "misc_testsuite/threads/LB_atomic.wast",
417                "misc_testsuite/threads/MP.wast",
418                "misc_testsuite/threads/MP_atomic.wast",
419                "misc_testsuite/threads/MP_wait.wast",
420                "misc_testsuite/threads/SB.wast",
421                "misc_testsuite/threads/SB_atomic.wast",
422                "misc_testsuite/threads/atomics_notify.wast",
423                "misc_testsuite/threads/atomics_wait_address.wast",
424                "misc_testsuite/threads/wait_notify.wast",
425                "spec_testsuite/proposals/threads/atomic.wast",
426                "spec_testsuite/proposals/threads/exports.wast",
427                "spec_testsuite/proposals/threads/memory.wast",
428            ];
429
430            if unsupported.iter().any(|part| self.path.ends_with(part)) {
431                return true;
432            }
433        }
434
435        if config.compiler.should_fail(&self.config) {
436            return true;
437        }
438
439        // Disable spec tests per target for proposals that Winch does not implement yet.
440        if config.compiler == Compiler::Winch {
441            // Common list for tests that fail in all targets supported by Winch.
442            let unsupported = [
443                "extended-const/elem.wast",
444                "extended-const/global.wast",
445                "misc_testsuite/component-model/modules.wast",
446                "misc_testsuite/externref-id-function.wast",
447                "misc_testsuite/externref-segment.wast",
448                "misc_testsuite/externref-segments.wast",
449                "misc_testsuite/externref-table-dropped-segment-issue-8281.wast",
450                "misc_testsuite/linking-errors.wast",
451                "misc_testsuite/many_table_gets_lead_to_gc.wast",
452                "misc_testsuite/mutable_externref_globals.wast",
453                "misc_testsuite/no-mixup-stack-maps.wast",
454                "misc_testsuite/no-panic.wast",
455                "misc_testsuite/simple_ref_is_null.wast",
456                "misc_testsuite/table_grow_with_funcref.wast",
457                "spec_testsuite/br_table.wast",
458                "spec_testsuite/global.wast",
459                "spec_testsuite/ref_func.wast",
460                "spec_testsuite/ref_is_null.wast",
461                "spec_testsuite/ref_null.wast",
462                "spec_testsuite/select.wast",
463                "spec_testsuite/table_fill.wast",
464                "spec_testsuite/table_get.wast",
465                "spec_testsuite/table_grow.wast",
466                "spec_testsuite/table_set.wast",
467                "spec_testsuite/table_size.wast",
468                "spec_testsuite/elem.wast",
469                "spec_testsuite/linking.wast",
470            ];
471
472            if unsupported.iter().any(|part| self.path.ends_with(part)) {
473                return true;
474            }
475
476            #[cfg(target_arch = "aarch64")]
477            {
478                let unsupported = [
479                    "misc_testsuite/int-to-float-splat.wast",
480                    "misc_testsuite/issue6562.wast",
481                    "misc_testsuite/memory64/simd.wast",
482                    "misc_testsuite/simd/almost-extmul.wast",
483                    "misc_testsuite/simd/canonicalize-nan.wast",
484                    "misc_testsuite/simd/cvt-from-uint.wast",
485                    "misc_testsuite/simd/edge-of-memory.wast",
486                    "misc_testsuite/simd/interesting-float-splat.wast",
487                    "misc_testsuite/simd/issue4807.wast",
488                    "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
489                    "misc_testsuite/simd/issue_3173_select_v128.wast",
490                    "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
491                    "misc_testsuite/simd/load_splat_out_of_bounds.wast",
492                    "misc_testsuite/simd/replace-lane-preserve.wast",
493                    "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
494                    "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
495                    "misc_testsuite/simd/unaligned-load.wast",
496                    "misc_testsuite/simd/v128-select.wast",
497                    "misc_testsuite/winch/issue-10331.wast",
498                    "misc_testsuite/winch/issue-10357.wast",
499                    "misc_testsuite/winch/issue-10460.wast",
500                    "misc_testsuite/winch/replace_lane.wast",
501                    "misc_testsuite/winch/simd_multivalue.wast",
502                    "misc_testsuite/winch/v128_load_lane_invalid_address.wast",
503                    "spec_testsuite/proposals/annotations/simd_lane.wast",
504                    "spec_testsuite/proposals/multi-memory/simd_memory-multi.wast",
505                    "spec_testsuite/simd_address.wast",
506                    "spec_testsuite/simd_align.wast",
507                    "spec_testsuite/simd_bit_shift.wast",
508                    "spec_testsuite/simd_bitwise.wast",
509                    "spec_testsuite/simd_boolean.wast",
510                    "spec_testsuite/simd_const.wast",
511                    "spec_testsuite/simd_conversions.wast",
512                    "spec_testsuite/simd_f32x4.wast",
513                    "spec_testsuite/simd_f32x4_arith.wast",
514                    "spec_testsuite/simd_f32x4_cmp.wast",
515                    "spec_testsuite/simd_f32x4_pmin_pmax.wast",
516                    "spec_testsuite/simd_f32x4_rounding.wast",
517                    "spec_testsuite/simd_f64x2.wast",
518                    "spec_testsuite/simd_f64x2_arith.wast",
519                    "spec_testsuite/simd_f64x2_cmp.wast",
520                    "spec_testsuite/simd_f64x2_pmin_pmax.wast",
521                    "spec_testsuite/simd_f64x2_rounding.wast",
522                    "spec_testsuite/simd_i16x8_arith.wast",
523                    "spec_testsuite/simd_i16x8_arith2.wast",
524                    "spec_testsuite/simd_i16x8_cmp.wast",
525                    "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
526                    "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
527                    "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
528                    "spec_testsuite/simd_i16x8_sat_arith.wast",
529                    "spec_testsuite/simd_i32x4_arith.wast",
530                    "spec_testsuite/simd_i32x4_arith2.wast",
531                    "spec_testsuite/simd_i32x4_cmp.wast",
532                    "spec_testsuite/simd_i32x4_dot_i16x8.wast",
533                    "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
534                    "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
535                    "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
536                    "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
537                    "spec_testsuite/simd_i64x2_arith.wast",
538                    "spec_testsuite/simd_i64x2_arith2.wast",
539                    "spec_testsuite/simd_i64x2_cmp.wast",
540                    "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
541                    "spec_testsuite/simd_i8x16_arith.wast",
542                    "spec_testsuite/simd_i8x16_arith2.wast",
543                    "spec_testsuite/simd_i8x16_cmp.wast",
544                    "spec_testsuite/simd_i8x16_sat_arith.wast",
545                    "spec_testsuite/simd_int_to_int_extend.wast",
546                    "spec_testsuite/simd_lane.wast",
547                    "spec_testsuite/simd_load.wast",
548                    "spec_testsuite/simd_load16_lane.wast",
549                    "spec_testsuite/simd_load32_lane.wast",
550                    "spec_testsuite/simd_load64_lane.wast",
551                    "spec_testsuite/simd_load8_lane.wast",
552                    "spec_testsuite/simd_load_extend.wast",
553                    "spec_testsuite/simd_load_splat.wast",
554                    "spec_testsuite/simd_load_zero.wast",
555                    "spec_testsuite/simd_select.wast",
556                    "spec_testsuite/simd_splat.wast",
557                    "spec_testsuite/simd_store.wast",
558                    "spec_testsuite/simd_store16_lane.wast",
559                    "spec_testsuite/simd_store32_lane.wast",
560                    "spec_testsuite/simd_store64_lane.wast",
561                    "spec_testsuite/simd_store8_lane.wast",
562                ];
563
564                if unsupported.iter().any(|part| self.path.ends_with(part)) {
565                    return true;
566                }
567            }
568
569            #[cfg(target_arch = "x86_64")]
570            {
571                let unsupported = [
572                    // externref/reference-types related
573                    // simd-related failures
574                    "misc_testsuite/simd/canonicalize-nan.wast",
575                ];
576
577                if unsupported.iter().any(|part| self.path.ends_with(part)) {
578                    return true;
579                }
580
581                // SIMD on Winch requires AVX instructions.
582                #[cfg(target_arch = "x86_64")]
583                if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2"))
584                {
585                    let unsupported = [
586                        "annotations/simd_lane.wast",
587                        "memory64/simd.wast",
588                        "misc_testsuite/int-to-float-splat.wast",
589                        "misc_testsuite/issue6562.wast",
590                        "misc_testsuite/simd/almost-extmul.wast",
591                        "misc_testsuite/simd/cvt-from-uint.wast",
592                        "misc_testsuite/simd/edge-of-memory.wast",
593                        "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
594                        "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
595                        "misc_testsuite/simd/replace-lane-preserve.wast",
596                        "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
597                        "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
598                        "misc_testsuite/winch/issue-10331.wast",
599                        "misc_testsuite/winch/replace_lane.wast",
600                        "spec_testsuite/simd_align.wast",
601                        "spec_testsuite/simd_boolean.wast",
602                        "spec_testsuite/simd_conversions.wast",
603                        "spec_testsuite/simd_f32x4.wast",
604                        "spec_testsuite/simd_f32x4_arith.wast",
605                        "spec_testsuite/simd_f32x4_cmp.wast",
606                        "spec_testsuite/simd_f32x4_pmin_pmax.wast",
607                        "spec_testsuite/simd_f32x4_rounding.wast",
608                        "spec_testsuite/simd_f64x2.wast",
609                        "spec_testsuite/simd_f64x2_arith.wast",
610                        "spec_testsuite/simd_f64x2_cmp.wast",
611                        "spec_testsuite/simd_f64x2_pmin_pmax.wast",
612                        "spec_testsuite/simd_f64x2_rounding.wast",
613                        "spec_testsuite/simd_i16x8_cmp.wast",
614                        "spec_testsuite/simd_i32x4_cmp.wast",
615                        "spec_testsuite/simd_i64x2_arith2.wast",
616                        "spec_testsuite/simd_i64x2_cmp.wast",
617                        "spec_testsuite/simd_i8x16_arith2.wast",
618                        "spec_testsuite/simd_i8x16_cmp.wast",
619                        "spec_testsuite/simd_int_to_int_extend.wast",
620                        "spec_testsuite/simd_load.wast",
621                        "spec_testsuite/simd_load_extend.wast",
622                        "spec_testsuite/simd_load_splat.wast",
623                        "spec_testsuite/simd_load_zero.wast",
624                        "spec_testsuite/simd_splat.wast",
625                        "spec_testsuite/simd_store16_lane.wast",
626                        "spec_testsuite/simd_store32_lane.wast",
627                        "spec_testsuite/simd_store64_lane.wast",
628                        "spec_testsuite/simd_store8_lane.wast",
629                        "spec_testsuite/simd_load16_lane.wast",
630                        "spec_testsuite/simd_load32_lane.wast",
631                        "spec_testsuite/simd_load64_lane.wast",
632                        "spec_testsuite/simd_load8_lane.wast",
633                        "spec_testsuite/simd_bitwise.wast",
634                        "misc_testsuite/simd/load_splat_out_of_bounds.wast",
635                        "misc_testsuite/simd/unaligned-load.wast",
636                        "multi-memory/simd_memory-multi.wast",
637                        "misc_testsuite/simd/issue4807.wast",
638                        "spec_testsuite/simd_const.wast",
639                        "spec_testsuite/simd_i8x16_sat_arith.wast",
640                        "spec_testsuite/simd_i64x2_arith.wast",
641                        "spec_testsuite/simd_i16x8_arith.wast",
642                        "spec_testsuite/simd_i16x8_arith2.wast",
643                        "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
644                        "spec_testsuite/simd_i16x8_sat_arith.wast",
645                        "spec_testsuite/simd_i32x4_arith.wast",
646                        "spec_testsuite/simd_i32x4_dot_i16x8.wast",
647                        "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
648                        "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
649                        "spec_testsuite/simd_i8x16_arith.wast",
650                        "spec_testsuite/simd_bit_shift.wast",
651                        "spec_testsuite/simd_lane.wast",
652                        "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
653                        "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
654                        "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
655                        "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
656                        "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
657                        "spec_testsuite/simd_i32x4_arith2.wast",
658                    ];
659
660                    if unsupported.iter().any(|part| self.path.ends_with(part)) {
661                        return true;
662                    }
663                }
664            }
665        }
666
667        let failing_component_model_tests = [
668            // FIXME(#11683)
669            "component-model/test/values/trap-in-post-return.wast",
670            // Awaiting https://github.com/WebAssembly/component-model/pull/570
671            "component-model/test/resources/multiple-resources.wast",
672            "component-model/test/async/empty-wait.wast",
673            "component-model/test/async/drop-stream.wast",
674            "component-model/test/async/passing-resources.wast",
675            "component-model/test/async/async-calls-sync.wast",
676            "component-model/test/async/partial-stream-copies.wast",
677            "component-model/test/async/futures-must-write.wast",
678            "component-model/test/async/cancel-stream.wast",
679            "component-model/test/async/drop-waitable-set.wast",
680        ];
681        if failing_component_model_tests
682            .iter()
683            .any(|part| self.path.ends_with(part))
684        {
685            return true;
686        }
687
688        // Not implemented in Wasmtime anywhere yet.
689        if self.config.custom_descriptors() {
690            let happens_to_work =
691                ["spec_testsuite/proposals/custom-descriptors/binary-leb128.wast"];
692
693            if happens_to_work.iter().any(|part| self.path.ends_with(part)) {
694                return false;
695            }
696            return true;
697        }
698
699        false
700    }
701}
702
703fn spec_proposal_from_path(path: &Path) -> Option<&str> {
704    let mut iter = path.iter();
705    loop {
706        match iter.next()?.to_str()? {
707            "proposals" => break,
708            _ => {}
709        }
710    }
711    Some(iter.next()?.to_str()?)
712}