-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
71 lines (59 loc) · 2.21 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const std = @import("std");
pub fn build(b: *std.Build) void {
const t = b.standardTargetOptions(.{});
const opt = b.standardOptimizeOption(.{});
const ir = b.step("ir", "run some ir");
const exe_ir = b.addExecutable(.{
.name = "run",
.root_source_file = b.path( "src/run_ir.zig" ),
.optimize = opt,
.target = t,
});
b.installArtifact(exe_ir);
ir.dependOn(&exe_ir.step);
const forklift = b.createModule(.{
.root_source_file = b.path( "src/forklift.zig" ),
});
if (false) {
const exe_bpf = b.addExecutable(.{
.name = "run_bpf",
.root_source_file = b.path( "src/main_bpf.zig" ),
.optimize = opt,
.target = t,
});
b.installArtifact(exe_bpf);
}
const bpf_helper = b.addExecutable(.{
.name = "bpf_helper",
.root_source_file = b.path( "test/bpf_helper.zig" ),
.optimize = opt,
.target = t,
});
// b.installArtifact(bpf_helper); // debug the test
const test_user = b.addTest(.{
.root_source_file = b.path( "test/all_user.zig" ),
.optimize = opt,
});
test_user.root_module.addImport("forklift", forklift);
const run_test_user = b.addRunArtifact(test_user);
// requires root or virtualization, so separate
const test_bpf = b.addTest(.{
.root_source_file = b.path( "test/bpf.zig" ),
.optimize = opt,
});
test_bpf.root_module.addImport("forklift", forklift);
// b.installArtifact(test_bpf);
const run_test_bpf_sudo = b.addRunArtifact(test_bpf);
const run_test_bpf = b.addRunArtifact(bpf_helper);
run_test_bpf.addArtifactArg(test_bpf);
// run_test_bpf.stdio = .zig_test; // BAD BINOCULARS!
const test_step = b.step("test", "Check it!");
test_step.dependOn(&run_test_user.step);
test_step.dependOn(&run_test_bpf.step);
const test_step_user = b.step("test_user", "Check it!");
test_step_user.dependOn(&run_test_user.step);
const test_step_bpf = b.step("test_bpf", "Check it!");
test_step_bpf.dependOn(&run_test_bpf.step);
const test_step_bpf_sudo = b.step("test_bpf_sudo", "Check it!");
test_step_bpf_sudo.dependOn(&run_test_bpf_sudo.step);
}