authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-13 19:15:56+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-24 12:34:39+01:00
log0cc4dc615b536eb5e927558f1391060ecf97b0ea
treefa386d0a78245b90f64cb3281f0933d965fc9898
parentbf285c7e409bddfe7089e570ebf836d0343c8628

test/link/macho: test hello world in Zig


1 files changed, 18 insertions(+), 0 deletions(-)

test/link/macho.zig+18
......@@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
1010
1111 macho_step.dependOn(testDeadStrip(b, .{ .target = default_target }));
1212 macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));
13 macho_step.dependOn(testHelloZig(b, .{ .target = default_target }));
1314 macho_step.dependOn(testLargeBss(b, .{ .target = default_target }));
1415 macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
1516 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
......@@ -163,6 +164,23 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step {
163164 return test_step;
164165}
165166
167fn testHelloZig(b: *Build, opts: Options) *Step {
168 const test_step = addTestStep(b, "macho-hello-zig", opts);
169
170 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
171 \\const std = @import("std");
172 \\pub fn main() void {
173 \\ std.io.getStdOut().writer().print("Hello world!\n", .{}) catch unreachable;
174 \\}
175 });
176
177 const run = addRunArtifact(exe);
178 run.expectStdOutEqual("Hello world!\n");
179 test_step.dependOn(&run.step);
180
181 return test_step;
182}
183
166184fn testLargeBss(b: *Build, opts: Options) *Step {
167185 const test_step = addTestStep(b, "macho-large-bss", opts);
168186