authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 14:01:08-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-05-27 19:15:40-04:00
log759c2211c2eba44cccf0608267bf1a05934ad8a1
tree5dfeba51be37bbb97dca22143bb68d601c8adee6
parentc0da92f71476651ac654249d54512e514b55df55

test cases: try running foreign binaries

You don't know if it's possible to run a binary until you try. The build system already integrates with executors and has the `skip_foreign_checks` for exactly this use case.

1 files changed, 1 insertions(+), 8 deletions(-)

test/src/Cases.zig+1-8
......@@ -545,9 +545,6 @@ pub fn lowerToTranslateCSteps(
545545 target: std.Build.ResolvedTarget,
546546 translate_c_options: TranslateCOptions,
547547) void {
548 const host = std.zig.system.resolveTargetQuery(.{}) catch |err|
549 std.debug.panic("unable to detect native host: {s}\n", .{@errorName(err)});
550
551548 const tests = @import("../tests.zig");
552549 const test_translate_c_step = b.step("test-translate-c", "Run the C translation tests");
553550 if (!translate_c_options.skip_translate_c) {
......@@ -573,11 +570,6 @@ pub fn lowerToTranslateCSteps(
573570 continue; // Pass test.
574571 }
575572
576 if (getExternalExecutor(host, &case.target.result, .{ .link_libc = true }) != .native) {
577 // We wouldn't be able to run the compiled C code.
578 continue; // Pass test.
579 }
580
581573 const write_src = b.addWriteFiles();
582574 const file_source = write_src.add("tmp.c", case.input);
583575
......@@ -596,6 +588,7 @@ pub fn lowerToTranslateCSteps(
596588 const run = b.addRunArtifact(run_exe);
597589 run.step.name = b.fmt("{s} run", .{annotated_case_name});
598590 run.expectStdOutEqual(output);
591 run.skip_foreign_checks = true;
599592
600593 test_run_translated_c_step.dependOn(&run.step);
601594 },