test/link/macho: upgrade weak framework test
This commit is contained in:
parent
e96f8b817a
commit
105655857f
|
@ -171,8 +171,4 @@ pub const cases = [_]Case{
|
|||
.build_root = "test/link/macho/unwind_info",
|
||||
.import = @import("link/macho/unwind_info/build.zig"),
|
||||
},
|
||||
.{
|
||||
.build_root = "test/link/macho/weak_framework",
|
||||
.import = @import("link/macho/weak_framework/build.zig"),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -32,6 +32,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
|
|||
if (build_opts.has_macos_sdk) {
|
||||
macho_step.dependOn(testHeaderpad(b, .{ .target = b.host }));
|
||||
macho_step.dependOn(testNeededFramework(b, .{ .target = b.host }));
|
||||
macho_step.dependOn(testWeakFramework(b, .{ .target = b.host }));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,6 +768,25 @@ fn testWeakBind(b: *Build, opts: Options) *Step {
|
|||
return test_step;
|
||||
}
|
||||
|
||||
fn testWeakFramework(b: *Build, opts: Options) *Step {
|
||||
const test_step = addTestStep(b, "macho-weak-framework", opts);
|
||||
|
||||
const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" });
|
||||
exe.root_module.linkFramework("Cocoa", .{ .weak = true });
|
||||
|
||||
const run = addRunArtifact(exe);
|
||||
run.expectExitCode(0);
|
||||
test_step.dependOn(&run.step);
|
||||
|
||||
const check = exe.checkObject();
|
||||
check.checkInHeaders();
|
||||
check.checkExact("cmd LOAD_WEAK_DYLIB");
|
||||
check.checkContains("Cocoa");
|
||||
test_step.dependOn(&check.step);
|
||||
|
||||
return test_step;
|
||||
}
|
||||
|
||||
fn testWeakLibrary(b: *Build, opts: Options) *Step {
|
||||
const test_step = addTestStep(b, "macho-weak-library", opts);
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub const requires_symlinks = true;
|
||||
pub const requires_macos_sdk = true;
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const test_step = b.step("test", "Test it");
|
||||
b.default_step = test_step;
|
||||
|
||||
add(b, test_step, .Debug);
|
||||
add(b, test_step, .ReleaseFast);
|
||||
add(b, test_step, .ReleaseSmall);
|
||||
add(b, test_step, .ReleaseSafe);
|
||||
}
|
||||
|
||||
fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "test",
|
||||
.optimize = optimize,
|
||||
.target = b.host,
|
||||
});
|
||||
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} });
|
||||
exe.linkLibC();
|
||||
exe.linkFrameworkWeak("Cocoa");
|
||||
|
||||
const check = exe.checkObject();
|
||||
check.checkInHeaders();
|
||||
check.checkExact("cmd LOAD_WEAK_DYLIB");
|
||||
check.checkContains("Cocoa");
|
||||
test_step.dependOn(&check.step);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
test_step.dependOn(&run_cmd.step);
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user