From 21e09998114a866ae76ecef68d660e84561daa44 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 11:03:55 -0300 Subject: test: the process runner, test/process.zig (docs/next-tests.md, the user's one runner): Files, a running pardes's file tree over its socket with Session's method names (read, write, expect, keys, click, where, screen, focused, newPane, at), dialled by pid or path, and Detached, a `pardes --detach` in a throwaway root that is its HOME, runtime and config directory, with no daemon (PARDES_DAEMON=off) so nothing outlives it, its stderr kept and said if it exits early; the pty mode is e2e_harness's Harness with process.of; the process-test step runs test/process_test.zig over test/process/*.zig, its first case fs.py's keys_and_mouse (gone from fs.py); snap9p reads /screen through Files; all 113 snap scripts pass Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/process_test.zig | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/process_test.zig (limited to 'test/process_test.zig') diff --git a/test/process_test.zig b/test/process_test.zig new file mode 100644 index 00000000..9924b9dd --- /dev/null +++ b/test/process_test.zig @@ -0,0 +1,33 @@ +//! The process tests (T2 of docs/next-tests.md): each case starts a real +//! pardes through test/process.zig and drives it over its socket. A file +//! in test/process/ a section of the book, as test/behaviour/'s are. +//! +//! pardes-process-test [filter] +const std = @import("std"); + +const files = .{ + @import("process/other_files.zig"), +}; + +pub fn main(init: std.process.Init) !void { + const args = try init.minimal.args.toSlice(init.arena.allocator()); + if (args.len < 2) return error.Usage; + const exe = args[1]; + const filter: []const u8 = if (args.len > 2) args[2] else ""; + const gpa = std.heap.page_allocator; + var failed: usize = 0; + var ran: usize = 0; + inline for (files) |file| inline for (file.cases) |case| { + if (std.mem.indexOf(u8, case[0], filter) != null) { + ran += 1; + if (case[1](gpa, exe)) { + std.debug.print("PASS {s}\n", .{case[0]}); + } else |err| { + failed += 1; + std.debug.print("FAIL {s}: {t}\n", .{ case[0], err }); + } + } + }; + std.debug.print("{d} of {d} process tests failed\n", .{ failed, ran }); + if (failed > 0 or ran == 0) std.process.exit(1); +} -- cgit v1.3