authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-09-25 21:28:06+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-09-26 21:07:47+02:00
log7617486f1d3d79f08d9d7a8641674c2525e83235
tree917adfc644bb6ce53cf0483b45502638b35b6059
parentb01b972999f024a694734fa9861827e5dc15a88b

elf: skip running exe on foreign hosts


1 files changed, 10 insertions(+), 3 deletions(-)

test/link/elf.zig+10-3
......@@ -29,7 +29,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step {
2929 addCSourceBytes(exe, "");
3030 exe.is_linking_libc = true;
3131
32 const run = b.addRunArtifact(exe);
32 const run = addRunArtifact(exe);
3333 run.expectExitCode(0);
3434 test_step.dependOn(&run.step);
3535
......@@ -49,7 +49,7 @@ fn testLinkingC(b: *Build, opts: Options) *Step {
4949 );
5050 exe.is_linking_libc = true;
5151
52 const run = b.addRunArtifact(exe);
52 const run = addRunArtifact(exe);
5353 run.expectStdOutEqual("Hello World!\n");
5454 test_step.dependOn(&run.step);
5555
......@@ -75,7 +75,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step {
7575 \\}
7676 );
7777
78 const run = b.addRunArtifact(exe);
78 const run = addRunArtifact(exe);
7979 run.expectStdErrEqual("Hello World!\n");
8080 test_step.dependOn(&run.step);
8181
......@@ -120,6 +120,13 @@ fn addExecutable(b: *Build, opts: Options) *Compile {
120120 });
121121}
122122
123fn addRunArtifact(comp: *Compile) *Run {
124 const b = comp.step.owner;
125 const run = b.addRunArtifact(comp);
126 run.skip_foreign_checks = true;
127 return run;
128}
129
123130fn addZigSourceBytes(comp: *Compile, bytes: []const u8) void {
124131 const b = comp.step.owner;
125132 const file = WriteFile.create(b).add("a.zig", bytes);