sdk tests: run the wasmtime CLI without a disk cache; show its stderr on EOF

The Nix sandbox has no writable home folder, so wasmtime run failed to
create its cache folder.
This commit is contained in:
2026-10-23 09:26:12 +01:00
parent 1617dfc1ee
commit 9fb1e05686
+11 -1
View File
@@ -32,7 +32,14 @@ impl Process {
fn read(&mut self) -> Value { fn read(&mut self) -> Value {
loop { loop {
let mut s = String::new(); let mut s = String::new();
assert_ne!(self.output.read_line(&mut s).unwrap(), 0, "unexpected EOF"); if self.output.read_line(&mut s).unwrap() == 0 {
let mut stderr = String::new();
let _ = std::io::Read::read_to_string(
self.child.stderr.as_mut().unwrap(),
&mut stderr,
);
panic!("unexpected EOF from wasmtime. Its stderr:\n{stderr}");
}
if let Ok(v) = sausage_plugin::serde_json::from_str::<Value>(&s) if let Ok(v) = sausage_plugin::serde_json::from_str::<Value>(&s)
&& v["jsonrpc"] == "2.0" && v["jsonrpc"] == "2.0"
{ {
@@ -51,6 +58,9 @@ fn start(wasm: &Path, dir: &Path) -> Process {
let mut child = Command::new("wasmtime") let mut child = Command::new("wasmtime")
.args([ .args([
"run", "run",
// Without a disk cache: the Nix sandbox has no writable home folder.
"-C",
"cache=n",
"-S", "-S",
"inherit-network=y", "inherit-network=y",
"--env", "--env",