Repository navigation
Commit 4eeee5d
committed
test(codec): ignore the zstd encoder tests on wasm32 rather than abort the suite
`nodedb-codec` gates its codec by target already: C libzstd off wasm, ruzstd on
it (`Cargo.toml:31-36`), and `compress_native`'s wasm arm is an explicit stub
returning `CompressFailed` (`src/zstd_codec.rs:312-320`). The eight tests that call
`encode`/`encode_with_level` therefore panic, and on
`wasm32-wasip1` a panic aborts the process: the binary dies at the first one and
reports nothing after it.
The stub is a design choice rather than a missing dependency: ruzstd 0.9 ships an
encoder (`ruzstd::encoding`) this crate has not adopted, and the C library would
need a C-to-WASM toolchain. Wiring up either one changes what the wasm build does
and is a change of its own; this commit only stops the absent encoder from killing
the suite. No fallback exists in this crate — `pipeline` propagates
`CompressFailed` for `ColumnCodec::Zstd`. The stub's own comments said it was a
fallback that encodes "a minimal Zstd frame", which it never did; they now describe
the stub.
They are gated with `#[cfg_attr(target_arch = "wasm32", ignore = "…")]` rather
than `#[cfg(not(target_arch = "wasm32"))]`. The attribute keeps them compiled and
listed by `--list` on that target, so the gap is visible in the run instead of
absent from it, and they keep running natively.
Red arm, with the four tests other changes own skipped:
$ cargo test --profile ci --target wasm32-wasip1 -p nodedb-codec -- <4 skips>
test zstd_codec::tests::better_ratio_than_lz4 ... Error: failed to run main module
exit 134
Green arm, same command:
test result: ok. 252 passed; 0 failed; 8 ignored; 0 measured; 4 filtered out
Each ignored test prints its reason:
test zstd_codec::tests::empty_data ... ignored, nodedb-codec has no wasm encoder: encode() returns CompressFailed
Native is unchanged at 263 passed, 0 failed, 0 ignored. The module's other four
tests stay live on both targets: three are decode-side, and
`streaming_input_limit_precedes_buffer_growth` drives the encoder's declared-limit
check, which rejects before any encoder work.
Why an in-source ignore and not a `--skip` list in the consumer: the gap is
categorical — the target has no encoder at all, not a threshold that moves — and
a named skip in someone else's workflow records it as a number rather than as a
property of this crate.
fmt clean; clippy clean for this crate on native and on `wasm32-wasip1`.1 parent 1ff3551 commit 4eeee5d
1 file changed
Lines changed: 44 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
316 | | - | |
| 314 | + | |
| 315 | + | |
317 | 316 | | |
318 | 317 | | |
319 | 318 | | |
| |||
431 | 430 | | |
432 | 431 | | |
433 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
434 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
435 | 443 | | |
436 | 444 | | |
437 | 445 | | |
438 | 446 | | |
439 | 447 | | |
440 | 448 | | |
441 | 449 | | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
442 | 454 | | |
443 | 455 | | |
444 | 456 | | |
| |||
447 | 459 | | |
448 | 460 | | |
449 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
450 | 466 | | |
451 | 467 | | |
452 | 468 | | |
| |||
462 | 478 | | |
463 | 479 | | |
464 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
465 | 485 | | |
466 | 486 | | |
467 | 487 | | |
| |||
476 | 496 | | |
477 | 497 | | |
478 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
479 | 503 | | |
480 | 504 | | |
481 | 505 | | |
| |||
485 | 509 | | |
486 | 510 | | |
487 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
488 | 516 | | |
489 | 517 | | |
490 | 518 | | |
| |||
552 | 580 | | |
553 | 581 | | |
554 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
555 | 587 | | |
556 | 588 | | |
557 | 589 | | |
| |||
585 | 617 | | |
586 | 618 | | |
587 | 619 | | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
588 | 624 | | |
589 | 625 | | |
590 | 626 | | |
| |||
0 commit comments