| ... | @@ -29,7 +29,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { | ... | @@ -29,7 +29,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { |
| 29 | addCSourceBytes(exe, ""); | 29 | addCSourceBytes(exe, ""); |
| 30 | exe.is_linking_libc = true; | 30 | exe.is_linking_libc = true; |
| 31 | | 31 | |
| 32 | const run = b.addRunArtifact(exe); | 32 | const run = addRunArtifact(exe); |
| 33 | run.expectExitCode(0); | 33 | run.expectExitCode(0); |
| 34 | test_step.dependOn(&run.step); | 34 | test_step.dependOn(&run.step); |
| 35 | | 35 | |
| ... | @@ -49,7 +49,7 @@ fn testLinkingC(b: *Build, opts: Options) *Step { | ... | @@ -49,7 +49,7 @@ fn testLinkingC(b: *Build, opts: Options) *Step { |
| 49 | ); | 49 | ); |
| 50 | exe.is_linking_libc = true; | 50 | exe.is_linking_libc = true; |
| 51 | | 51 | |
| 52 | const run = b.addRunArtifact(exe); | 52 | const run = addRunArtifact(exe); |
| 53 | run.expectStdOutEqual("Hello World!\n"); | 53 | run.expectStdOutEqual("Hello World!\n"); |
| 54 | test_step.dependOn(&run.step); | 54 | test_step.dependOn(&run.step); |
| 55 | | 55 | |
| ... | @@ -75,7 +75,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step { | ... | @@ -75,7 +75,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step { |
| 75 | \\} | 75 | \\} |
| 76 | ); | 76 | ); |
| 77 | | 77 | |
| 78 | const run = b.addRunArtifact(exe); | 78 | const run = addRunArtifact(exe); |
| 79 | run.expectStdErrEqual("Hello World!\n"); | 79 | run.expectStdErrEqual("Hello World!\n"); |
| 80 | test_step.dependOn(&run.step); | 80 | test_step.dependOn(&run.step); |
| 81 | | 81 | |
| ... | @@ -120,6 +120,13 @@ fn addExecutable(b: *Build, opts: Options) *Compile { | ... | @@ -120,6 +120,13 @@ fn addExecutable(b: *Build, opts: Options) *Compile { |
| 120 | }); | 120 | }); |
| 121 | } | 121 | } |
| 122 | | 122 | |
| | 123 | fn 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 | |
| 123 | fn addZigSourceBytes(comp: *Compile, bytes: []const u8) void { | 130 | fn addZigSourceBytes(comp: *Compile, bytes: []const u8) void { |
| 124 | const b = comp.step.owner; | 131 | const b = comp.step.owner; |
| 125 | const file = WriteFile.create(b).add("a.zig", bytes); | 132 | const file = WriteFile.create(b).add("a.zig", bytes); |