diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/process.zig | 14 | ||||
| -rw-r--r-- | test/process/look_and_exec.zig | 4 | ||||
| -rw-r--r-- | test/process/terminals.zig | 3 |
3 files changed, 9 insertions, 12 deletions
diff --git a/test/process.zig b/test/process.zig index bba795de..ba6a84a8 100644 --- a/test/process.zig +++ b/test/process.zig @@ -621,8 +621,9 @@ pub const Detached = struct { .root = dir, .env = env[0..n], .unset = if (gui) &.{ "WAYLAND_DISPLAY", "DISPLAY" } else &.{}, - // A window runs on a terminal of its own, as one started from a shell. - .pty = if (gui) .{ .log = try std.fmt.bufPrintSentinel(&bufs[3], "{s}/{s}.pty", .{ dir, name }, 0) } else null, + // A window runs on a terminal of its own, as one started from a + // shell, the grid's size: a test window follows its terminal's. + .pty = if (gui) .{ .log = try std.fmt.bufPrintSentinel(&bufs[3], "{s}/{s}.pty", .{ dir, name }, 0), .cols = 160, .rows = 50 } else null, .err_log = try std.fmt.bufPrintSentinel(&bufs[4], "{s}/{s}.stderr", .{ dir, name }, 0), }); errdefer d.child.deinit(); @@ -793,6 +794,9 @@ pub const Child = struct { log: [:0]const u8, /// Made its controlling terminal; else a pty that is no one's. ctty: bool = true, + /// Its size: a test window follows its terminal's (gui.zig's StdinFeed). + cols: u16 = 80, + rows: u16 = 24, }; pub const Options = struct { @@ -806,7 +810,7 @@ pub const Child = struct { unset: []const [:0]const u8 = &.{}, /// Its stdin, written whole and closed; null: /dev/null. stdin: ?[]const u8 = null, - /// Started in a 24x80 pty, its stdin and stdout. + /// Started in a pty (80x24 unless it says), its stdin and stdout. pty: ?Pty = null, /// Its stderr to this file, not a pipe: a long session's, which /// nobody reads while it runs and which must never fill. `said` @@ -837,8 +841,8 @@ pub const Child = struct { @memcpy(c.err_path[0..path.len], path); c.err_path_len = path.len; } - if (opts.pty != null) { - var ws: std.posix.winsize = .{ .row = 24, .col = 80, .xpixel = 0, .ypixel = 0 }; + if (opts.pty) |p| { + var ws: std.posix.winsize = .{ .row = p.rows, .col = p.cols, .xpixel = 0, .ypixel = 0 }; if (openpty(&c.master, &c.slave, null, null, &ws) != 0) return error.NoPty; for ([_]c_int{ c.master, c.slave }) |fd| _ = libc.fcntl(fd, libc.F.SETFD, @as(c_int, 1)); // FD_CLOEXEC } diff --git a/test/process/look_and_exec.zig b/test/process/look_and_exec.zig index 83836def..5a42b844 100644 --- a/test/process/look_and_exec.zig +++ b/test/process/look_and_exec.zig @@ -63,10 +63,6 @@ const Flow = struct { }; fn canary(gpa: std.mem.Allocator, exe: [:0]const u8) !void { - // shortcut: on the window, after its terminal steps, Newcol is refused - // (or a run hangs), where a fresh window takes it; tui alone until that - // is found (docs/next-tests.md). - try process.only(.tui); const started = process.nowMs(); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); diff --git a/test/process/terminals.zig b/test/process/terminals.zig index 96804adf..250c4fb0 100644 --- a/test/process/terminals.zig +++ b/test/process/terminals.zig @@ -79,9 +79,6 @@ const Other = struct { }; fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void { - // shortcut: on the window a fresh Term's first pty/run sometimes never - // answers (4 runs of 6); tui alone until that is found (docs/next-tests.md). - try process.only(.tui); var d = try process.Detached.start(gpa, exe, "run", .{}); defer d.deinit(); const f = &d.files; |
