Browse Source

Fix running wasi-common tests on CI (#8353)

* Fix running wasi-common tests on CI

Turns out we haven't been running wasi-common tests for some time in CI
and they've started failing. Force enable the test at all times and then
fix the test failures. The test failures here were introduced in #8277
and weren't caught due to the test not running and the fix was to relax
the implementation of `fd_pread` to avoid taking multiple mutable
borrows.

* Fix CI
pull/8356/head
Alex Crichton 7 months ago
committed by GitHub
parent
commit
1a7c006a98
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      Cargo.lock
  2. 2
      crates/wasi-common/Cargo.toml
  3. 10
      crates/wasi-common/src/snapshots/preview_1.rs

1
Cargo.lock

@ -3162,6 +3162,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-subscriber",
"wasi-common",
"wasmtime",
"wiggle",
"windows-sys 0.52.0",

2
crates/wasi-common/Cargo.toml

@ -54,6 +54,7 @@ features = [
]
[dev-dependencies]
wasi-common = { path = '.', features = ['tokio'] }
tempfile = { workspace = true }
test-log = { workspace = true }
tracing-subscriber = { workspace = true }
@ -98,4 +99,3 @@ all-features = true
[[test]]
name = "all"
required-features = ["wasmtime", "sync", "tokio"]

10
crates/wasi-common/src/snapshots/preview_1.rs

@ -417,13 +417,15 @@ impl wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
return Ok(0);
}
} else {
// Convert all of the unsafe guest slices to safe ones--this uses
// Wiggle's internal borrow checker to ensure no overlaps. We assume
// here that, because the memory is not shared, there are no other
// threads to access it while it is written to.
// Convert unsafe guest slices to safe ones -- this uses Wiggle's
// internal borrow checker to ensure no overlaps. Note that borrow
// checking is coarse at this time so at most one non-empty slice is
// chosen.
let mut guest_slices: Vec<wiggle::GuestSliceMut<u8>> = iovs
.into_iter()
.filter(|iov| iov.len() > 0)
.map(|iov| Ok(iov.as_slice_mut()?.unwrap()))
.take(1)
.collect::<Result<_, Error>>()?;
// Read directly into the Wasm memory.

Loading…
Cancel
Save