| author | |
| committer | |
| log | 4ebd0036fd6d1d51e8cd6693abe77c2eb2f5e743 |
| tree | 2eb0cb0c687f2950dc70a75267deb068e3d42423 |
| parent | 7641561f2d538cdccf452bc801a1bea88b91fed7 |
2 files changed, 24 insertions(+), 4 deletions(-)
test/link/link.zig+12-3| ... | ... | @@ -27,14 +27,23 @@ pub const Options = struct { |
| 27 | 27 | optimize: std.builtin.OptimizeMode = .Debug, |
| 28 | 28 | use_llvm: bool = true, |
| 29 | 29 | use_lld: bool = false, |
| 30 | strip: ?bool = null, | |
| 30 | 31 | }; |
| 31 | 32 | |
| 32 | 33 | pub fn addTestStep(b: *Build, prefix: []const u8, opts: Options) *Step { |
| 33 | 34 | const target = opts.target.result.zigTriple(b.allocator) catch @panic("OOM"); |
| 34 | 35 | const optimize = @tagName(opts.optimize); |
| 35 | 36 | const use_llvm = if (opts.use_llvm) "llvm" else "no-llvm"; |
| 36 | const name = std.fmt.allocPrint(b.allocator, "test-{s}-{s}-{s}-{s}", .{ | |
| 37 | prefix, target, optimize, use_llvm, | |
| 37 | const use_lld = if (opts.use_lld) "lld" else "no-lld"; | |
| 38 | if (opts.strip) |strip| { | |
| 39 | const s = if (strip) "strip" else "no-strip"; | |
| 40 | const name = std.fmt.allocPrint(b.allocator, "test-{s}-{s}-{s}-{s}-{s}-{s}", .{ | |
| 41 | prefix, target, optimize, use_llvm, use_lld, s, | |
| 42 | }) catch @panic("OOM"); | |
| 43 | return b.step(name, ""); | |
| 44 | } | |
| 45 | const name = std.fmt.allocPrint(b.allocator, "test-{s}-{s}-{s}-{s}-{s}", .{ | |
| 46 | prefix, target, optimize, use_llvm, use_lld, | |
| 38 | 47 | }) catch @panic("OOM"); |
| 39 | 48 | return b.step(name, ""); |
| 40 | 49 | } |
| ... | ... | @@ -87,7 +96,7 @@ fn addCompileStep( |
| 87 | 96 | break :rsf b.addWriteFiles().add("a.zig", bytes); |
| 88 | 97 | }, |
| 89 | 98 | .pic = overlay.pic, |
| 90 | .strip = overlay.strip, | |
| 99 | .strip = if (base.strip) |s| s else overlay.strip, | |
| 91 | 100 | }, |
| 92 | 101 | .use_llvm = base.use_llvm, |
| 93 | 102 | .use_lld = base.use_lld, |
test/link/macho.zig+12-1| ... | ... | @@ -15,6 +15,11 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 15 | 15 | .os_tag = .macos, |
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | // Exercise linker with self-hosted backend (no LLVM) | |
| 19 | macho_step.dependOn(testHelloZig(b, .{ .use_llvm = false, .target = x86_64_target })); | |
| 20 | macho_step.dependOn(testRelocatableZig(b, .{ .use_llvm = false, .strip = true, .target = x86_64_target })); | |
| 21 | ||
| 22 | // Exercise linker with LLVM backend | |
| 18 | 23 | macho_step.dependOn(testDeadStrip(b, .{ .target = default_target })); |
| 19 | 24 | macho_step.dependOn(testEmptyObject(b, .{ .target = default_target })); |
| 20 | 25 | macho_step.dependOn(testEmptyZig(b, .{ .target = default_target })); |
| ... | ... | @@ -1234,7 +1239,13 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step { |
| 1234 | 1239 | const run = addRunArtifact(exe); |
| 1235 | 1240 | run.addCheck(.{ .expect_stderr_match = b.dupe("incrFoo=1") }); |
| 1236 | 1241 | run.addCheck(.{ .expect_stderr_match = b.dupe("decrFoo=0") }); |
| 1237 | run.addCheck(.{ .expect_stderr_match = b.dupe("panic: Oh no!") }); | |
| 1242 | if (opts.use_llvm) { | |
| 1243 | // TODO: enable this once self-hosted can print panics and stack traces | |
| 1244 | run.addCheck(.{ .expect_stderr_match = b.dupe("panic: Oh no!") }); | |
| 1245 | run.addCheck(.{ .expect_term = .{ .Signal = std.os.darwin.SIG.ABRT } }); | |
| 1246 | } else { | |
| 1247 | run.addCheck(.{ .expect_term = .{ .Signal = std.os.darwin.SIG.TRAP } }); | |
| 1248 | } | |
| 1238 | 1249 | test_step.dependOn(&run.step); |
| 1239 | 1250 | |
| 1240 | 1251 | return test_step; |