summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/testing.zig8
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,