1use serde::de::DeserializeOwned;
2use serde_derive::Deserialize;
3use std::fmt;
4use std::fs;
5use std::path::Path;
6use std::path::PathBuf;
7use wasmtime_environ::prelude::*;
8
9pub mod limits {
19 pub const MEMORY_SIZE: usize = 805 << 16;
20 pub const MEMORIES: u32 = 450;
21 pub const GC_HEAP_SIZE: usize = 10 << 16;
22 pub const TABLES: u32 = 200;
23 pub const MEMORIES_PER_MODULE: u32 = 9;
24 pub const TABLES_PER_MODULE: u32 = 5;
25 pub const COMPONENT_INSTANCES: u32 = 50;
26 pub const CORE_INSTANCES: u32 = 900;
27 pub const TABLE_ELEMENTS: usize = 1000;
28 pub const CORE_INSTANCE_SIZE: usize = 64 * 1024;
29 pub const TOTAL_STACKS: u32 = 20;
30}
31
32pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
35 let mut tests = Vec::new();
36
37 let spec_tests = root.join("tests/spec_testsuite");
38 add_tests(
39 &mut tests,
40 &spec_tests,
41 &FindConfig::Infer(spec_test_config),
42 )
43 .context("Do you need to `git submodule update --init`?")
44 .with_context(|| format!("failed to add tests from `{}`", spec_tests.display()))?;
45
46 let misc_tests = root.join("tests/misc_testsuite");
47 add_tests(&mut tests, &misc_tests, &FindConfig::InTest)
48 .with_context(|| format!("failed to add tests from `{}`", misc_tests.display()))?;
49
50 let cm_tests = root.join("tests/component-model/test");
51 add_tests(
52 &mut tests,
53 &cm_tests,
54 &FindConfig::Infer(component_test_config),
55 )
56 .context("Do you need to `git submodule update --init`?")
57 .with_context(|| format!("failed to add tests from `{}`", cm_tests.display()))?;
58
59 {
62 let skip_list = &[
63 ];
65 tests.retain(|test| {
66 test.path
67 .file_name()
68 .and_then(|name| name.to_str())
69 .map(|name| !skip_list.contains(&name))
70 .unwrap_or(true)
71 });
72 }
73
74 Ok(tests)
75}
76
77enum FindConfig {
78 InTest,
79 Infer(fn(&Path) -> TestConfig),
80}
81
82fn add_tests(tests: &mut Vec<WastTest>, path: &Path, config: &FindConfig) -> Result<()> {
83 for entry in path.read_dir().context("failed to read directory")? {
84 let entry = entry.context("failed to read directory entry")?;
85 let path = entry.path();
86 if entry
87 .file_type()
88 .context("failed to get file type")?
89 .is_dir()
90 {
91 add_tests(tests, &path, config).context("failed to read sub-directory")?;
92 continue;
93 }
94
95 if path.extension().and_then(|s| s.to_str()) != Some("wast") {
96 continue;
97 }
98
99 if path.ends_with("spec_testsuite/custom/custom_annot.wast")
102 || path.ends_with("spec_testsuite/custom/branch_hint.wast")
103 || path.ends_with("spec_testsuite/custom/name_annot.wast")
104 {
105 continue;
106 }
107
108 let contents =
109 fs::read_to_string(&path).with_context(|| format!("failed to read test: {path:?}"))?;
110 let config = match config {
111 FindConfig::InTest => parse_test_config(&contents, ";;!")
112 .with_context(|| format!("failed to parse test configuration: {path:?}"))?,
113 FindConfig::Infer(f) => f(&path),
114 };
115 tests.push(WastTest {
116 path,
117 contents,
118 config,
119 })
120 }
121 Ok(())
122}
123
124fn spec_test_config(test: &Path) -> TestConfig {
125 let mut ret = TestConfig::default();
126 ret.spec_test = Some(true);
127 ret.bulk_memory = Some(true);
128 match spec_proposal_from_path(test) {
129 Some("wide-arithmetic") => {
130 ret.wide_arithmetic = Some(true);
131 }
132 Some("threads") => {
133 ret.threads = Some(true);
134 ret.reference_types = Some(false);
135 }
136 Some("custom-page-sizes") => {
137 ret.custom_page_sizes = Some(true);
138 ret.multi_memory = Some(true);
139 ret.memory64 = Some(true);
140 ret.reference_types = Some(true);
141
142 if test.ends_with("memory_max.wast") || test.ends_with("memory_max_i64.wast") {
145 ret.hogs_memory = Some(true);
146 }
147 }
148 Some("custom-descriptors") => {
149 ret.custom_descriptors = Some(true);
150 }
151 Some(proposal) => panic!("unsupported proposal {proposal:?}"),
152 None => {
153 ret.reference_types = Some(true);
154 ret.simd = Some(true);
155 ret.simd = Some(true);
156 ret.relaxed_simd = Some(true);
157 ret.multi_memory = Some(true);
158 ret.gc = Some(true);
159 ret.reference_types = Some(true);
160 ret.memory64 = Some(true);
161 ret.tail_call = Some(true);
162 ret.extended_const = Some(true);
163 ret.exceptions = Some(true);
164
165 if test.parent().unwrap().ends_with("legacy") {
166 ret.legacy_exceptions = Some(true);
167 }
168
169 if test.ends_with("memory.wast")
178 || test.ends_with("table.wast")
179 || test.ends_with("memory64.wast")
180 || test.ends_with("table64.wast")
181 {
182 ret.hogs_memory = Some(true);
183 }
184 }
185 }
186
187 ret
188}
189
190fn component_test_config(test: &Path) -> TestConfig {
191 let mut ret = TestConfig::default();
192 ret.spec_test = Some(true);
193 ret.reference_types = Some(true);
194 ret.multi_memory = Some(true);
195 ret.component_model_implements = Some(true);
196
197 if let Some(parent) = test.parent() {
198 if parent.ends_with("async")
199 || [
200 "trap-in-post-return.wast",
201 "resources.wast",
202 "multiple-resources.wast",
203 ]
204 .into_iter()
205 .any(|name| Some(name) == test.file_name().and_then(|s| s.to_str()))
206 {
207 ret.component_model_async = Some(true);
208 ret.component_model_async_stackful = Some(true);
209 ret.component_model_more_async_builtins = Some(true);
210 ret.component_model_threading = Some(true);
211 }
212 if parent.ends_with("wasm-tools") {
213 ret.memory64 = Some(true);
214 ret.threads = Some(true);
215 ret.exceptions = Some(true);
216 ret.gc = Some(true);
217 }
218 if parent.ends_with("wasmtime") {
219 ret.exceptions = Some(true);
220 ret.gc = Some(true);
221 }
222 }
223
224 ret
225}
226
227pub fn parse_test_config<T>(wat: &str, comment: &'static str) -> Result<T>
230where
231 T: DeserializeOwned,
232{
233 let config_lines: Vec<_> = wat
236 .lines()
237 .take_while(|l| l.starts_with(comment))
238 .map(|l| &l[comment.len()..])
239 .collect();
240 let config_text = config_lines.join("\n");
241
242 toml::from_str(&config_text).context("failed to parse the test configuration")
243}
244
245#[derive(Clone)]
247pub struct WastTest {
248 pub path: PathBuf,
249 pub contents: String,
250 pub config: TestConfig,
251}
252
253impl fmt::Debug for WastTest {
254 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
255 f.debug_struct("WastTest")
256 .field("path", &self.path)
257 .field("contents", &"...")
258 .field("config", &self.config)
259 .finish()
260 }
261}
262
263macro_rules! foreach_config_option {
264 ($m:ident) => {
265 $m! {
266 bulk_memory
267 memory64
268 custom_page_sizes
269 multi_memory
270 threads
271 shared_everything_threads
272 gc
273 function_references
274 relaxed_simd
275 reference_types
276 tail_call
277 extended_const
278 wide_arithmetic
279 branch_hinting
280 hogs_memory
281 nan_canonicalization
282 component_model_async
283 component_model_more_async_builtins
284 component_model_async_stackful
285 component_model_threading
286 component_model_error_context
287 component_model_gc
288 component_model_map
289 component_model_fixed_length_lists
290 component_model_implements
291 simd
292 gc_types
293 exceptions
294 legacy_exceptions
295 stack_switching
296 spec_test
297 custom_descriptors
298 }
299 };
300}
301
302macro_rules! define_test_config {
303 ($($option:ident)*) => {
304 #[derive(Debug, PartialEq, Default, Deserialize, Clone)]
307 #[serde(deny_unknown_fields)]
308 pub struct TestConfig {
309 $(pub $option: Option<bool>,)*
310 }
311
312 impl TestConfig {
313 $(
314 pub fn $option(&self) -> bool {
315 self.$option.unwrap_or(false)
316 }
317 )*
318 }
319 }
320}
321
322foreach_config_option!(define_test_config);
323
324impl TestConfig {
325 pub fn options_mut(&mut self) -> impl Iterator<Item = (&'static str, &mut Option<bool>)> {
327 macro_rules! mk {
328 ($($option:ident)*) => {
329 [
330 $((stringify!($option), &mut self.$option),)*
331 ].into_iter()
332 }
333 }
334 foreach_config_option!(mk)
335 }
336}
337
338#[derive(Debug)]
340pub struct WastConfig {
341 pub compiler: Compiler,
343 pub pooling: bool,
345 pub collector: Collector,
347}
348
349#[derive(PartialEq, Debug, Copy, Clone)]
351pub enum Compiler {
352 CraneliftNative,
359
360 Winch,
365
366 CraneliftPulley,
373}
374
375impl Compiler {
376 pub fn should_fail(&self, config: &TestConfig) -> bool {
387 match self {
388 Compiler::CraneliftNative => {
389 if config.legacy_exceptions() {
390 return true;
391 }
392
393 if config.stack_switching() && !(cfg!(target_arch = "x86_64") && cfg!(unix)) {
396 return true;
397 }
398
399 false
400 }
401
402 Compiler::Winch => {
403 if config.gc()
404 || config.tail_call()
405 || config.function_references()
406 || config.gc()
407 || config.relaxed_simd()
408 || config.gc_types()
409 || config.exceptions()
410 || config.legacy_exceptions()
411 || config.stack_switching()
412 || config.legacy_exceptions()
413 || config.component_model_async()
414 {
415 return true;
416 }
417
418 if cfg!(target_arch = "aarch64") {
419 return (config.simd() && !config.spec_test()) || config.threads();
420 }
421
422 !cfg!(target_arch = "x86_64")
423 }
424
425 Compiler::CraneliftPulley => {
426 config.threads() || config.legacy_exceptions() || config.stack_switching()
427 }
428 }
429 }
430
431 pub fn supports_host(&self) -> bool {
434 match self {
435 Compiler::CraneliftNative => {
436 cfg!(target_arch = "x86_64")
437 || cfg!(target_arch = "aarch64")
438 || cfg!(target_arch = "riscv64")
439 || cfg!(target_arch = "s390x")
440 }
441 Compiler::Winch => cfg!(target_arch = "x86_64") || cfg!(target_arch = "aarch64"),
442 Compiler::CraneliftPulley => true,
443 }
444 }
445}
446
447#[derive(PartialEq, Debug, Copy, Clone)]
448pub enum Collector {
449 Auto,
450 Null,
451 DeferredReferenceCounting,
452 Copying,
453}
454
455impl WastTest {
456 pub fn test_uses_gc_types(&self) -> bool {
459 self.config.gc() || self.config.function_references()
460 }
461
462 pub fn spec_proposal(&self) -> Option<&str> {
464 spec_proposal_from_path(&self.path)
465 }
466
467 pub fn should_fail(&self, config: &WastConfig) -> bool {
470 if !config.compiler.supports_host() {
471 return true;
472 }
473
474 let unsupported = [
475 "test/wasm-tools/memory64.wast",
478 ];
479 if unsupported.iter().any(|part| self.path.ends_with(part)) {
480 return true;
481 }
482
483 if config.pooling {
485 if self.config.hogs_memory() {
487 return true;
488 }
489 let unsupported = [
490 "misc_testsuite/memory-combos.wast",
492 "misc_testsuite/threads/atomics-end-of-memory.wast",
493 "misc_testsuite/threads/LB.wast",
494 "misc_testsuite/threads/LB_atomic.wast",
495 "misc_testsuite/threads/MP.wast",
496 "misc_testsuite/threads/MP_atomic.wast",
497 "misc_testsuite/threads/MP_wait.wast",
498 "misc_testsuite/threads/SB.wast",
499 "misc_testsuite/threads/SB_atomic.wast",
500 "misc_testsuite/threads/atomics_notify.wast",
501 "misc_testsuite/threads/atomics_wait_address.wast",
502 "misc_testsuite/threads/wait_notify.wast",
503 "spec_testsuite/proposals/threads/atomic.wast",
504 "spec_testsuite/proposals/threads/exports.wast",
505 "spec_testsuite/proposals/threads/memory.wast",
506 "misc_testsuite/memory64/threads.wast",
507 "misc_testsuite/winch/rmw32_cmpxchg_u_wrap.wast",
508 ];
509
510 if unsupported.iter().any(|part| self.path.ends_with(part)) {
511 return true;
512 }
513 }
514
515 if config.compiler.should_fail(&self.config) {
516 return true;
517 }
518
519 if config.compiler == Compiler::Winch {
521 let unsupported = [
523 "extended-const/elem.wast",
524 "extended-const/global.wast",
525 "misc_testsuite/component-model/modules.wast",
526 "misc_testsuite/externref-id-function.wast",
527 "misc_testsuite/externref-segment.wast",
528 "misc_testsuite/externref-segments.wast",
529 "misc_testsuite/externref-table-dropped-segment-issue-8281.wast",
530 "misc_testsuite/linking-errors.wast",
531 "misc_testsuite/many_table_gets_lead_to_gc.wast",
532 "misc_testsuite/mutable_externref_globals.wast",
533 "misc_testsuite/no-mixup-stack-maps.wast",
534 "misc_testsuite/no-panic.wast",
535 "misc_testsuite/simple_ref_is_null.wast",
536 ];
537
538 if unsupported.iter().any(|part| self.path.ends_with(part)) {
539 return true;
540 }
541
542 #[cfg(target_arch = "aarch64")]
543 {
544 let unsupported = [
545 "misc_testsuite/int-to-float-splat.wast",
546 "misc_testsuite/issue6562.wast",
547 "misc_testsuite/memory64/simd.wast",
548 "misc_testsuite/simd/almost-extmul.wast",
549 "misc_testsuite/simd/canonicalize-nan.wast",
550 "misc_testsuite/simd/cvt-from-uint.wast",
551 "misc_testsuite/simd/edge-of-memory.wast",
552 "misc_testsuite/simd/interesting-float-splat.wast",
553 "misc_testsuite/simd/issue4807.wast",
554 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
555 "misc_testsuite/simd/issue_3173_select_v128.wast",
556 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
557 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
558 "misc_testsuite/simd/replace-lane-preserve.wast",
559 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
560 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
561 "misc_testsuite/simd/unaligned-load.wast",
562 "misc_testsuite/simd/v128-select.wast",
563 "misc_testsuite/winch/issue-10331.wast",
564 "misc_testsuite/winch/issue-10357.wast",
565 "misc_testsuite/winch/issue-10460.wast",
566 "misc_testsuite/winch/replace_lane.wast",
567 "misc_testsuite/winch/simd_multivalue.wast",
568 "misc_testsuite/winch/v128_load_lane_invalid_address.wast",
569 "spec_testsuite/proposals/annotations/simd_lane.wast",
570 "spec_testsuite/proposals/multi-memory/simd_memory-multi.wast",
571 "spec_testsuite/simd_address.wast",
572 "spec_testsuite/simd_align.wast",
573 "spec_testsuite/simd_bit_shift.wast",
574 "spec_testsuite/simd_bitwise.wast",
575 "spec_testsuite/simd_boolean.wast",
576 "spec_testsuite/simd_const.wast",
577 "spec_testsuite/simd_conversions.wast",
578 "spec_testsuite/simd_f32x4.wast",
579 "spec_testsuite/simd_f32x4_arith.wast",
580 "spec_testsuite/simd_f32x4_cmp.wast",
581 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
582 "spec_testsuite/simd_f32x4_rounding.wast",
583 "spec_testsuite/simd_f64x2.wast",
584 "spec_testsuite/simd_f64x2_arith.wast",
585 "spec_testsuite/simd_f64x2_cmp.wast",
586 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
587 "spec_testsuite/simd_f64x2_rounding.wast",
588 "spec_testsuite/simd_i16x8_arith.wast",
589 "spec_testsuite/simd_i16x8_arith2.wast",
590 "spec_testsuite/simd_i16x8_cmp.wast",
591 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
592 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
593 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
594 "spec_testsuite/simd_i16x8_sat_arith.wast",
595 "spec_testsuite/simd_i32x4_arith.wast",
596 "spec_testsuite/simd_i32x4_arith2.wast",
597 "spec_testsuite/simd_i32x4_cmp.wast",
598 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
599 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
600 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
601 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
602 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
603 "spec_testsuite/simd_i64x2_arith.wast",
604 "spec_testsuite/simd_i64x2_arith2.wast",
605 "spec_testsuite/simd_i64x2_cmp.wast",
606 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
607 "spec_testsuite/simd_i8x16_arith.wast",
608 "spec_testsuite/simd_i8x16_arith2.wast",
609 "spec_testsuite/simd_i8x16_cmp.wast",
610 "spec_testsuite/simd_i8x16_sat_arith.wast",
611 "spec_testsuite/simd_int_to_int_extend.wast",
612 "spec_testsuite/simd_lane.wast",
613 "spec_testsuite/simd_load.wast",
614 "spec_testsuite/simd_load16_lane.wast",
615 "spec_testsuite/simd_load32_lane.wast",
616 "spec_testsuite/simd_load64_lane.wast",
617 "spec_testsuite/simd_load8_lane.wast",
618 "spec_testsuite/simd_load_extend.wast",
619 "spec_testsuite/simd_load_splat.wast",
620 "spec_testsuite/simd_load_zero.wast",
621 "spec_testsuite/simd_select.wast",
622 "spec_testsuite/simd_splat.wast",
623 "spec_testsuite/simd_store.wast",
624 "spec_testsuite/simd_store16_lane.wast",
625 "spec_testsuite/simd_store32_lane.wast",
626 "spec_testsuite/simd_store64_lane.wast",
627 "spec_testsuite/simd_store8_lane.wast",
628 ];
629
630 if unsupported.iter().any(|part| self.path.ends_with(part)) {
631 return true;
632 }
633 }
634
635 #[cfg(target_arch = "x86_64")]
636 {
637 #[cfg(target_arch = "x86_64")]
639 if !(std::is_x86_feature_detected!("avx") && std::is_x86_feature_detected!("avx2"))
640 {
641 let unsupported = [
642 "annotations/simd_lane.wast",
643 "memory64/simd.wast",
644 "misc_testsuite/int-to-float-splat.wast",
645 "misc_testsuite/issue6562.wast",
646 "misc_testsuite/simd/almost-extmul.wast",
647 "misc_testsuite/simd/canonicalize-nan.wast",
648 "misc_testsuite/simd/cvt-from-uint.wast",
649 "misc_testsuite/simd/edge-of-memory.wast",
650 "misc_testsuite/simd/issue_3327_bnot_lowering.wast",
651 "misc_testsuite/simd/issue6725-no-egraph-panic.wast",
652 "misc_testsuite/simd/replace-lane-preserve.wast",
653 "misc_testsuite/simd/spillslot-size-fuzzbug.wast",
654 "misc_testsuite/simd/sse-cannot-fold-unaligned-loads.wast",
655 "misc_testsuite/winch/issue-10331.wast",
656 "misc_testsuite/winch/replace_lane.wast",
657 "misc_testsuite/simd/riscv64-replicated-imm5-works.wast",
658 "misc_testsuite/simd/v128-equal.wast",
659 "spec_testsuite/simd_align.wast",
660 "spec_testsuite/simd_boolean.wast",
661 "spec_testsuite/simd_conversions.wast",
662 "spec_testsuite/simd_f32x4.wast",
663 "spec_testsuite/simd_f32x4_arith.wast",
664 "spec_testsuite/simd_f32x4_cmp.wast",
665 "spec_testsuite/simd_f32x4_pmin_pmax.wast",
666 "spec_testsuite/simd_f32x4_rounding.wast",
667 "spec_testsuite/simd_f64x2.wast",
668 "spec_testsuite/simd_f64x2_arith.wast",
669 "spec_testsuite/simd_f64x2_cmp.wast",
670 "spec_testsuite/simd_f64x2_pmin_pmax.wast",
671 "spec_testsuite/simd_f64x2_rounding.wast",
672 "spec_testsuite/simd_i16x8_cmp.wast",
673 "spec_testsuite/simd_i32x4_cmp.wast",
674 "spec_testsuite/simd_i64x2_arith2.wast",
675 "spec_testsuite/simd_i64x2_cmp.wast",
676 "spec_testsuite/simd_i8x16_arith2.wast",
677 "spec_testsuite/simd_i8x16_cmp.wast",
678 "spec_testsuite/simd_int_to_int_extend.wast",
679 "spec_testsuite/simd_load.wast",
680 "spec_testsuite/simd_load_extend.wast",
681 "spec_testsuite/simd_load_splat.wast",
682 "spec_testsuite/simd_load_zero.wast",
683 "spec_testsuite/simd_splat.wast",
684 "spec_testsuite/simd_store16_lane.wast",
685 "spec_testsuite/simd_store32_lane.wast",
686 "spec_testsuite/simd_store64_lane.wast",
687 "spec_testsuite/simd_store8_lane.wast",
688 "spec_testsuite/simd_load16_lane.wast",
689 "spec_testsuite/simd_load32_lane.wast",
690 "spec_testsuite/simd_load64_lane.wast",
691 "spec_testsuite/simd_load8_lane.wast",
692 "spec_testsuite/simd_bitwise.wast",
693 "misc_testsuite/simd/load_splat_out_of_bounds.wast",
694 "misc_testsuite/simd/unaligned-load.wast",
695 "multi-memory/simd_memory-multi.wast",
696 "misc_testsuite/simd/issue4807.wast",
697 "spec_testsuite/simd_const.wast",
698 "spec_testsuite/simd_i8x16_sat_arith.wast",
699 "spec_testsuite/simd_i64x2_arith.wast",
700 "spec_testsuite/simd_i16x8_arith.wast",
701 "spec_testsuite/simd_i16x8_arith2.wast",
702 "spec_testsuite/simd_i16x8_q15mulr_sat_s.wast",
703 "spec_testsuite/simd_i16x8_sat_arith.wast",
704 "spec_testsuite/simd_i32x4_arith.wast",
705 "spec_testsuite/simd_i32x4_dot_i16x8.wast",
706 "spec_testsuite/simd_i32x4_trunc_sat_f32x4.wast",
707 "spec_testsuite/simd_i32x4_trunc_sat_f64x2.wast",
708 "spec_testsuite/simd_i8x16_arith.wast",
709 "spec_testsuite/simd_bit_shift.wast",
710 "spec_testsuite/simd_lane.wast",
711 "spec_testsuite/simd_i16x8_extmul_i8x16.wast",
712 "spec_testsuite/simd_i32x4_extmul_i16x8.wast",
713 "spec_testsuite/simd_i64x2_extmul_i32x4.wast",
714 "spec_testsuite/simd_i16x8_extadd_pairwise_i8x16.wast",
715 "spec_testsuite/simd_i32x4_extadd_pairwise_i16x8.wast",
716 "spec_testsuite/simd_i32x4_arith2.wast",
717 ];
718
719 if unsupported.iter().any(|part| self.path.ends_with(part)) {
720 return true;
721 }
722 }
723 }
724 }
725
726 if self.config.custom_descriptors() {
728 let happens_to_work =
729 ["spec_testsuite/proposals/custom-descriptors/binary-leb128.wast"];
730
731 if happens_to_work.iter().any(|part| self.path.ends_with(part)) {
732 return false;
733 }
734 return true;
735 }
736
737 false
738 }
739}
740
741fn spec_proposal_from_path(path: &Path) -> Option<&str> {
742 let mut iter = path.iter();
743 loop {
744 match iter.next()?.to_str()? {
745 "proposals" => break,
746 _ => {}
747 }
748 }
749 Some(iter.next()?.to_str()?)
750}