next.js
49ca5ddd - Run the temp-dir-only wasm tests, and name the real cause for the rest

Commit
3 hours ago
Run the temp-dir-only wasm tests, and name the real cause for the rest `std::env::temp_dir()` is hard-unsupported on WASI: it panics at `std/sys/paths/wasi.rs` with "not supported by WASI yet" regardless of `TMPDIR`. `tempfile::tempdir()` asks it where to put the directory, so every test using it aborted, and 11 attributes (15 instances) in turbo-tasks-backend were ignored on wasm because of it. The filesystem itself is fine — a WASI guest reaches whatever the host preopens, and the test host preopens the working directory as `/`. So a shared `test_temp_dir()` helper creates the directory *inside* a preopened path on wasm and keeps `tempfile::tempdir()` on native. One cfg site, 11 call sites, cleanup still owned by `TempDir`. That re-enables the 12 `db_versioning` instances, which only manipulate directories. It also let the 3 `kv_backing_storage` instances get further and hit a second, real platform gap that the temp-dir panic had been masking: Error: Unable to open meta file 00000002.meta Caused by: 0: Failed to mmap 1: platform not supported `memmap2` ships `unix.rs`, `windows.rs` and a stub for everything else (`memmap2/src/stub.rs`), so `turbo-persistence` cannot open a database on WASI at all. Those 3 keep an ignore, but now with the cause that is actually true instead of one that isn't. An mmap-free read path is real product work and is left as a follow-up. Also sharpens the 12 `no unwinding on wasm` reasons to say *why* they are permanent — std for this target is built `panic = abort`, so `catch_unwind` can never catch. Verified: `-C panic=unwind` fails to link with "the crate `panic_unwind` does not have the panic strategy `unwind`", so this is not a to-do. turbo-tasks-backend on wasm goes from 15 ignored to 3; across the stack, 31 ignored instances become 19. Every remaining one names a platform limit traceable to a specific file. Includes one unrelated-but-required fix: `storage_schema.rs` imports `std::mem::size_of` whose only use is inside a `#[cfg(target_pointer_width = "64")]` test, so wasm saw an unused import and `-D warnings` failed. The import is now gated the same way as its use. The single `Cargo.lock` line is cargo-generated from the parent layer and reappears on every build; committing it keeps the tree clean. Verified: db_versioning wasm 12 passed/0 ignored; kv_backing_storage wasm 3 ignored/0 failed; backend native 99 passed/0 ignored; instance counts unchanged (wasm 98, native 99); next-napi-bindings host+wasm 0 errors; fmt and clippy -D warnings clean on host and wasm. Co-authored-by: Luke Sandberg <210140+lukesandberg@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Parents
Loading