authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2026-06-05 01:55:35-04:00
committergravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2026-06-23 00:26:56-04:00
log2d3d3c042e99da64df53a533852bd0e27166b4f6
tree2b9ed8b34321831073ce580c628809491b1d8c61
parent77ccbc7ceeae57e7c0b089503f1c7873a88342f4

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


1 files changed, 38 insertions(+), 11 deletions(-)

test/standalone/shared_library/build.zig+38-11
...@@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void {...@@ -7,16 +7,42 @@ pub fn build(b: *std.Build) void {
7 const optimize: std.builtin.OptimizeMode = .Debug;7 const optimize: std.builtin.OptimizeMode = .Debug;
8 const target = b.standardTargetOptions(.{});8 const target = b.standardTargetOptions(.{});
99
10 const exe_names: []const []const u8 = &.{ "test", "test-dync", "test-no-llvm", "test-no-llvm-dync" };10 const exe_names: []const []const u8 = &.{
11 const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync", "mathtest-no-llvm", "mathtest-no-llvm-dync" };11 "test",
12 const lib_link_libc: []const bool = &.{ false, true, false, true };12 "test-dync",
13 const lib_use_llvm: []const bool = &.{ true, true, false, false };13 "test-no-llvm",
1414 "test-no-llvm-dync",
15 for (exe_names, lib_names, lib_link_libc, lib_use_llvm) |exe_name, lib_name, dyn_libc, use_llvm| {15 "test-exe-no-llvm",
16 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)16 "test-dync-exe-no-llvm",
17 if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found17 "test-no-llvm-exe-no-llvm",
18 if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found18 "test-no-llvm-dync-exe-no-llvm",
19 if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO: duplicate symbol definition: atexit19 };
20 const lib_names: []const []const u8 = &.{
21 "mathtest",
22 "mathtest-dync",
23 "mathtest-no-llvm",
24 "mathtest-no-llvm-dync",
25 "mathtest-exe-no-llvm",
26 "mathtest-dync-exe-no-llvm",
27 "mathtest-no-llvm-exe-no-llvm",
28 "mathtest-no-llvm-dync-exe-no-llvm",
29 };
30 const lib_link_libc: []const bool = &.{ false, true, false, true, false, true, false, true };
31 const lib_use_llvm: []const bool = &.{ true, true, false, false, true, true, false, false };
32 const exe_use_llvm: []const bool = &.{ true, true, true, true, false, false, false, false };
33
34 for (
35 exe_names,
36 lib_names,
37 lib_link_libc,
38 lib_use_llvm,
39 exe_use_llvm,
40 ) |exe_name, lib_name, dyn_libc, lib_llvm, exe_llvm| {
41 const use_llvm = lib_llvm or exe_llvm;
42 if (!use_llvm and target.result.os.tag == .macos) continue; // TODO
43 if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO
44 if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO
45 if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO
20 if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO46 if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO
21 if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO47 if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO
22 if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO48 if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO
...@@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void {...@@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void {
31 .optimize = optimize,57 .optimize = optimize,
32 .link_libc = dyn_libc,58 .link_libc = dyn_libc,
33 }),59 }),
34 .use_llvm = use_llvm,60 .use_llvm = lib_llvm,
35 });61 });
3662
37 const exe = b.addExecutable(.{63 const exe = b.addExecutable(.{
...@@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void {...@@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void {
42 .optimize = optimize,68 .optimize = optimize,
43 .link_libc = true,69 .link_libc = true,
44 }),70 }),
71 .use_llvm = exe_llvm,
45 });72 });
46 exe.root_module.addCSourceFile(.{73 exe.root_module.addCSourceFile(.{
47 .file = b.path("test.c"),74 .file = b.path("test.c"),