mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Add a zig build test target
This commit is contained in:
@@ -282,6 +282,9 @@ pub fn build(b: *std.Build) !void {
|
||||
try Dir.copyFile(test_dir, "run.sh", out_bin_dir, "run.sh", io, .{});
|
||||
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 (try walker.next(io)) |entry| {
|
||||
const name = entry.basename;
|
||||
@@ -315,6 +318,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user