summaryrefslogtreecommitdiff
path: root/test/process/tree.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process/tree.zig')
-rw-r--r--test/process/tree.zig28
1 files changed, 6 insertions, 22 deletions
diff --git a/test/process/tree.zig b/test/process/tree.zig
index c7b9e657..d0a8173d 100644
--- a/test/process/tree.zig
+++ b/test/process/tree.zig
@@ -9,7 +9,6 @@ const check = process.check;
pub const cases = .{
.{ "tree: the root lists its files and not self; /os reads the disk, `..` taken as a walk takes it, and writes it truncated", rootAndOs },
.{ "tree: a client of 256-byte frames lists /os whole, a dangling link left out; one of 64 KiB is agreed", frames },
- .{ "tree: a ctl line with no newline is held whatever its write's size, and runs at the close, its failure in the log", heldLine },
.{ "tree: /screen freezes at its open; a dozen connections in turn each read a body", frozenScreen },
.{ "tree: a Look at a relative name finds the disk's file first; /n/self is the session's tree, /n/os the disk", looks },
.{ "tree: names up to 255 bytes list, read, write and open through /os and /n/os, and a directory lists them", longNames },
@@ -58,7 +57,12 @@ fn frames(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
defer small.deinit(gpa);
const names = try small.list(a, try std.fmt.allocPrint(a, "/os{s}/listing", .{d.root()}));
try check(names.len == 24, "listed {d}: {any}", .{ names.len, names });
- for (names) |n| try check(std.mem.startsWith(u8, n, "entry-"), "listed {s}", .{n});
+ for (0..24) |i| {
+ const want = try std.fmt.allocPrint(a, "entry-{d:0>2}", .{i});
+ for (names) |n| {
+ if (std.mem.eql(u8, n, want)) break;
+ } else return error.NotListed;
+ }
const big = try Conn.dial(gpa, d.socket());
defer big.deinit(gpa);
try std.testing.expectEqual(@as(u32, 65536), big.msizeAgreed());
@@ -66,26 +70,6 @@ fn frames(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
extern "c" fn symlink(target: [*:0]const u8, path: [*:0]const u8) c_int;
-fn heldLine(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- var arena = std.heap.ArenaAllocator.init(gpa);
- defer arena.deinit();
- const a = arena.allocator();
- var d = try process.Detached.start(gpa, exe, "held", .{});
- defer d.deinit();
- // 64 KiB frames: a line with no newline is held whatever the size of its
- // write (a mount cuts lines anywhere), and runs at the close.
- const c = try Conn.dial(gpa, d.socket());
- defer c.deinit(gpa);
- const ctl = try c.hold("/pane/1/ctl", 1);
- const line = try a.alloc(u8, 5 + 20000);
- @memcpy(line[0..5], "bogus");
- @memset(line[5..], 'x');
- _ = try c.writeFid(ctl, 0, line);
- try check(!has(try c.read(a, "/log"), "ctl: unknown control message"), "ran before the close", .{});
- c.clunk(ctl);
- try check(has(try c.read(a, "/log"), "ctl: unknown control message"), "never ran", .{});
-}
-
fn frozenScreen(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();