diff --git a/build.zig b/build.zig index abf59fa007..3ea4424d1b 100644 --- a/build.zig +++ b/build.zig @@ -335,7 +335,7 @@ pub fn build(b: *Builder) !void { test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes)); test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes)); test_step.dependOn(tests.addTranslateCTests(b, test_filter)); - test_step.dependOn(tests.addRunTranslatedCTests(b, test_filter)); + test_step.dependOn(tests.addRunTranslatedCTests(b, test_filter, target)); // tests for this feature are disabled until we have the self-hosted compiler available // test_step.dependOn(tests.addGenHTests(b, test_filter)); if (!skip_compile_errors) { diff --git a/test/src/run_translated_c.zig b/test/src/run_translated_c.zig index c544bcbb2c..06990241cc 100644 --- a/test/src/run_translated_c.zig +++ b/test/src/run_translated_c.zig @@ -13,6 +13,7 @@ pub const RunTranslatedCContext = struct { step: *build.Step, test_index: usize, test_filter: ?[]const u8, + target: std.zig.CrossTarget, const TestCase = struct { name: []const u8, @@ -93,6 +94,7 @@ pub const RunTranslatedCContext = struct { }); translate_c.step.name = b.fmt("{} translate-c", .{annotated_case_name}); const exe = translate_c.addExecutable(); + exe.setTarget(self.target); exe.step.name = b.fmt("{} build-exe", .{annotated_case_name}); exe.linkLibC(); const run = exe.run(); diff --git a/test/tests.zig b/test/tests.zig index 09001b02a1..250c1cc4ea 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -434,13 +434,18 @@ pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.St return cases.step; } -pub fn addRunTranslatedCTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step { +pub fn addRunTranslatedCTests( + b: *build.Builder, + test_filter: ?[]const u8, + target: std.zig.CrossTarget, +) *build.Step { const cases = b.allocator.create(RunTranslatedCContext) catch unreachable; cases.* = .{ .b = b, .step = b.step("test-run-translated-c", "Run the Run-Translated-C tests"), .test_index = 0, .test_filter = test_filter, + .target = target, }; run_translated_c.addCases(cases);