From d197289c331365081295cb44f27ee2893294cffa Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 3 Nov 2026 16:17:51 -0300 Subject: test: the behaviour-test step and test/session.zig, T1 of docs/next-tests.md: a Session drives the core as a 9P client does (walk by path, open, read or write, clunk, held lines run at the clunk as src/9p_io.zig runs them), the core opaque and the step's module importing session alone, so a behavioural test cannot reach past the 9P tree; keys (kbdin), click (on text found on /screen, mousein), screen, focused, refused and the refusal's words; test/behaviour/{other_files,panes,edit}.zig, a file a section of the reference: kbdin and mousein, a collapsed pane's ctl, name's leading blank, Putall, Edit blocks, moved out of src/ninep/ctl.zig (an Edit block left open now checked as a client sees it, an err in the log at its clunk), each checked to fail against a break (collapsed left off the ctl read, Putall saving nothing); the plan doc says the layout, the decisions and the progress Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- build.zig | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 4485140d..8a9451eb 100644 --- a/build.zig +++ b/build.zig @@ -1864,6 +1864,33 @@ pub fn build(b: *std.Build) void { pane_test_step.dependOn(&run_pane_tests.step); if (testMatch(b, unit_profile, test_filters, pane_test_step)) |check| check.addArtifactArg(pane_tests); + // The behavioural tests (docs/next-tests.md): their module has the + // session alone, so none can reach past what a 9P client sees. + const session_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/session.zig"), + .link_libc = true, + }); + session_module.addImport("pardes", core_module); + const behaviour_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/behaviour.zig"), + .link_libc = true, + }); + behaviour_module.addImport("session", session_module); + const behaviour_tests = b.addTest(.{ .root_module = behaviour_module, .filters = test_filters }); + if (test_nonce) |nonce| behaviour_tests.root_module.addImport("test_rebuild_nonce", nonce); + test_build.dependOn(&behaviour_tests.step); + const run_behaviour_tests = b.addRunArtifact(behaviour_tests); + run_behaviour_tests.has_side_effects = true; + unit_step.dependOn(&run_behaviour_tests.step); + if (unit_match) |check| check.addArtifactArg(behaviour_tests); + const behaviour_test_step = b.step("behaviour-test", "run the behavioural tests, through the 9P tree alone (test/behaviour/)"); + behaviour_test_step.dependOn(&run_behaviour_tests.step); + if (testMatch(b, unit_profile, test_filters, behaviour_test_step)) |check| check.addArtifactArg(behaviour_tests); + // Kitty graphics conformance at the core: what a terminal pane's // program sends, what it reads back, what ghostty stores and what a // frame draws (test/kitty.zig). The end-to-end arm, through a real -- cgit v1.3