diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 05:54:02 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 07:16:43 -0300 |
| commit | 94f0c9359dc1b8ccd73bf58812bec9e78fb52073 (patch) | |
| tree | f68697ffebe65a1d7f8d5bf78bf97d8c625ff9a8 /src/ninep | |
| parent | c84834523cc53d2a46eea06ae7e26d92df0d022b (diff) | |
| download | pardes-94f0c9359dc1b8ccd73bf58812bec9e78fb52073.tar.gz pardes-94f0c9359dc1b8ccd73bf58812bec9e78fb52073.zip | |
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 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/testing.zig | 8 |
1 files changed, 8 insertions, 0 deletions
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, |
