authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-27 16:43:21+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-27 16:43:35+01:00
log8d29c84d007849d82268f80c902742a7a19ba400
tree2ef61aecd1cb3d6a421e01f792b7b89471c5c29f
parent6925ef0f1af0497c6ea454348b0c3fbe451313a9

link-tests: test uuid on x86_64-macos too


1 files changed, 30 insertions(+), 8 deletions(-)

test/link/macho/uuid/build.zig+30-8
......@@ -5,23 +5,45 @@ const LibExeObjectStep = std.build.LibExeObjStep;
55pub fn build(b: *Builder) void {
66 const test_step = b.step("test", "Test");
77 test_step.dependOn(b.getInstallStep());
8 testUuid(b, test_step, .ReleaseSafe, "46b333df88f5314686fc0cba3b939ca8");
9 testUuid(b, test_step, .ReleaseFast, "46b333df88f5314686fc0cba3b939ca8");
10 testUuid(b, test_step, .ReleaseSmall, "46b333df88f5314686fc0cba3b939ca8");
8
9 // We force cross-compilation to ensure we always pick a generic CPU with constant set of CPU features.
10 const aarch64_macos = std.zig.CrossTarget{
11 .cpu_arch = .aarch64,
12 .os_tag = .macos,
13 };
14
15 testUuid(b, test_step, .ReleaseSafe, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
16 testUuid(b, test_step, .ReleaseFast, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
17 testUuid(b, test_step, .ReleaseSmall, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
18
19 const x86_64_macos = std.zig.CrossTarget{
20 .cpu_arch = .x86_64,
21 .os_tag = .macos,
22 };
23
24 testUuid(b, test_step, .ReleaseSafe, x86_64_macos, "342ac765194131e1bad5692b9e0e54a4");
25 testUuid(b, test_step, .ReleaseFast, x86_64_macos, "342ac765194131e1bad5692b9e0e54a4");
26 testUuid(b, test_step, .ReleaseSmall, x86_64_macos, "f119310e24773ecf8ec42e09d0379dad");
1127}
1228
13fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, comptime exp: []const u8) void {
29fn testUuid(
30 b: *Builder,
31 test_step: *std.build.Step,
32 mode: std.builtin.Mode,
33 target: std.zig.CrossTarget,
34 comptime exp: []const u8,
35) void {
1436 // The calculated UUID value is independent of debug info and so it should
1537 // stay the same across builds.
1638 {
17 const dylib = simpleDylib(b, mode);
39 const dylib = simpleDylib(b, mode, target);
1840 const check_dylib = dylib.checkObject(.macho);
1941 check_dylib.checkStart("cmd UUID");
2042 check_dylib.checkNext("uuid " ++ exp);
2143 test_step.dependOn(&check_dylib.step);
2244 }
2345 {
24 const dylib = simpleDylib(b, mode);
46 const dylib = simpleDylib(b, mode, target);
2547 dylib.strip = true;
2648 const check_dylib = dylib.checkObject(.macho);
2749 check_dylib.checkStart("cmd UUID");
......@@ -30,10 +52,10 @@ fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, com
3052 }
3153}
3254
33fn simpleDylib(b: *Builder, mode: std.builtin.Mode) *LibExeObjectStep {
55fn simpleDylib(b: *Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *LibExeObjectStep {
3456 const dylib = b.addSharedLibrary("test", null, b.version(1, 0, 0));
57 dylib.setTarget(target);
3558 dylib.setBuildMode(mode);
36 dylib.setTarget(.{ .cpu_arch = .aarch64, .os_tag = .macos });
3759 dylib.addCSourceFile("test.c", &.{});
3860 dylib.linkLibC();
3961 return dylib;