Commit 759c2211c2

Andrew Kelley <andrew@ziglang.org>
2024-05-27 23:01:08
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 parent c0da92f
Changed files (1)
test
test/src/Cases.zig
@@ -545,9 +545,6 @@ pub fn lowerToTranslateCSteps(
     target: std.Build.ResolvedTarget,
     translate_c_options: TranslateCOptions,
 ) void {
-    const host = std.zig.system.resolveTargetQuery(.{}) catch |err|
-        std.debug.panic("unable to detect native host: {s}\n", .{@errorName(err)});
-
     const tests = @import("../tests.zig");
     const test_translate_c_step = b.step("test-translate-c", "Run the C translation tests");
     if (!translate_c_options.skip_translate_c) {
@@ -573,11 +570,6 @@ pub fn lowerToTranslateCSteps(
                 continue; // Pass test.
             }
 
-            if (getExternalExecutor(host, &case.target.result, .{ .link_libc = true }) != .native) {
-                // We wouldn't be able to run the compiled C code.
-                continue; // Pass test.
-            }
-
             const write_src = b.addWriteFiles();
             const file_source = write_src.add("tmp.c", case.input);
 
@@ -596,6 +588,7 @@ pub fn lowerToTranslateCSteps(
             const run = b.addRunArtifact(run_exe);
             run.step.name = b.fmt("{s} run", .{annotated_case_name});
             run.expectStdOutEqual(output);
+            run.skip_foreign_checks = true;
 
             test_run_translated_c_step.dependOn(&run.step);
         },