commit ca86dc61ddf1f2dd96f78e217ade71f04604d144 (tree)
parent 4ebd0036fd6d1d51e8cd6693abe77c2eb2f5e743
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Sat, 3 Feb 2024 19:36:52 +0100
test/link/macho: test for signals only when running on the host
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/test/link/macho.zig b/test/link/macho.zig
@@ -1242,9 +1242,10 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {
if (opts.use_llvm) {
// TODO: enable this once self-hosted can print panics and stack traces
run.addCheck(.{ .expect_stderr_match = b.dupe("panic: Oh no!") });
- run.addCheck(.{ .expect_term = .{ .Signal = std.os.darwin.SIG.ABRT } });
- } else {
- run.addCheck(.{ .expect_term = .{ .Signal = std.os.darwin.SIG.TRAP } });
+ }
+ if (builtin.os.tag == .macos) {
+ const signal: u32 = if (opts.use_llvm) std.os.darwin.SIG.ABRT else std.os.darwin.SIG.TRAP;
+ run.addCheck(.{ .expect_term = .{ .Signal = signal } });
}
test_step.dependOn(&run.step);
@@ -2318,6 +2319,7 @@ fn addTestStep(b: *Build, comptime prefix: []const u8, opts: Options) *Step {
return link.addTestStep(b, "macho-" ++ prefix, opts);
}
+const builtin = @import("builtin");
const addAsmSourceBytes = link.addAsmSourceBytes;
const addCSourceBytes = link.addCSourceBytes;
const addRunArtifact = link.addRunArtifact;