zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 2d3d3c042e99da64df53a533852bd0e27166b4f6 (tree)
parent 77ccbc7ceeae57e7c0b089503f1c7873a88342f4
Author: kcbanner <kcbanner@gmail.com>
Date:   Fri,  5 Jun 2026 01:55:35 -0400

tests: standalone/shared_library runs on all permutations of link_libc and use_llvm

Diffstat:
Mtest/standalone/shared_library/build.zig | 49++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/test/standalone/shared_library/build.zig b/test/standalone/shared_library/build.zig @@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const target = b.standardTargetOptions(.{}); - const exe_names: []const []const u8 = &.{ "test", "test-dync", "test-no-llvm", "test-no-llvm-dync" }; - const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync", "mathtest-no-llvm", "mathtest-no-llvm-dync" }; - const lib_link_libc: []const bool = &.{ false, true, false, true }; - const lib_use_llvm: []const bool = &.{ true, true, false, false }; - - for (exe_names, lib_names, lib_link_libc, lib_use_llvm) |exe_name, lib_name, dyn_libc, use_llvm| { - if (!use_llvm and target.result.os.tag == .macos) continue; // TODO: Library not loaded: @rpath/libmathtest-no-llvm.dylib (segment '__CONST_ZIG' vm address out of order) - if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found - if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found - if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO: duplicate symbol definition: atexit + const exe_names: []const []const u8 = &.{ + "test", + "test-dync", + "test-no-llvm", + "test-no-llvm-dync", + "test-exe-no-llvm", + "test-dync-exe-no-llvm", + "test-no-llvm-exe-no-llvm", + "test-no-llvm-dync-exe-no-llvm", + }; + const lib_names: []const []const u8 = &.{ + "mathtest", + "mathtest-dync", + "mathtest-no-llvm", + "mathtest-no-llvm-dync", + "mathtest-exe-no-llvm", + "mathtest-dync-exe-no-llvm", + "mathtest-no-llvm-exe-no-llvm", + "mathtest-no-llvm-dync-exe-no-llvm", + }; + const lib_link_libc: []const bool = &.{ false, true, false, true, false, true, false, true }; + const lib_use_llvm: []const bool = &.{ true, true, false, false, true, true, false, false }; + const exe_use_llvm: []const bool = &.{ true, true, true, true, false, false, false, false }; + + for ( + exe_names, + lib_names, + lib_link_libc, + lib_use_llvm, + exe_use_llvm, + ) |exe_name, lib_name, dyn_libc, lib_llvm, exe_llvm| { + const use_llvm = lib_llvm or exe_llvm; + if (!use_llvm and target.result.os.tag == .macos) continue; // TODO + if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO + if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO + if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO @@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .link_libc = dyn_libc, }), - .use_llvm = use_llvm, + .use_llvm = lib_llvm, }); const exe = b.addExecutable(.{ @@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .link_libc = true, }), + .use_llvm = exe_llvm, }); exe.root_module.addCSourceFile(.{ .file = b.path("test.c"),