diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 05:19:21 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 05:55:49 -0300 |
| commit | c8553032ef84aec74cbb5d07d07f934eecf3d4a9 (patch) | |
| tree | e47d3dd72b83e0b95d53271df9f5932dab389959 /test/snapshot.zig | |
| parent | de0447471febe1253b42a32fe9a1d6cdccc9d5b9 (diff) | |
| download | pardes-c8553032ef84aec74cbb5d07d07f934eecf3d4a9.tar.gz pardes-c8553032ef84aec74cbb5d07d07f934eecf3d4a9.zip | |
kinds #9, the core's image code gone: src/image.zig (558 lines) and the static table go, so no kind is compiled in (Registry.init, Kind.image, compiledIn, `static` in /addons and "is compiled in" with them) and a test of the core's side of a kind's pane opens Kind.test_kind (a picture of one pixel, no library); a placement's fit (NativeGeometry, containGeometry) moves to surface.zig and a PDF's fit modes to pdf_view.zig; a terminal's kitty PNG decodes in TerminalImages.zig through wuffs as before, its downscale through stb_image_resize, the one part of zstbi the core keeps (stb_image patched out of it, the wuffs_images option, tag_image and image_exts gone); the image cases load the built image.so by path: test/panes.zig's and fs_namespace's through Addon.perform, T1 through Addon load (a new behaviour case: PNG, JPEG and PPM through 9P, the art words, a refused corrupt PNG, a dump's placeholder and its picture back, which replaces the decode unit test and ctl.zig's corrupt-image case), the snapshot, process and image harnesses by linking it into each session's data directory; images.snap unchanged
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/snapshot.zig')
| -rw-r--r-- | test/snapshot.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/snapshot.zig b/test/snapshot.zig index d93face2..26022a41 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -86,6 +86,9 @@ var careful = false; /// abs path of the deterministic mock language server the build handed over /// (--lspmock=); null leaves the protocol client fully disabled for the run var lspmock_bin: ?[:0]const u8 = null; +/// abs path of the image addon the build made (--image-addon=), linked into +/// each script's data directory, where a session's start scan finds it +var image_addon: ?[:0]const u8 = null; var record_dir: ?[]const u8 = null; /// --tape=DIR: each session records its tape there (PARDES_RECORD, src/tape.zig) /// and the script fails unless every tape replays without diverging. @@ -133,6 +136,8 @@ pub fn main(init: std.process.Init) !void { trace_stable = true; } else if (std.mem.startsWith(u8, a, "--lspmock=")) { lspmock = try absPath(arena, orig_cwd, a["--lspmock=".len..]); + } else if (std.mem.startsWith(u8, a, "--image-addon=")) { + image_addon = try arena.dupeSentinel(u8, try absPath(arena, orig_cwd, a["--image-addon=".len..]), 0); } else if (std.mem.startsWith(u8, a, "--record=")) { record_dir = try absPath(arena, orig_cwd, a["--record=".len..]); } else if (std.mem.startsWith(u8, a, "--tape=")) { @@ -165,6 +170,7 @@ pub fn main(init: std.process.Init) !void { std.mem.eql(u8, a, "--no-retry") or std.mem.eql(u8, a, "--trace-stable") or std.mem.startsWith(u8, a, "--lspmock=") or + std.mem.startsWith(u8, a, "--image-addon=") or std.mem.startsWith(u8, a, "--record=") or std.mem.startsWith(u8, a, "--tape=") or std.mem.eql(u8, a, "--dump") or @@ -628,6 +634,13 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // XDG directory that points outside this per-snapshot fake home. const config_home = try std.fmt.allocPrintSentinel(arena, "{s}/.config", .{home}, 0); _ = setenv("XDG_CONFIG_HOME", config_home, 1); + // ...and its data directory (dumps, the addons its start scan loads). + const data_home = try std.fmt.allocPrintSentinel(arena, "{s}/.local/share", .{home}, 0); + _ = setenv("XDG_DATA_HOME", data_home, 1); + if (image_addon) |lib| { + for ([_][]const u8{ "/.local", "/.local/share", "/.local/share/pardes", "/.local/share/pardes/addons" }) |sub| try mkdir(arena, try std.fmt.allocPrint(arena, "{s}{s}", .{ home, sub }), true); + if (libc.symlink(lib, try std.fmt.allocPrintSentinel(arena, "{s}/pardes/addons/image.so", .{data_home}, 0)) != 0) return error.SymlinkFailed; + } // ...and it is not empty: the DEFAULT shell is $SHELL, whatever this // machine's user logs in with (fish's prompt carries a hostname and its // greeting a version), so a golden taken |
