diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/daemon.py | 23 | ||||
| -rw-r--r-- | test/process/terminals.zig | 9 | ||||
| -rw-r--r-- | test/process/tty_terminals.zig | 4 |
3 files changed, 28 insertions, 8 deletions
diff --git a/test/daemon.py b/test/daemon.py index 7dc1b4bd..a8ae4331 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -269,8 +269,11 @@ class Replica: is read, whole. A daemon of another replica protocol (an older build's, across an Upgrade) is dialled again in its own.""" name = session.encode() - self.send(0x01, struct.pack('<HQH', wire or self.WIRE, build, len(name)) + name + b'\xff') - self.send(0x06, b'\x00') + # Its first word (not far) in the same write, as a client's join + # sends it (core/replica.zig joinOn): a refused hello's connection + # is closed, and a second write after it would meet that. + hello = struct.pack('<HQH', wire or self.WIRE, build, len(name)) + name + b'\xff' + self.s.sendall(struct.pack('<BI', 0x01, len(hello)) + hello + struct.pack('<BIB', 0x06, 1, 0)) tag, body = self.read() if tag == 0x01: pid, n = struct.unpack_from('<IH', body) @@ -1504,7 +1507,10 @@ def by_hash(binary): started.append(sess.pid) wait_for('the replica socket', (root / 'pardes-replica.sock').exists) wait_for('the session\'s 9P socket', (root / 'pardes-9p-files.sock').exists) - nine = Client(root / 'pardes-9p-files.sock') + # Each reply waited for as long as the opens it answers take: the + # 17 MiB file's Look took 1.6-6.6 s in a Debug build at a load of + # 35 (ninep.py's 5 s is a reply's whole wait). + nine = Client(root / 'pardes-9p-files.sock', timeout=60) pane = next(int(row.split()[0]) for row in nine.read('/index').splitlines() if row.split()[1] == b'text') (ta, a), (tf, f) = client('a', False), client('f', True) seen = {n: len(checks(root / f'{n}.check')) for n in 'af'} @@ -2341,10 +2347,17 @@ def upgrades(old, new): sock = root / 'pardes-9p-again.sock' wait_for('the next session', sock.exists) client = Client(sock) - started.append(int(dict(line.split(maxsplit=1) for line in client.read('/status').decode().splitlines())['pid'])) + again = int(dict(line.split(maxsplit=1) for line in client.read('/status').decode().splitlines())['pid']) + started.append(again) # Its reader of the daemon starts after its first frame: an Adopt - # before that waits for an `ok` nobody reads, and is refused. + # before that waits for an `ok` nobody reads, and is refused. The + # daemon lists it once it has taken its hello, which its `ok` + # answers: an Adopt before that waits at most 2 s for the `ok` + # (daemon.zig `kept`), which a loaded machine can take (3 in 40 at + # a load of 35). wait_for('the next session\'s first frame', lambda: b'\x1b[?1049h' in term.text()) + wait_for('the next session listed by the daemon', lambda: f'session again {again} ' in subprocess.run( + [str(binary), '--ps'], env=env, capture_output=True, timeout=30).stdout.decode()) before = set(terminals(client)) client.write(f'/pane/{min(before)}/exec', b'Adopt\n') pane = wait_for('the adopted pane', lambda: set(terminals(client)) - before).pop() diff --git a/test/process/terminals.zig b/test/process/terminals.zig index 24772ced..d9c3bcca 100644 --- a/test/process/terminals.zig +++ b/test/process/terminals.zig @@ -262,7 +262,9 @@ fn rawKey(gpa: std.mem.Allocator, exe: [:0]const u8) !void { /// thousand: nothing printed is nothing kept), then a probe typed and /// taken back with ^U. fn drive(gpa: std.mem.Allocator, exe: [:0]const u8, script: []const u8, key: ?u8, rows: usize) !void { - var d = try process.Detached.start(gpa, exe, "agent", .{}); + // No builtin announces itself: Term's name would linger on the screen + // (MessageLinger, 800 ms) and go between `before` and ^U's answer. + var d = try process.Detached.start(gpa, exe, "agent", .{ .init = "Verbose off\n" }); defer d.deinit(); const f = &d.files; try d.put("command.sh", f.at("exec /bin/sh -c '{s}'\n", .{script})); @@ -300,7 +302,10 @@ fn drive(gpa: std.mem.Allocator, exe: [:0]const u8, script: []const u8, key: ?u8 try f.write(data, "\x15"); const back_by = eh.nowMs() + 10_000; while (!std.mem.eql(u8, try f.screen(), before)) { - if (eh.nowMs() > back_by) return error.ScreenNotRestored; + if (eh.nowMs() > back_by) { + std.debug.print("before:\n{s}\nafter ^U:\n{s}\n", .{ before, try f.screen() }); + return error.ScreenNotRestored; + } sleepMs(10); } } diff --git a/test/process/tty_terminals.zig b/test/process/tty_terminals.zig index d5540818..dfb027e2 100644 --- a/test/process/tty_terminals.zig +++ b/test/process/tty_terminals.zig @@ -844,7 +844,9 @@ fn exec_bigdrag(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.drag("middle", "150", 31); try t.drag("middle", "198", 59); try t.release("middle", "198", 59); - try t.stable(500, 8000); + // Bash fails each swept chunk as a command, one by one: under load + // that runs well past 8 s, so the quiet is waited for once, with the + // cap the sweep's other waits have. try t.stable(800, 30000); // still alive: type and execute a marker command try t.press("left", "105", 41); |
