From ad8860da7b91ae0148430be9414fb887795f1e82 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 5 Jan 2026 23:00:51 +0100 Subject: [PATCH] Add a zig build test target --- build.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.zig b/build.zig index 3be81e07..7fe1fed9 100644 --- a/build.zig +++ b/build.zig @@ -315,6 +315,9 @@ pub fn build(b: *std.Build) !void { const allocator = heap.page_allocator; var walker = try test_dir.walk(allocator); + + const test_step = b.step("test", "Run all libsodium tests"); + if (build_tests) { while (if (is_zig_16) try walker.next(io) else try walker.next()) |entry| { const name = entry.basename; @@ -352,6 +355,11 @@ pub fn build(b: *std.Build) !void { } b.installArtifact(exe); + + // Add a run step for this test + const run_test = b.addRunArtifact(exe); + run_test.setCwd(b.path(test_path)); + test_step.dependOn(&run_test.step); } } }