elf: skip running exe on foreign hosts

This commit is contained in:
Jakub Konka
2023-09-25 21:28:06 +02:00
parent b01b972999
commit 7617486f1d

View File

@@ -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);