mirror of
https://github.com/ziglang/zig.git
synced 2025-12-18 12:13:20 +00:00
link-tests: test uuid on x86_64-macos too
This commit is contained in:
parent
6925ef0f1a
commit
8d29c84d00
@ -5,23 +5,45 @@ const LibExeObjectStep = std.build.LibExeObjStep;
|
|||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *Builder) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
testUuid(b, test_step, .ReleaseSafe, "46b333df88f5314686fc0cba3b939ca8");
|
|
||||||
testUuid(b, test_step, .ReleaseFast, "46b333df88f5314686fc0cba3b939ca8");
|
// We force cross-compilation to ensure we always pick a generic CPU with constant set of CPU features.
|
||||||
testUuid(b, test_step, .ReleaseSmall, "46b333df88f5314686fc0cba3b939ca8");
|
const aarch64_macos = std.zig.CrossTarget{
|
||||||
|
.cpu_arch = .aarch64,
|
||||||
|
.os_tag = .macos,
|
||||||
|
};
|
||||||
|
|
||||||
|
testUuid(b, test_step, .ReleaseSafe, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
|
||||||
|
testUuid(b, test_step, .ReleaseFast, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
|
||||||
|
testUuid(b, test_step, .ReleaseSmall, aarch64_macos, "46b333df88f5314686fc0cba3b939ca8");
|
||||||
|
|
||||||
|
const x86_64_macos = std.zig.CrossTarget{
|
||||||
|
.cpu_arch = .x86_64,
|
||||||
|
.os_tag = .macos,
|
||||||
|
};
|
||||||
|
|
||||||
|
testUuid(b, test_step, .ReleaseSafe, x86_64_macos, "342ac765194131e1bad5692b9e0e54a4");
|
||||||
|
testUuid(b, test_step, .ReleaseFast, x86_64_macos, "342ac765194131e1bad5692b9e0e54a4");
|
||||||
|
testUuid(b, test_step, .ReleaseSmall, x86_64_macos, "f119310e24773ecf8ec42e09d0379dad");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, comptime exp: []const u8) void {
|
fn testUuid(
|
||||||
|
b: *Builder,
|
||||||
|
test_step: *std.build.Step,
|
||||||
|
mode: std.builtin.Mode,
|
||||||
|
target: std.zig.CrossTarget,
|
||||||
|
comptime exp: []const u8,
|
||||||
|
) void {
|
||||||
// The calculated UUID value is independent of debug info and so it should
|
// The calculated UUID value is independent of debug info and so it should
|
||||||
// stay the same across builds.
|
// stay the same across builds.
|
||||||
{
|
{
|
||||||
const dylib = simpleDylib(b, mode);
|
const dylib = simpleDylib(b, mode, target);
|
||||||
const check_dylib = dylib.checkObject(.macho);
|
const check_dylib = dylib.checkObject(.macho);
|
||||||
check_dylib.checkStart("cmd UUID");
|
check_dylib.checkStart("cmd UUID");
|
||||||
check_dylib.checkNext("uuid " ++ exp);
|
check_dylib.checkNext("uuid " ++ exp);
|
||||||
test_step.dependOn(&check_dylib.step);
|
test_step.dependOn(&check_dylib.step);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const dylib = simpleDylib(b, mode);
|
const dylib = simpleDylib(b, mode, target);
|
||||||
dylib.strip = true;
|
dylib.strip = true;
|
||||||
const check_dylib = dylib.checkObject(.macho);
|
const check_dylib = dylib.checkObject(.macho);
|
||||||
check_dylib.checkStart("cmd UUID");
|
check_dylib.checkStart("cmd UUID");
|
||||||
@ -30,10 +52,10 @@ fn testUuid(b: *Builder, test_step: *std.build.Step, mode: std.builtin.Mode, com
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn simpleDylib(b: *Builder, mode: std.builtin.Mode) *LibExeObjectStep {
|
fn simpleDylib(b: *Builder, mode: std.builtin.Mode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
||||||
const dylib = b.addSharedLibrary("test", null, b.version(1, 0, 0));
|
const dylib = b.addSharedLibrary("test", null, b.version(1, 0, 0));
|
||||||
|
dylib.setTarget(target);
|
||||||
dylib.setBuildMode(mode);
|
dylib.setBuildMode(mode);
|
||||||
dylib.setTarget(.{ .cpu_arch = .aarch64, .os_tag = .macos });
|
|
||||||
dylib.addCSourceFile("test.c", &.{});
|
dylib.addCSourceFile("test.c", &.{});
|
||||||
dylib.linkLibC();
|
dylib.linkLibC();
|
||||||
return dylib;
|
return dylib;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user