From 7617486f1d3d79f08d9d7a8641674c2525e83235 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 25 Sep 2023 21:28:06 +0200 Subject: [PATCH] elf: skip running exe on foreign hosts --- test/link/elf.zig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/link/elf.zig b/test/link/elf.zig index 5c910df1ab..a5b57e7b93 100644 --- a/test/link/elf.zig +++ b/test/link/elf.zig @@ -29,7 +29,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { addCSourceBytes(exe, ""); exe.is_linking_libc = true; - const run = b.addRunArtifact(exe); + const run = addRunArtifact(exe); run.expectExitCode(0); test_step.dependOn(&run.step); @@ -49,7 +49,7 @@ fn testLinkingC(b: *Build, opts: Options) *Step { ); exe.is_linking_libc = true; - const run = b.addRunArtifact(exe); + const run = addRunArtifact(exe); run.expectStdOutEqual("Hello World!\n"); test_step.dependOn(&run.step); @@ -75,7 +75,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step { \\} ); - const run = b.addRunArtifact(exe); + const run = addRunArtifact(exe); run.expectStdErrEqual("Hello World!\n"); test_step.dependOn(&run.step); @@ -120,6 +120,13 @@ fn addExecutable(b: *Build, opts: Options) *Compile { }); } +fn addRunArtifact(comp: *Compile) *Run { + const b = comp.step.owner; + const run = b.addRunArtifact(comp); + run.skip_foreign_checks = true; + return run; +} + fn addZigSourceBytes(comp: *Compile, bytes: []const u8) void { const b = comp.step.owner; const file = WriteFile.create(b).add("a.zig", bytes);