summaryrefslogtreecommitdiff
path: root/test/process
diff options
context:
space:
mode:
Diffstat (limited to 'test/process')
-rw-r--r--test/process/builtins.zig8
-rw-r--r--test/process/flags.zig32
-rw-r--r--test/process/look_and_exec.zig6
-rw-r--r--test/process/mounts.zig6
-rw-r--r--test/process/repls.zig4
-rw-r--r--test/process/root_ctl.zig12
-rw-r--r--test/process/terminals.zig20
-rw-r--r--test/process/tree.zig2
8 files changed, 46 insertions, 44 deletions
diff --git a/test/process/builtins.zig b/test/process/builtins.zig
index 410a3f54..0d8ef5d4 100644
--- a/test/process/builtins.zig
+++ b/test/process/builtins.zig
@@ -11,16 +11,16 @@ pub const cases = .{
};
fn lspinfo(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- for ([_]bool{ false, true }) |tty| {
+ for ([_]bool{ false, true }) |tui| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
- const name = if (tty) "lsp-tty" else "lsp-detached";
- var d = try process.Detached.start(gpa, exe, if (tty) "lsp-root" else name, .{});
+ const name = if (tui) "lsp-tui" else "lsp-detached";
+ var d = try process.Detached.start(gpa, exe, if (tui) "lsp-root" else name, .{});
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tty) term = try d.startTty(exe, name, &.{});
+ if (tui) term = try d.startTui(exe, name, &.{});
const address = d.abs(try std.fmt.allocPrint(a, "pardes-9p-{s}.sock", .{name}));
const c = try Conn.dial(gpa, address);
defer c.deinit(gpa);
diff --git a/test/process/flags.zig b/test/process/flags.zig
index aa5b7497..78be22f6 100644
--- a/test/process/flags.zig
+++ b/test/process/flags.zig
@@ -169,7 +169,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
.{ "/virtual/pane/1/body:1:2-4", "initial\n", .{ 1, 4 }, true },
}) |row| {
const before = try c.serials(a);
- const r = try process.run(a, &.{ exe, "--tty", row[0] }, opts);
+ const r = try process.run(a, &.{ exe, "--tui", row[0] }, opts);
try check(r.code == 0, "{s}: exit {d}: {s}", .{ row[0], r.code, r.said });
if (row[3]) {
try check(same(before, try c.serials(a)), "{s} made a pane", .{row[0]});
@@ -213,14 +213,16 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// Flags of a session's own start one, never forwarded.
const Launch = struct { []const u8, []const [:0]const u8, ?[]const u8 };
for ([_]Launch{
- .{ "mount", &.{ "--tty", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null },
- .{ "name", &.{ "--tty", "--9p=forwarded-name" }, "forwarded-name" },
- .{ "tcp", &.{ "--tty", "--9p-tcp=tcp!127.0.0.1!0" }, null },
- .{ "load", &.{ "--tty", "-l", saved }, null },
+ .{ "mount", &.{ "--tui", z(a, "--mount=peer={s}", .{address}), "/n/peer/pane/1/body" }, null },
+ .{ "name", &.{ "--tui", "--9p=forwarded-name" }, "forwarded-name" },
+ // --tty, the old spelling, which an upgraded session may pass.
+ .{ "old-flag", &.{ "--tty", "--9p=old-flag" }, "old-flag" },
+ .{ "tcp", &.{ "--tui", "--9p-tcp=tcp!127.0.0.1!0" }, null },
+ .{ "load", &.{ "--tui", "-l", saved }, null },
.{ "shells", &.{ "-n", "3" }, null },
- .{ "toggle", &.{ "--tty", "--tty-toggle=q" }, null },
- .{ "toggle-arg", &.{ "--tty", "--tty-toggle", "q" }, null },
- .{ "quic", &.{ "--tty", "--9p-quic=quic!127.0.0.1!0" }, null },
+ .{ "toggle", &.{ "--tui", "--tty-toggle=q" }, null },
+ .{ "toggle-arg", &.{ "--tui", "--tty-toggle", "q" }, null },
+ .{ "quic", &.{ "--tui", "--9p-quic=quic!127.0.0.1!0" }, null },
}) |row| {
if (std.mem.eql(u8, row[0], "quic") and !try process.quicIncluded(a, exe)) continue;
var argv: [8][:0]const u8 = undefined;
@@ -258,7 +260,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// A session that answers takes the file or says why, as acme's B does:
// a pane it has not is its refusal and exit 1, never a nested editor.
- const gone = try process.run(a, &.{ exe, "--tty", spaced }, .{ .root = d.root(), .env = &.{ inherited[0], .{ "PARDES_PANE", "4294967295" }, inherited[2] } });
+ const gone = try process.run(a, &.{ exe, "--tui", spaced }, .{ .root = d.root(), .env = &.{ inherited[0], .{ "PARDES_PANE", "4294967295" }, inherited[2] } });
try check(gone.code == 1 and std.mem.startsWith(u8, gone.said, "pardes: "), "gone pane: exit {d}: {s}", .{ gone.code, gone.said });
try std.testing.expectEqualStrings(before, try c.read(a, "/index"));
const absent = d.abs("absent.sock");
@@ -272,7 +274,7 @@ fn forwarding(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
.{ "not-nested", inherited[0..2], spaced },
}) |row| {
const existing = try process.entries(a, d.root());
- var argv: [3][:0]const u8 = .{ exe, "--tty", undefined };
+ var argv: [3][:0]const u8 = .{ exe, "--tui", undefined };
if (row[2]) |w| argv[2] = w;
var child = try Child.spawn(argv[0..if (row[2] != null) 3 else 2], .{ .root = d.root(), .env = row[1], .pty = .{ .log = d.abs(try std.fmt.allocPrint(a, "{s}.pty", .{row[0]})) } });
defer child.deinit();
@@ -653,7 +655,7 @@ fn commandBody(a: std.mem.Allocator, c: *Conn, node: []const u8) ![]const u8 {
fn outside(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// The terminal frontend's and a detached session's own: a window is neither.
- try process.only(.tty);
+ try process.only(.tui);
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
@@ -678,7 +680,7 @@ fn outside(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
}
// A launch with no terminal to draw on (a pty that is no one's
// controlling terminal) says so and exits 1, no error trace.
- var tty = try Child.spawn(&.{ exe, "--tty", "x.txt" }, .{ .root = d.root(), .pty = .{ .log = d.abs("noctty.pty"), .ctty = false } });
+ var tty = try Child.spawn(&.{ exe, "--tui", "x.txt" }, .{ .root = d.root(), .pty = .{ .log = d.abs("noctty.pty"), .ctty = false } });
defer tty.deinit();
const words = try tty.said(a);
try exitsWith(&tty, 1, 10_000);
@@ -699,7 +701,7 @@ fn socketFile(path: []const u8) !void {
fn killedTty(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// The terminal frontend's and a detached session's own: a window is neither.
- try process.only(.tty);
+ try process.only(.tui);
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
@@ -718,7 +720,7 @@ fn killedTty(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
const existing = try process.entries(a, d.root());
const log = d.abs(try std.fmt.allocPrint(a, "killed-{t}.pty", .{sig}));
// The daemon's, as a user's editor has: a hangup leaves the session.
- var killed = try Child.spawn(&.{ exe, "--tty", "x.txt" }, .{ .root = d.root(), .env = &.{.{ "PARDES_DAEMON", "on" }}, .pty = .{ .log = log } });
+ var killed = try Child.spawn(&.{ exe, "--tui", "x.txt" }, .{ .root = d.root(), .env = &.{.{ "PARDES_DAEMON", "on" }}, .pty = .{ .log = log } });
defer killed.deinit();
const deadline = process.nowMs() + 10_000;
while (!has(d.get(a, std.fs.path.basename(log)) catch "", "\x1b[?1049h")) {
@@ -763,7 +765,7 @@ fn daemonGone(d: *const process.Detached) void {
fn signalCleansUp(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// The terminal frontend's and a detached session's own: a window is neither.
- try process.only(.tty);
+ try process.only(.tui);
// A detached session told to stop by a signal unlinks its sockets. A
// hangup is a terminal's end, not a session's: the daemon keeps it.
for ([_]libc.SIG{ .TERM, .INT, .HUP }) |first| {
diff --git a/test/process/look_and_exec.zig b/test/process/look_and_exec.zig
index 8ff01054..83836def 100644
--- a/test/process/look_and_exec.zig
+++ b/test/process/look_and_exec.zig
@@ -64,9 +64,9 @@ 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; tty alone until that
+ // (or a run hangs), where a fresh window takes it; tui alone until that
// is found (docs/next-tests.md).
- try process.only(.tty);
+ try process.only(.tui);
const started = process.nowMs();
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
@@ -121,7 +121,7 @@ fn canary(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try std.testing.expectEqualStrings("from disk\n", try c.pane(a, pb, "body"));
// A terminal: pty/run failing then passing.
- const term = try f.madeBy(1, "Tty\n");
+ const term = try f.madeBy(1, "Term\n");
{
const deadline = process.nowMs() + 10_000;
while (true) {
diff --git a/test/process/mounts.zig b/test/process/mounts.zig
index 10dc7b5a..f59a7a0f 100644
--- a/test/process/mounts.zig
+++ b/test/process/mounts.zig
@@ -129,7 +129,7 @@ fn quic(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
std.debug.print("SKIP a build without QUIC (-Dquic=true)\n", .{});
return;
}
- for ([_]bool{ false, true }) |tty| for ([_][:0]const u8{ "127.0.0.1", "::1" }) |host| {
+ for ([_]bool{ false, true }) |tui| for ([_][:0]const u8{ "127.0.0.1", "::1" }) |host| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
@@ -137,11 +137,11 @@ fn quic(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try std.fmt.allocPrintSentinel(a, "--9p-tcp=tcp!{s}!0", .{host}, 0),
try std.fmt.allocPrintSentinel(a, "--9p-quic=quic!{s}!0", .{host}, 0),
};
- var d = try Detached.start(gpa, exe, if (tty) "quic-root" else "server", .{ .args = if (tty) &.{} else &args });
+ var d = try Detached.start(gpa, exe, if (tui) "quic-root" else "server", .{ .args = if (tui) &.{} else &args });
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tty) term = try d.startTty(exe, "server", &args);
+ if (tui) term = try d.startTui(exe, "server", &args);
const address = d.abs("pardes-9p-server.sock");
const unix = try Conn.dial(gpa, address);
defer unix.deinit(gpa);
diff --git a/test/process/repls.zig b/test/process/repls.zig
index 09e25e96..a6fe07ac 100644
--- a/test/process/repls.zig
+++ b/test/process/repls.zig
@@ -35,7 +35,7 @@ fn pythonRepl(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
const c = try Conn.dial(gpa, d.socket());
defer c.deinit(gpa);
const before = try c.serials(a);
- try c.write("/pane/1/ctl", "Tty\n");
+ try c.write("/pane/1/ctl", "Term\n");
const deadline = process.nowMs() + 10_000;
var tty: u32 = 0;
while (tty == 0 and process.nowMs() < deadline) : (process.nap(50)) {
@@ -43,7 +43,7 @@ fn pythonRepl(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
tty = @max(tty, n);
};
}
- try check(tty != 0, "Tty made no pane", .{});
+ try check(tty != 0, "Term made no pane", .{});
try check(try waitFor(a, c, tty, "$", 15_000) or try waitFor(a, c, tty, ">", 15_000), "no prompt: {s}", .{try c.pane(a, tty, "body")});
try c.write(try std.fmt.allocPrint(a, "/pane/{d}/pty/data", .{tty}), "python3 -q\r");
try check(try waitFor(a, c, tty, ">>>", 15_000), "no >>>: {s}", .{try c.pane(a, tty, "body")});
diff --git a/test/process/root_ctl.zig b/test/process/root_ctl.zig
index 8ad92f7d..f4a0149b 100644
--- a/test/process/root_ctl.zig
+++ b/test/process/root_ctl.zig
@@ -28,7 +28,7 @@ fn exitAnswers(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
/// Nothing attached, no key, no click, no other request comes to move it along.
fn messagesExpire(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// With nothing attached: a window always is.
- try process.only(.tty);
+ try process.only(.tui);
var d = try process.Detached.start(gpa, exe, "msg", .{});
defer d.deinit();
try d.files.write("/pane/1/ctl", "Msg lingering-words\n");
@@ -118,16 +118,16 @@ fn redial(gpa: std.mem.Allocator, path: []const u8) !*Conn {
}
fn restore(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- for ([_]bool{ false, true }) |tty| {
+ for ([_]bool{ false, true }) |tui| {
var arena = std.heap.ArenaAllocator.init(gpa);
defer arena.deinit();
const a = arena.allocator();
- const name = if (tty) "restore tty space" else "restore detached space";
- var d = try process.Detached.start(gpa, exe, if (tty) "restore-root" else name, .{});
+ const name = if (tui) "restore tui space" else "restore detached space";
+ var d = try process.Detached.start(gpa, exe, if (tui) "restore-root" else name, .{});
defer d.deinit();
var term: ?process.Child = null;
defer if (term) |*t| t.deinit();
- if (tty) term = try d.startTty(exe, name, &.{});
+ if (tui) term = try d.startTui(exe, name, &.{});
const address = d.abs(try std.fmt.allocPrint(a, "pardes-9p-{s}.sock", .{name}));
const old = try Conn.dial(gpa, address);
defer old.deinit(gpa);
@@ -179,7 +179,7 @@ fn restore(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
defer screen.deinit();
const width = try std.unicode.utf8CountCodepoints(std.mem.sliceTo(try screen.screen(), '\n'));
// A detached one is 160x50; a window keeps its own size.
- if (process.backend == .tty) try std.testing.expectEqual(@as(usize, if (tty) 80 else 160), width);
+ if (process.backend == .tui) try std.testing.expectEqual(@as(usize, if (tui) 80 else 160), width);
const opened = try restored.look(a, try std.fmt.allocPrint(a, "/n/own/os{s}", .{d.abs(try std.fmt.allocPrint(a, "{s}.txt", .{name}))}), ids[1]);
try std.testing.expectEqualStrings("initial\n", try restored.pane(a, opened, "body"));
}
diff --git a/test/process/terminals.zig b/test/process/terminals.zig
index e7e93a4f..96804adf 100644
--- a/test/process/terminals.zig
+++ b/test/process/terminals.zig
@@ -79,9 +79,9 @@ const Other = struct {
};
fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
- // shortcut: on the window a fresh Tty's first pty/run sometimes never
- // answers (4 runs of 6); tty alone until that is found (docs/next-tests.md).
- try process.only(.tty);
+ // 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;
@@ -97,12 +97,12 @@ fn runFile(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try c.write(f.at("/pane/{d}/name", .{peer}), "/n/nosuchpeer/d/f.txt\n");
const count = std.mem.count(u8, try c.read(a, "/index"), "\n");
try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "ls\n", "no such directory");
- try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "Tty\n", "no such directory");
+ try refusedSaying(c, f.at("/pane/{d}/exec", .{peer}), "Term\n", "no such directory");
try expectEqual(count, std.mem.count(u8, try c.read(a, "/index"), "\n"));
try expect(!has(try c.read(a, "/log"), "exit 127"));
try c.remove(f.at("/pane/{d}", .{peer}));
try c.write("/exec", "Shell bash\n");
- try c.write("/exec", "Tty\n");
+ try c.write("/exec", "Term\n");
var term: u32 = 0;
var rows = std.mem.tokenizeScalar(u8, try c.read(a, "/index"), '\n');
while (rows.next()) |r| {
@@ -222,8 +222,8 @@ fn namedOnce(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var made: std.ArrayList(u32) = .empty;
try made.append(a, try c.look(a, f.at("{s}/sub", .{root}), null));
const before = try serials(a, c);
- try c.write("/pane/1/ctl", "Tty\n");
- if (shell(a, "command -v fish >/dev/null", .{}) == 0) try c.write("/pane/1/ctl", "Tty fish\n");
+ try c.write("/pane/1/ctl", "Term\n");
+ if (shell(a, "command -v fish >/dev/null", .{}) == 0) try c.write("/pane/1/ctl", "Term fish\n");
for (try serials(a, c)) |s| if (std.mem.indexOfScalar(u32, before, s) == null) try made.append(a, s);
try expect(made.items.len >= 2);
process.sleep(1500); // their shells start and say where they are
@@ -235,14 +235,14 @@ fn namedOnce(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try expect(!has(log, f.at("\nrename {d} ", .{s})));
try expect(has(log, f.at("\nnew {d} {s}", .{ s, root })));
}
- // A shell that cannot start (its interpreter is not there): Tty fails
+ // A shell that cannot start (its interpreter is not there): Term fails
// the write with why and leaves no pane; pty/ctl exec fails with why
// and keeps its terminal.
try d.put("badsh", "#!/nonexistent/interp\n");
const bad = f.at("{s}/badsh", .{root});
_ = libc.chmod(try std.fmt.allocPrintSentinel(a, "{s}", .{bad}, 0), 0o755);
const panes = std.mem.count(u8, try c.read(a, "/index"), "\n");
- try refusedSaying(c, "/pane/1/ctl", f.at("Tty {s}\n", .{bad}), "interpreter /nonexistent/interp not found");
+ try refusedSaying(c, "/pane/1/ctl", f.at("Term {s}\n", .{bad}), "interpreter /nonexistent/interp not found");
try refusedSaying(c, "/ctl", f.at("Shell {s}\n", .{bad}), "interpreter /nonexistent/interp not found");
process.sleep(300);
try expectEqual(panes, std.mem.count(u8, try c.read(a, "/index"), "\n"));
@@ -275,7 +275,7 @@ fn drive(gpa: std.mem.Allocator, exe: [:0]const u8, script: []const u8, key: ?u8
const f = &d.files;
try d.put("command.sh", f.at("exec /bin/sh -c '{s}'\n", .{script}));
try f.write("/ctl", "Shell /bin/sh\n");
- try f.write("/exec", "Tty\n");
+ try f.write("/exec", "Term\n");
const term = try f.focused();
const body = f.at("/pane/{d}/body", .{term});
const data = f.at("/pane/{d}/pty/data", .{term});
diff --git a/test/process/tree.zig b/test/process/tree.zig
index ee39170b..27b51bf1 100644
--- a/test/process/tree.zig
+++ b/test/process/tree.zig
@@ -482,7 +482,7 @@ fn cutWrites(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try expectEqual(@as(usize, 2500), k);
// A detached session with no frontend is 160x50 until told; a
// window's size is its own, and refuses size.
- if (process.backend == .tty) {
+ if (process.backend == .tui) {
const cols, const rows = try screenSize(f);
try expect(cols == 160 and rows == 50);
try c.write("/ctl", "size 132 40\n");