aboutsummaryrefslogtreecommitdiff
path: root/test/link/macho
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-01-15 11:43:36 +0100
committerJakub Konka <kubkon@jakubkonka.com>2024-01-24 12:34:40 +0100
commitb70fedee7e61d0243211ef36635681fcb998ca54 (patch)
treeb9bfd890f95530d50ec75d69394012d08bc481f5 /test/link/macho
parent933231868ab37c67af53ab67aaf1355b5f50413a (diff)
downloadzig-b70fedee7e61d0243211ef36635681fcb998ca54.tar.gz
zig-b70fedee7e61d0243211ef36635681fcb998ca54.zip
test/link/macho: upgrade search strategy test
Diffstat (limited to 'test/link/macho')
-rw-r--r--test/link/macho/search_strategy/a.c7
-rw-r--r--test/link/macho/search_strategy/build.zig84
-rw-r--r--test/link/macho/search_strategy/main.c9
3 files changed, 0 insertions, 100 deletions
diff --git a/test/link/macho/search_strategy/a.c b/test/link/macho/search_strategy/a.c
deleted file mode 100644
index 199b31e1a0..0000000000
--- a/test/link/macho/search_strategy/a.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-
-char world[] = "world";
-
-char* hello() {
- return "Hello";
-}
diff --git a/test/link/macho/search_strategy/build.zig b/test/link/macho/search_strategy/build.zig
deleted file mode 100644
index 181d2df91a..0000000000
--- a/test/link/macho/search_strategy/build.zig
+++ /dev/null
@@ -1,84 +0,0 @@
-const std = @import("std");
-
-pub const requires_symlinks = 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 target = b.resolveTargetQuery(.{ .os_tag = .macos });
-
- {
- // -search_dylibs_first
- const exe = createScenario(b, optimize, target, "search_dylibs_first", .mode_first);
-
- const check = exe.checkObject();
- check.checkInHeaders();
- check.checkExact("cmd LOAD_DYLIB");
- check.checkExact("name @rpath/libsearch_dylibs_first.dylib");
- test_step.dependOn(&check.step);
-
- const run = b.addRunArtifact(exe);
- run.skip_foreign_checks = true;
- run.expectStdOutEqual("Hello world");
- test_step.dependOn(&run.step);
- }
-
- {
- // -search_paths_first
- const exe = createScenario(b, optimize, target, "search_paths_first", .paths_first);
-
- const run = b.addRunArtifact(exe);
- run.skip_foreign_checks = true;
- run.expectStdOutEqual("Hello world");
- test_step.dependOn(&run.step);
- }
-}
-
-fn createScenario(
- b: *std.Build,
- optimize: std.builtin.OptimizeMode,
- target: std.Build.ResolvedTarget,
- name: []const u8,
- search_strategy: std.Build.Module.SystemLib.SearchStrategy,
-) *std.Build.Step.Compile {
- const static = b.addStaticLibrary(.{
- .name = name,
- .optimize = optimize,
- .target = target,
- });
- static.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
- static.linkLibC();
-
- const dylib = b.addSharedLibrary(.{
- .name = name,
- .version = .{ .major = 1, .minor = 0, .patch = 0 },
- .optimize = optimize,
- .target = target,
- });
- dylib.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
- dylib.linkLibC();
-
- const exe = b.addExecutable(.{
- .name = name,
- .optimize = optimize,
- .target = target,
- });
- exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
- exe.linkSystemLibrary2(name, .{
- .use_pkg_config = .no,
- .search_strategy = search_strategy,
- });
- exe.linkLibC();
- exe.addLibraryPath(static.getEmittedBinDirectory());
- exe.addLibraryPath(dylib.getEmittedBinDirectory());
- exe.addRPath(dylib.getEmittedBinDirectory());
- return exe;
-}
diff --git a/test/link/macho/search_strategy/main.c b/test/link/macho/search_strategy/main.c
deleted file mode 100644
index 941903f219..0000000000
--- a/test/link/macho/search_strategy/main.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdio.h>
-
-char* hello();
-extern char world[];
-
-int main(int argc, char* argv[]) {
- printf("%s %s", hello(), world);
- return 0;
-}