From 94f0c9359dc1b8ccd73bf58812bec9e78fb52073 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 05:54:02 -0300 Subject: Every EINVAL or ENOENT refusal a unit test meets must say its errno in words a 9ns mount maps back: pardes re-pins cloud9, whose fs.enameErrno knows acme's address and argument refusals The tests' request helper asks cloud9's fs.enameErrno, the rules 9ns turns a refusal's words back into an errno with, for every EINVAL and ENOENT a request is refused with, and fails the test when a mount would hear another (EIO, mostly): "this pane has no text to address" was one. The re-pinned cloud9 maps acme's own refusals, which pardes keeps in acme's words: no match for regexp, address out of range, addresses out of order, range past end of body and the rest. Co-Authored-By: Claude Opus 5.5 --- src/ninep/testing.zig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ninep/testing.zig') diff --git a/src/ninep/testing.zig b/src/ninep/testing.zig index b8eaa02b..a35a9cf0 100644 --- a/src/ninep/testing.zig +++ b/src/ninep/testing.zig @@ -3,6 +3,7 @@ const std = @import("std"); const pardes = @import("../pardes.zig"); const tree = @import("tree.zig"); +const cloud9 = @import("cloud9"); const Pardes = pardes.Pardes; pub const Req = tree.Req; @@ -33,6 +34,13 @@ pub const Answer = struct { pub fn call(p: *Pardes, req: Req) Answer { var ans: Answer = .{}; ans.reply = p.serveFs(req); + // An EINVAL or ENOENT refusal says so in words a 9ns mount maps back + // to it (cloud9's enameErrno), or a shell through the mount hears EIO. + const said = ans.reply; + if (said.status == .err and said.ename.len > 0 and (said.errno == E.INVAL or said.errno == E.NOENT) and cloud9.fs.enameErrno(said.ename) != said.errno) { + std.debug.print("a mount reads this refusal as errno {d}, not {d}: \"{s}\"\n", .{ cloud9.fs.enameErrno(said.ename), said.errno, said.ename }); + @panic("a refusal's words do not say its errno"); + } ans.bytes = p.fsPayload(ans.reply); while (p.nextEffect()) |e| switch (e) { .save_file, .save_text => ans.saved = true, -- cgit v1.3