Add v1 smoke fixture target

This commit is contained in:
slhx agent
2026-06-21 05:29:47 +02:00
parent 30faf3765f
commit a1600e511a
3 changed files with 126 additions and 5 deletions
+12 -5
View File
@@ -58,7 +58,7 @@ pub fn build(b: *std.Build) void {
},
};
const main_mod = profileModule(b, target, optimize, profiles[0]);
const main_mod = profileModule(b, target, optimize, profiles[0], "src/main.zig");
const exe = b.addExecutable(.{
.name = profiles[0].exe_name,
.root_module = main_mod,
@@ -68,7 +68,7 @@ pub fn build(b: *std.Build) void {
inline for (profiles[1..]) |profile| {
const profile_exe = b.addExecutable(.{
.name = profile.exe_name,
.root_module = profileModule(b, target, optimize, profile),
.root_module = profileModule(b, target, optimize, profile, "src/main.zig"),
});
b.installArtifact(profile_exe);
addRunProfileStep(b, profile, profile_exe);
@@ -84,11 +84,18 @@ pub fn build(b: *std.Build) void {
run_step.dependOn(&run_cmd.step);
const tests = b.addTest(.{
.root_module = profileModule(b, target, optimize, profiles[0]),
.root_module = profileModule(b, target, optimize, profiles[0], "src/main.zig"),
});
const test_cmd = b.addRunArtifact(tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&test_cmd.step);
const smoke_tests = b.addTest(.{
.root_module = profileModule(b, target, optimize, profiles[0], "src/v1_smoke.zig"),
});
const smoke_cmd = b.addRunArtifact(smoke_tests);
const smoke_step = b.step("v1-smoke", "Run cheap v1 end-to-end fixture suite");
smoke_step.dependOn(&smoke_cmd.step);
}
fn addRunProfileStep(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void {
@@ -116,7 +123,7 @@ fn addServerInstallSteps(b: *std.Build, profile: Profile, exe: *std.Build.Step.C
verify_step.dependOn(&verify_cmd.step);
}
fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, profile: Profile) *std.Build.Module {
fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, profile: Profile, root_source_file: []const u8) *std.Build.Module {
const options = b.addOptions();
options.addOption([]const u8, "active_profile", profile.name);
options.addOption(bool, "local_socket", profile.local_socket);
@@ -127,7 +134,7 @@ fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
options.addOption([]const u8, "tool_mutation", profile.tool_mutation);
const mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.root_source_file = b.path(root_source_file),
.target = target,
.optimize = optimize,
});