authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-08-16 10:17:53+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-08-16 10:38:52+01:00
log77f7d01a69db8b75b5cbe40b61decc34d616595c
tree7473db4948ee742c419390b3d7d2edce97a9884b
parente9e0ce6c605e36c355fe4b137b795ed935e1e8f3
signaturelock-open Commit is signed but in an unrecognized format.

tests: run some module tests with Elf2

It cannot yet handle the behavior tests or compiler_rt tests due to them using `@export` with `.internal`, but we can at least pass the standard library and libc tests on x86_64.

1 files changed, 36 insertions(+), 2 deletions(-)

test/tests.zig+36-2
......@@ -26,6 +26,7 @@ const ModuleTestTarget = struct {
2626 single_threaded: ?bool = null,
2727 use_llvm: ?bool = null,
2828 use_lld: ?bool = null,
29 new_linker: ?bool = null,
2930 pic: ?bool = null,
3031 strip: ?bool = null,
3132 function_sections: ?bool = null,
......@@ -1288,6 +1289,34 @@ const module_test_targets = blk: {
12881289 },
12891290 .link_libc = true,
12901291 },
1292 .{
1293 .target = .{
1294 .cpu_arch = .x86_64,
1295 .os_tag = .linux,
1296 },
1297 .new_linker = true,
1298 .skip_modules = &.{ "compiler-rt", "behavior" }, // '@export' with '.internal' linkage
1299 },
1300 .{
1301 .target = .{
1302 .cpu_arch = .x86_64,
1303 .os_tag = .linux,
1304 .abi = .musl,
1305 },
1306 .link_libc = true,
1307 .new_linker = true,
1308 .skip_modules = &.{ "compiler-rt", "behavior" }, // '@export' with '.internal' linkage
1309 },
1310 .{
1311 .target = .{
1312 .cpu_arch = .x86_64,
1313 .os_tag = .linux,
1314 .abi = .gnu,
1315 },
1316 .link_libc = true,
1317 .new_linker = true,
1318 .skip_modules = &.{ "compiler-rt", "behavior" }, // '@export' with '.internal' linkage
1319 },
12911320
12921321 // Darwin Targets
12931322
......@@ -2821,6 +2850,7 @@ fn addOneModuleTest(
28212850 .zig_lib_dir = b.path("lib"),
28222851 });
28232852 these_tests.linkage = test_target.linkage;
2853 these_tests.use_new_linker = test_target.new_linker;
28242854 // https://codeberg.org/ziglang/zig/issues/31701
28252855 if (!(mem.eql(u8, options.name, "compiler-rt") or mem.eql(u8, options.name, "libc"))) {
28262856 if (options.no_builtin) these_tests.root_module.no_builtin = true;
......@@ -2847,7 +2877,11 @@ fn addOneModuleTest(
28472877 "-selfhosted"
28482878 else
28492879 "";
2850 const use_lld = if (test_target.use_lld == false) "-no-lld" else "";
2880 const linker_suffix: []const u8 = s: {
2881 if (test_target.new_linker == true) break :s "-new-linker";
2882 if (test_target.use_lld == false) break :s "-no-lld";
2883 break :s "";
2884 };
28512885 const linkage_name = if (test_target.linkage) |linkage| switch (linkage) {
28522886 inline else => |t| "-" ++ @tagName(t),
28532887 } else "";
......@@ -2863,7 +2897,7 @@ fn addOneModuleTest(
28632897 libc_suffix,
28642898 single_threaded_suffix,
28652899 backend_suffix,
2866 use_lld,
2900 linker_suffix,
28672901 linkage_name,
28682902 use_pic,
28692903 });