Skip to content

Commit

Permalink
fix test translate-c exes always being built
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed Nov 18, 2024
1 parent 98aade3 commit 8be55bf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/cases.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ pub fn addCaseTests(
skip_translate: bool,
skip_run_translated: bool,
) !void {
const test_translate_step = b.step("test-translate", "Run the C translation tests");
if (!skip_translate) tests_step.dependOn(test_translate_step);

const test_run_translated_step = b.step("test-run-translated", "Run the Run-Translated-C tests");
if (!skip_run_translated) tests_step.dependOn(test_run_translated_step);

const translate_exes = blk: {
var exes: [4]*std.Build.Step.Compile = undefined;
for (optimization_modes, 0..) |mode, i| {
Expand All @@ -23,19 +29,15 @@ pub fn addCaseTests(
.optimize = mode,
});
exe.root_module.addImport("aro", aro.module("aro"));
// TODO why does this need to be installed?
b.installArtifact(exe);

const install_step = b.addInstallArtifact(exe, .{});
test_translate_step.dependOn(&install_step.step);
test_run_translated_step.dependOn(&install_step.step);
exes[i] = exe;
}
break :blk exes[0..optimization_modes.len];
};

const test_translate_step = b.step("test-translate", "Run the C translation tests");
if (!skip_translate) tests_step.dependOn(test_translate_step);

const test_run_translated_step = b.step("test-run-translated", "Run the Run-Translated-C tests");
if (!skip_run_translated) tests_step.dependOn(test_run_translated_step);

var dir = try b.build_root.handle.openDir("test/cases", .{ .iterate = true });
defer dir.close();

Expand Down

0 comments on commit 8be55bf

Please sign in to comment.