| ... | @@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 10 | | 10 | |
| 11 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); | 11 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); |
| 12 | macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target })); | 12 | macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target })); |
| | 13 | macho_step.dependOn(testHelloC(b, .{ .target = default_target })); |
| 13 | macho_step.dependOn(testHelloZig(b, .{ .target = default_target })); | 14 | macho_step.dependOn(testHelloZig(b, .{ .target = default_target })); |
| 14 | macho_step.dependOn(testLargeBss(b, .{ .target = default_target })); | 15 | macho_step.dependOn(testLargeBss(b, .{ .target = default_target })); |
| 15 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); | 16 | macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target })); |
| ... | @@ -164,6 +165,30 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step { | ... | @@ -164,6 +165,30 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step { |
| 164 | return test_step; | 165 | return test_step; |
| 165 | } | 166 | } |
| 166 | | 167 | |
| | 168 | fn testHelloC(b: *Build, opts: Options) *Step { |
| | 169 | const test_step = addTestStep(b, "macho-hello-c", opts); |
| | 170 | |
| | 171 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| | 172 | \\#include <stdio.h> |
| | 173 | \\int main() { |
| | 174 | \\ printf("Hello world!\n"); |
| | 175 | \\ return 0; |
| | 176 | \\} |
| | 177 | }); |
| | 178 | |
| | 179 | const run = addRunArtifact(exe); |
| | 180 | run.expectStdOutEqual("Hello world!\n"); |
| | 181 | test_step.dependOn(&run.step); |
| | 182 | |
| | 183 | const check = exe.checkObject(); |
| | 184 | check.checkInHeaders(); |
| | 185 | check.checkExact("header"); |
| | 186 | check.checkContains("PIE"); |
| | 187 | test_step.dependOn(&check.step); |
| | 188 | |
| | 189 | return test_step; |
| | 190 | } |
| | 191 | |
| 167 | fn testHelloZig(b: *Build, opts: Options) *Step { | 192 | fn testHelloZig(b: *Build, opts: Options) *Step { |
| 168 | const test_step = addTestStep(b, "macho-hello-zig", opts); | 193 | const test_step = addTestStep(b, "macho-hello-zig", opts); |
| 169 | | 194 | |