authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-05-22 11:53:47+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-05-22 14:59:32+02:00
logd78968c1b589811c970ac57a4be52361cca2b5b1
treebd2a448dd9d556f80a0608577e989f2723fbd9fe
parent5fe9f88b13f37e14fcb91e155e3e686eccb89dfc

test/link: actually run tests requiring symlinks on non-Win

Fixes regression introduced by https://github.com/ziglang/zig/commit/5d5e89aa8d5a454bce2c93555d3bc7c7ae1aa162 Turns out since landing that PR we haven't run any tests requiring symlinks or any Apple SDK on a macOS host. Not great.

3 files changed, 9 insertions(+), 9 deletions(-)

test/link/build.zig+3-3
...@@ -9,12 +9,12 @@ pub fn build(b: *std.Build) void {...@@ -9,12 +9,12 @@ pub fn build(b: *std.Build) void {
9 const enable_ios_sdk = b.option(bool, "enable_ios_sdk", "Run tests requiring presence of iOS SDK and frameworks") orelse false;9 const enable_ios_sdk = b.option(bool, "enable_ios_sdk", "Run tests requiring presence of iOS SDK and frameworks") orelse false;
10 const enable_macos_sdk = b.option(bool, "enable_macos_sdk", "Run tests requiring presence of macOS SDK and frameworks") orelse enable_ios_sdk;10 const enable_macos_sdk = b.option(bool, "enable_macos_sdk", "Run tests requiring presence of macOS SDK and frameworks") orelse enable_ios_sdk;
11 const enable_symlinks_windows = b.option(bool, "enable_symlinks_windows", "Run tests requiring presence of symlinks on Windows") orelse false;11 const enable_symlinks_windows = b.option(bool, "enable_symlinks_windows", "Run tests requiring presence of symlinks on Windows") orelse false;
12 const omit_symlinks = builtin.os.tag == .windows and !enable_symlinks_windows;12 const has_symlinks = builtin.os.tag != .windows or enable_symlinks_windows;
1313
14 const build_opts: link.BuildOptions = .{14 const build_opts: link.BuildOptions = .{
15 .has_ios_sdk = enable_ios_sdk,15 .has_ios_sdk = enable_ios_sdk,
16 .has_macos_sdk = enable_macos_sdk,16 .has_macos_sdk = enable_macos_sdk,
17 .has_symlinks_windows = omit_symlinks,17 .has_symlinks = has_symlinks,
18 };18 };
19 step.dependOn(@import("elf.zig").testAll(b, build_opts));19 step.dependOn(@import("elf.zig").testAll(b, build_opts));
20 step.dependOn(@import("macho.zig").testAll(b, build_opts));20 step.dependOn(@import("macho.zig").testAll(b, build_opts));
...@@ -36,7 +36,7 @@ pub fn build(b: *std.Build) void {...@@ -36,7 +36,7 @@ pub fn build(b: *std.Build) void {
36 pkg.build_zig.requires_macos_sdk;36 pkg.build_zig.requires_macos_sdk;
37 const requires_symlinks = @hasDecl(pkg.build_zig, "requires_symlinks") and37 const requires_symlinks = @hasDecl(pkg.build_zig, "requires_symlinks") and
38 pkg.build_zig.requires_symlinks;38 pkg.build_zig.requires_symlinks;
39 if ((requires_symlinks and omit_symlinks) or39 if ((requires_symlinks and !has_symlinks) or
40 (requires_macos_sdk and !enable_macos_sdk) or40 (requires_macos_sdk and !enable_macos_sdk) or
41 (requires_ios_sdk and !enable_ios_sdk))41 (requires_ios_sdk and !enable_ios_sdk))
42 {42 {
test/link/link.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1pub const BuildOptions = struct {1pub const BuildOptions = struct {
2 has_macos_sdk: bool,2 has_macos_sdk: bool,
3 has_ios_sdk: bool,3 has_ios_sdk: bool,
4 has_symlinks_windows: bool,4 has_symlinks: bool,
5};5};
66
7pub const Options = struct {7pub const Options = struct {
test/link/macho.zig+5-5
...@@ -62,8 +62,8 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {...@@ -62,8 +62,8 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
62 .os_version_min = .{ .semver = .{ .major = 10, .minor = 13, .patch = 0 } },62 .os_version_min = .{ .semver = .{ .major = 10, .minor = 13, .patch = 0 } },
63 }) }));63 }) }));
6464
65 // Tests requiring symlinks when tested on Windows65 // Tests requiring symlinks
66 if (build_opts.has_symlinks_windows) {66 if (build_opts.has_symlinks) {
67 macho_step.dependOn(testEntryPointArchive(b, .{ .target = default_target }));67 macho_step.dependOn(testEntryPointArchive(b, .{ .target = default_target }));
68 macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));68 macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));
69 macho_step.dependOn(testDylib(b, .{ .target = default_target }));69 macho_step.dependOn(testDylib(b, .{ .target = default_target }));
...@@ -836,9 +836,9 @@ fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step {...@@ -836,9 +836,9 @@ fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step {
836 ,836 ,
837 .cpp_source_flags = &.{ "-nostdlib++", "-nostdinc++" },837 .cpp_source_flags = &.{ "-nostdlib++", "-nostdinc++" },
838 });838 });
839 exe.root_module.addSystemIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include" })));839 exe.root_module.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
840 exe.root_module.addIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include/c++/v1" })));840 exe.root_module.addIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }) });
841 exe.root_module.addObjectFile(b.path(b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" })));841 exe.root_module.addObjectFile(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }) });
842842
843 const check = exe.checkObject();843 const check = exe.checkObject();
844 check.checkInSymtab();844 check.checkInSymtab();