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 {
77 const optimize: std.builtin.OptimizeMode = .Debug;
88 const target = b.standardTargetOptions(.{});
99
10 const exe_names: []const []const u8 = &.{ "test", "test-dync", "test-no-llvm", "test-no-llvm-dync" };
11 const lib_names: []const []const u8 = &.{ "mathtest", "mathtest-dync", "mathtest-no-llvm", "mathtest-no-llvm-dync" };
12 const lib_link_libc: []const bool = &.{ false, true, false, true };
13 const lib_use_llvm: []const bool = &.{ true, true, false, false };
14
15 for (exe_names, lib_names, lib_link_libc, lib_use_llvm) |exe_name, lib_name, dyn_libc, use_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)
17 if (!use_llvm and target.result.os.tag == .freebsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found
18 if (!use_llvm and target.result.os.tag == .netbsd) continue; // TODO: Shared object "libmathtest-no-llvm.so.1" not found
19 if (!use_llvm and target.result.os.tag == .openbsd) continue; // TODO: duplicate symbol definition: atexit
10 const exe_names: []const []const u8 = &.{
11 "test",
12 "test-dync",
13 "test-no-llvm",
14 "test-no-llvm-dync",
15 "test-exe-no-llvm",
16 "test-dync-exe-no-llvm",
17 "test-no-llvm-exe-no-llvm",
18 "test-no-llvm-dync-exe-no-llvm",
19 };
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
2046 if (!use_llvm and target.result.cpu.arch == .loongarch64) continue; // TODO
2147 if (!use_llvm and target.result.cpu.arch == .powerpc64le) continue; // TODO
2248 if (!use_llvm and target.result.cpu.arch == .s390x) continue; // TODO
......@@ -31,7 +57,7 @@ pub fn build(b: *std.Build) void {
3157 .optimize = optimize,
3258 .link_libc = dyn_libc,
3359 }),
34 .use_llvm = use_llvm,
60 .use_llvm = lib_llvm,
3561 });
3662
3763 const exe = b.addExecutable(.{
......@@ -42,6 +68,7 @@ pub fn build(b: *std.Build) void {
4268 .optimize = optimize,
4369 .link_libc = true,
4470 }),
71 .use_llvm = exe_llvm,
4572 });
4673 exe.root_module.addCSourceFile(.{
4774 .file = b.path("test.c"),