authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-06 04:52:48+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-08 21:32:22+02:00
log473f36d70f49f469d51b7e015e2e3d3550b56380
treef89c33903f7a49db42852d87cdc7f0720020d5fe
parentc272ddc070f5f09a145a785f28f0dfa24b55575a
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

test: Add dynamic musl targets to the module test matrix.

Most of these are gated by -Dtest-extra-targets because: * We don't really have CI resources to spare at the moment. * They're relatively niche if you're not on a musl distro. * And the few musl distros that exist don't support all these targets. * Quite a few of them are broken and need investigating. x86_64-linux-musl and aarch64-linux-musl are not gated as they're the most common targets that people will be running dynamic musl on, so we'll want to have some bare minimum coverage of those.

1 files changed, 262 insertions(+), 3 deletions(-)

test/tests.zig+262-3
......@@ -20,6 +20,7 @@ pub const StackTracesContext = @import("src/StackTrace.zig");
2020pub const DebuggerContext = @import("src/Debugger.zig");
2121
2222const TestTarget = struct {
23 linkage: ?std.builtin.LinkMode = null,
2324 target: std.Target.Query = .{},
2425 optimize_mode: std.builtin.OptimizeMode = .Debug,
2526 link_libc: ?bool = null,
......@@ -30,8 +31,9 @@ const TestTarget = struct {
3031 strip: ?bool = null,
3132 skip_modules: []const []const u8 = &.{},
3233
33 // This is intended for targets that are known to be slow to compile, or require a newer LLVM
34 // version than is present on the CI machines, etc.
34 // This is intended for targets that, for any reason, shouldn't be run as part of a normal test
35 // invocation. This could be because of a slow backend, requiring a newer LLVM version, being
36 // too niche, etc.
3537 extra_target: bool = false,
3638};
3739
......@@ -240,6 +242,15 @@ const test_targets = blk: {
240242 },
241243 .link_libc = true,
242244 },
245 .{
246 .target = .{
247 .cpu_arch = .x86_64,
248 .os_tag = .linux,
249 .abi = .musl,
250 },
251 .linkage = .dynamic,
252 .link_libc = true,
253 },
243254 .{
244255 .target = .{
245256 .cpu_arch = .x86_64,
......@@ -248,6 +259,16 @@ const test_targets = blk: {
248259 },
249260 .link_libc = true,
250261 },
262 .{
263 .target = .{
264 .cpu_arch = .x86_64,
265 .os_tag = .linux,
266 .abi = .muslx32,
267 },
268 .linkage = .dynamic,
269 .link_libc = true,
270 .extra_target = true,
271 },
251272 .{
252273 .target = .{
253274 .cpu_arch = .x86_64,
......@@ -273,6 +294,17 @@ const test_targets = blk: {
273294 },
274295 .link_libc = true,
275296 },
297 // https://github.com/ziglang/zig/issues/7935
298 // .{
299 // .target = .{
300 // .cpu_arch = .x86,
301 // .os_tag = .linux,
302 // .abi = .musl,
303 // },
304 // .linkage = .dynamic,
305 // .link_libc = true,
306 // .extra_target = true,
307 // },
276308 .{
277309 .target = .{
278310 .cpu_arch = .x86,
......@@ -297,6 +329,15 @@ const test_targets = blk: {
297329 },
298330 .link_libc = true,
299331 },
332 .{
333 .target = .{
334 .cpu_arch = .aarch64,
335 .os_tag = .linux,
336 .abi = .musl,
337 },
338 .linkage = .dynamic,
339 .link_libc = true,
340 },
300341 .{
301342 .target = .{
302343 .cpu_arch = .aarch64,
......@@ -329,6 +370,16 @@ const test_targets = blk: {
329370 },
330371 .link_libc = true,
331372 },
373 .{
374 .target = .{
375 .cpu_arch = .aarch64_be,
376 .os_tag = .linux,
377 .abi = .musl,
378 },
379 .linkage = .dynamic,
380 .link_libc = true,
381 .extra_target = true,
382 },
332383 .{
333384 .target = .{
334385 .cpu_arch = .aarch64_be,
......@@ -360,6 +411,17 @@ const test_targets = blk: {
360411 },
361412 .link_libc = true,
362413 },
414 // Crashes in weird ways when applying relocations.
415 // .{
416 // .target = .{
417 // .cpu_arch = .arm,
418 // .os_tag = .linux,
419 // .abi = .musleabi,
420 // },
421 // .linkage = .dynamic,
422 // .link_libc = true,
423 // .extra_target = true,
424 // },
363425 .{
364426 .target = .{
365427 .cpu_arch = .arm,
......@@ -368,6 +430,17 @@ const test_targets = blk: {
368430 },
369431 .link_libc = true,
370432 },
433 // Crashes in weird ways when applying relocations.
434 // .{
435 // .target = .{
436 // .cpu_arch = .arm,
437 // .os_tag = .linux,
438 // .abi = .musleabihf,
439 // },
440 // .linkage = .dynamic,
441 // .link_libc = true,
442 // .extra_target = true,
443 // },
371444 .{
372445 .target = .{
373446 .cpu_arch = .arm,
......@@ -407,6 +480,17 @@ const test_targets = blk: {
407480 },
408481 .link_libc = true,
409482 },
483 // Crashes in weird ways when applying relocations.
484 // .{
485 // .target = .{
486 // .cpu_arch = .armeb,
487 // .os_tag = .linux,
488 // .abi = .musleabi,
489 // },
490 // .linkage = .dynamic,
491 // .link_libc = true,
492 // .extra_target = true,
493 // },
410494 .{
411495 .target = .{
412496 .cpu_arch = .armeb,
......@@ -415,6 +499,17 @@ const test_targets = blk: {
415499 },
416500 .link_libc = true,
417501 },
502 // Crashes in weird ways when applying relocations.
503 // .{
504 // .target = .{
505 // .cpu_arch = .armeb,
506 // .os_tag = .linux,
507 // .abi = .musleabihf,
508 // },
509 // .linkage = .dynamic,
510 // .link_libc = true,
511 // .extra_target = true,
512 // },
418513 .{
419514 .target = .{
420515 .cpu_arch = .armeb,
......@@ -516,6 +611,19 @@ const test_targets = blk: {
516611 // https://github.com/llvm/llvm-project/pull/111217
517612 .skip_modules = &.{"std"},
518613 },
614 // Currently crashes in qemu-hexagon.
615 // .{
616 // .target = .{
617 // .cpu_arch = .hexagon,
618 // .os_tag = .linux,
619 // .abi = .musl,
620 // },
621 // .linkage = .dynamic,
622 // .link_libc = true,
623 // // https://github.com/llvm/llvm-project/pull/111217
624 // .skip_modules = &.{"std"},
625 // .extra_target = true,
626 // },
519627
520628 .{
521629 .target = .{
......@@ -534,6 +642,17 @@ const test_targets = blk: {
534642 .link_libc = true,
535643 .skip_modules = &.{"std"},
536644 },
645 .{
646 .target = .{
647 .cpu_arch = .loongarch64,
648 .os_tag = .linux,
649 .abi = .musl,
650 },
651 .linkage = .dynamic,
652 .link_libc = true,
653 .skip_modules = &.{"std"},
654 .extra_target = true,
655 },
537656 .{
538657 .target = .{
539658 .cpu_arch = .loongarch64,
......@@ -566,6 +685,16 @@ const test_targets = blk: {
566685 },
567686 .link_libc = true,
568687 },
688 .{
689 .target = .{
690 .cpu_arch = .mips,
691 .os_tag = .linux,
692 .abi = .musleabi,
693 },
694 .linkage = .dynamic,
695 .link_libc = true,
696 .extra_target = true,
697 },
569698 .{
570699 .target = .{
571700 .cpu_arch = .mips,
......@@ -574,6 +703,16 @@ const test_targets = blk: {
574703 },
575704 .link_libc = true,
576705 },
706 .{
707 .target = .{
708 .cpu_arch = .mips,
709 .os_tag = .linux,
710 .abi = .musleabihf,
711 },
712 .linkage = .dynamic,
713 .link_libc = true,
714 .extra_target = true,
715 },
577716 .{
578717 .target = .{
579718 .cpu_arch = .mips,
......@@ -613,6 +752,16 @@ const test_targets = blk: {
613752 },
614753 .link_libc = true,
615754 },
755 .{
756 .target = .{
757 .cpu_arch = .mipsel,
758 .os_tag = .linux,
759 .abi = .musleabi,
760 },
761 .linkage = .dynamic,
762 .link_libc = true,
763 .extra_target = true,
764 },
616765 .{
617766 .target = .{
618767 .cpu_arch = .mipsel,
......@@ -621,6 +770,16 @@ const test_targets = blk: {
621770 },
622771 .link_libc = true,
623772 },
773 .{
774 .target = .{
775 .cpu_arch = .mipsel,
776 .os_tag = .linux,
777 .abi = .musleabihf,
778 },
779 .linkage = .dynamic,
780 .link_libc = true,
781 .extra_target = true,
782 },
624783 .{
625784 .target = .{
626785 .cpu_arch = .mipsel,
......@@ -653,6 +812,16 @@ const test_targets = blk: {
653812 },
654813 .link_libc = true,
655814 },
815 .{
816 .target = .{
817 .cpu_arch = .mips64,
818 .os_tag = .linux,
819 .abi = .muslabi64,
820 },
821 .linkage = .dynamic,
822 .link_libc = true,
823 .extra_target = true,
824 },
656825 .{
657826 .target = .{
658827 .cpu_arch = .mips64,
......@@ -677,6 +846,16 @@ const test_targets = blk: {
677846 },
678847 .link_libc = true,
679848 },
849 .{
850 .target = .{
851 .cpu_arch = .mips64el,
852 .os_tag = .linux,
853 .abi = .muslabi64,
854 },
855 .linkage = .dynamic,
856 .link_libc = true,
857 .extra_target = true,
858 },
680859 .{
681860 .target = .{
682861 .cpu_arch = .mips64el,
......@@ -708,6 +887,18 @@ const test_targets = blk: {
708887 },
709888 .link_libc = true,
710889 },
890 .{
891 .target = .{
892 .cpu_arch = .powerpc,
893 .os_tag = .linux,
894 .abi = .musleabi,
895 },
896 .linkage = .dynamic,
897 .link_libc = true,
898 // https://github.com/ziglang/zig/issues/2256
899 .skip_modules = &.{"std"},
900 .extra_target = true,
901 },
711902 .{
712903 .target = .{
713904 .cpu_arch = .powerpc,
......@@ -716,6 +907,18 @@ const test_targets = blk: {
716907 },
717908 .link_libc = true,
718909 },
910 .{
911 .target = .{
912 .cpu_arch = .powerpc,
913 .os_tag = .linux,
914 .abi = .musleabihf,
915 },
916 .linkage = .dynamic,
917 .link_libc = true,
918 // https://github.com/ziglang/zig/issues/2256
919 .skip_modules = &.{"std"},
920 .extra_target = true,
921 },
719922 .{
720923 .target = .{
721924 .cpu_arch = .powerpc,
......@@ -752,6 +955,16 @@ const test_targets = blk: {
752955 },
753956 .link_libc = true,
754957 },
958 .{
959 .target = .{
960 .cpu_arch = .powerpc64,
961 .os_tag = .linux,
962 .abi = .musl,
963 },
964 .linkage = .dynamic,
965 .link_libc = true,
966 .extra_target = true,
967 },
755968 // Requires ELFv1 linker support.
756969 // .{
757970 // .target = .{
......@@ -776,6 +989,16 @@ const test_targets = blk: {
776989 },
777990 .link_libc = true,
778991 },
992 .{
993 .target = .{
994 .cpu_arch = .powerpc64le,
995 .os_tag = .linux,
996 .abi = .musl,
997 },
998 .linkage = .dynamic,
999 .link_libc = true,
1000 .extra_target = true,
1001 },
7791002 .{
7801003 .target = .{
7811004 .cpu_arch = .powerpc64le,
......@@ -814,6 +1037,16 @@ const test_targets = blk: {
8141037 },
8151038 .link_libc = true,
8161039 },
1040 .{
1041 .target = .{
1042 .cpu_arch = .riscv32,
1043 .os_tag = .linux,
1044 .abi = .musl,
1045 },
1046 .linkage = .dynamic,
1047 .link_libc = true,
1048 .extra_target = true,
1049 },
8171050 .{
8181051 .target = .{
8191052 .cpu_arch = .riscv32,
......@@ -852,6 +1085,16 @@ const test_targets = blk: {
8521085 },
8531086 .link_libc = true,
8541087 },
1088 .{
1089 .target = .{
1090 .cpu_arch = .riscv64,
1091 .os_tag = .linux,
1092 .abi = .musl,
1093 },
1094 .linkage = .dynamic,
1095 .link_libc = true,
1096 .extra_target = true,
1097 },
8551098 .{
8561099 .target = .{
8571100 .cpu_arch = .riscv64,
......@@ -885,6 +1128,17 @@ const test_targets = blk: {
8851128 },
8861129 .link_libc = true,
8871130 },
1131 // Currently hangs in qemu-s390x.
1132 // .{
1133 // .target = .{
1134 // .cpu_arch = .s390x,
1135 // .os_tag = .linux,
1136 // .abi = .musl,
1137 // },
1138 // .linkage = .dynamic,
1139 // .link_libc = true,
1140 // .extra_target = true,
1141 // },
8881142 .{
8891143 .target = .{
8901144 .cpu_arch = .s390x,
......@@ -1518,6 +1772,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
15181772 .use_lld = test_target.use_lld,
15191773 .zig_lib_dir = b.path("lib"),
15201774 });
1775 these_tests.linkage = test_target.linkage;
15211776 if (options.no_builtin) these_tests.no_builtin = true;
15221777 if (options.build_options) |build_options| {
15231778 these_tests.root_module.addOptions("build_options", build_options);
......@@ -1532,11 +1787,14 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
15321787 else
15331788 "";
15341789 const use_lld = if (test_target.use_lld == false) "-no-lld" else "";
1790 const linkage_name = if (test_target.linkage) |linkage| switch (linkage) {
1791 inline else => |t| "-" ++ @tagName(t),
1792 } else "";
15351793 const use_pic = if (test_target.pic == true) "-pic" else "";
15361794
15371795 for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path));
15381796
1539 const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{
1797 const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}{s}", .{
15401798 options.name,
15411799 triple_txt,
15421800 model_txt,
......@@ -1545,6 +1803,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
15451803 single_threaded_suffix,
15461804 backend_suffix,
15471805 use_lld,
1806 linkage_name,
15481807 use_pic,
15491808 });
15501809