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");...@@ -20,6 +20,7 @@ pub const StackTracesContext = @import("src/StackTrace.zig");
20pub const DebuggerContext = @import("src/Debugger.zig");20pub const DebuggerContext = @import("src/Debugger.zig");
2121
22const TestTarget = struct {22const TestTarget = struct {
23 linkage: ?std.builtin.LinkMode = null,
23 target: std.Target.Query = .{},24 target: std.Target.Query = .{},
24 optimize_mode: std.builtin.OptimizeMode = .Debug,25 optimize_mode: std.builtin.OptimizeMode = .Debug,
25 link_libc: ?bool = null,26 link_libc: ?bool = null,
...@@ -30,8 +31,9 @@ const TestTarget = struct {...@@ -30,8 +31,9 @@ const TestTarget = struct {
30 strip: ?bool = null,31 strip: ?bool = null,
31 skip_modules: []const []const u8 = &.{},32 skip_modules: []const []const u8 = &.{},
3233
33 // This is intended for targets that are known to be slow to compile, or require a newer LLVM34 // This is intended for targets that, for any reason, shouldn't be run as part of a normal test
34 // version than is present on the CI machines, etc.35 // invocation. This could be because of a slow backend, requiring a newer LLVM version, being
36 // too niche, etc.
35 extra_target: bool = false,37 extra_target: bool = false,
36};38};
3739
...@@ -240,6 +242,15 @@ const test_targets = blk: {...@@ -240,6 +242,15 @@ const test_targets = blk: {
240 },242 },
241 .link_libc = true,243 .link_libc = true,
242 },244 },
245 .{
246 .target = .{
247 .cpu_arch = .x86_64,
248 .os_tag = .linux,
249 .abi = .musl,
250 },
251 .linkage = .dynamic,
252 .link_libc = true,
253 },
243 .{254 .{
244 .target = .{255 .target = .{
245 .cpu_arch = .x86_64,256 .cpu_arch = .x86_64,
...@@ -248,6 +259,16 @@ const test_targets = blk: {...@@ -248,6 +259,16 @@ const test_targets = blk: {
248 },259 },
249 .link_libc = true,260 .link_libc = true,
250 },261 },
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 },
251 .{272 .{
252 .target = .{273 .target = .{
253 .cpu_arch = .x86_64,274 .cpu_arch = .x86_64,
...@@ -273,6 +294,17 @@ const test_targets = blk: {...@@ -273,6 +294,17 @@ const test_targets = blk: {
273 },294 },
274 .link_libc = true,295 .link_libc = true,
275 },296 },
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 // },
276 .{308 .{
277 .target = .{309 .target = .{
278 .cpu_arch = .x86,310 .cpu_arch = .x86,
...@@ -297,6 +329,15 @@ const test_targets = blk: {...@@ -297,6 +329,15 @@ const test_targets = blk: {
297 },329 },
298 .link_libc = true,330 .link_libc = true,
299 },331 },
332 .{
333 .target = .{
334 .cpu_arch = .aarch64,
335 .os_tag = .linux,
336 .abi = .musl,
337 },
338 .linkage = .dynamic,
339 .link_libc = true,
340 },
300 .{341 .{
301 .target = .{342 .target = .{
302 .cpu_arch = .aarch64,343 .cpu_arch = .aarch64,
...@@ -329,6 +370,16 @@ const test_targets = blk: {...@@ -329,6 +370,16 @@ const test_targets = blk: {
329 },370 },
330 .link_libc = true,371 .link_libc = true,
331 },372 },
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 },
332 .{383 .{
333 .target = .{384 .target = .{
334 .cpu_arch = .aarch64_be,385 .cpu_arch = .aarch64_be,
...@@ -360,6 +411,17 @@ const test_targets = blk: {...@@ -360,6 +411,17 @@ const test_targets = blk: {
360 },411 },
361 .link_libc = true,412 .link_libc = true,
362 },413 },
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 // },
363 .{425 .{
364 .target = .{426 .target = .{
365 .cpu_arch = .arm,427 .cpu_arch = .arm,
...@@ -368,6 +430,17 @@ const test_targets = blk: {...@@ -368,6 +430,17 @@ const test_targets = blk: {
368 },430 },
369 .link_libc = true,431 .link_libc = true,
370 },432 },
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 // },
371 .{444 .{
372 .target = .{445 .target = .{
373 .cpu_arch = .arm,446 .cpu_arch = .arm,
...@@ -407,6 +480,17 @@ const test_targets = blk: {...@@ -407,6 +480,17 @@ const test_targets = blk: {
407 },480 },
408 .link_libc = true,481 .link_libc = true,
409 },482 },
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 // },
410 .{494 .{
411 .target = .{495 .target = .{
412 .cpu_arch = .armeb,496 .cpu_arch = .armeb,
...@@ -415,6 +499,17 @@ const test_targets = blk: {...@@ -415,6 +499,17 @@ const test_targets = blk: {
415 },499 },
416 .link_libc = true,500 .link_libc = true,
417 },501 },
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 // },
418 .{513 .{
419 .target = .{514 .target = .{
420 .cpu_arch = .armeb,515 .cpu_arch = .armeb,
...@@ -516,6 +611,19 @@ const test_targets = blk: {...@@ -516,6 +611,19 @@ const test_targets = blk: {
516 // https://github.com/llvm/llvm-project/pull/111217611 // https://github.com/llvm/llvm-project/pull/111217
517 .skip_modules = &.{"std"},612 .skip_modules = &.{"std"},
518 },613 },
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
520 .{628 .{
521 .target = .{629 .target = .{
...@@ -534,6 +642,17 @@ const test_targets = blk: {...@@ -534,6 +642,17 @@ const test_targets = blk: {
534 .link_libc = true,642 .link_libc = true,
535 .skip_modules = &.{"std"},643 .skip_modules = &.{"std"},
536 },644 },
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 },
537 .{656 .{
538 .target = .{657 .target = .{
539 .cpu_arch = .loongarch64,658 .cpu_arch = .loongarch64,
...@@ -566,6 +685,16 @@ const test_targets = blk: {...@@ -566,6 +685,16 @@ const test_targets = blk: {
566 },685 },
567 .link_libc = true,686 .link_libc = true,
568 },687 },
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 },
569 .{698 .{
570 .target = .{699 .target = .{
571 .cpu_arch = .mips,700 .cpu_arch = .mips,
...@@ -574,6 +703,16 @@ const test_targets = blk: {...@@ -574,6 +703,16 @@ const test_targets = blk: {
574 },703 },
575 .link_libc = true,704 .link_libc = true,
576 },705 },
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 },
577 .{716 .{
578 .target = .{717 .target = .{
579 .cpu_arch = .mips,718 .cpu_arch = .mips,
...@@ -613,6 +752,16 @@ const test_targets = blk: {...@@ -613,6 +752,16 @@ const test_targets = blk: {
613 },752 },
614 .link_libc = true,753 .link_libc = true,
615 },754 },
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 },
616 .{765 .{
617 .target = .{766 .target = .{
618 .cpu_arch = .mipsel,767 .cpu_arch = .mipsel,
...@@ -621,6 +770,16 @@ const test_targets = blk: {...@@ -621,6 +770,16 @@ const test_targets = blk: {
621 },770 },
622 .link_libc = true,771 .link_libc = true,
623 },772 },
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 },
624 .{783 .{
625 .target = .{784 .target = .{
626 .cpu_arch = .mipsel,785 .cpu_arch = .mipsel,
...@@ -653,6 +812,16 @@ const test_targets = blk: {...@@ -653,6 +812,16 @@ const test_targets = blk: {
653 },812 },
654 .link_libc = true,813 .link_libc = true,
655 },814 },
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 },
656 .{825 .{
657 .target = .{826 .target = .{
658 .cpu_arch = .mips64,827 .cpu_arch = .mips64,
...@@ -677,6 +846,16 @@ const test_targets = blk: {...@@ -677,6 +846,16 @@ const test_targets = blk: {
677 },846 },
678 .link_libc = true,847 .link_libc = true,
679 },848 },
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 },
680 .{859 .{
681 .target = .{860 .target = .{
682 .cpu_arch = .mips64el,861 .cpu_arch = .mips64el,
...@@ -708,6 +887,18 @@ const test_targets = blk: {...@@ -708,6 +887,18 @@ const test_targets = blk: {
708 },887 },
709 .link_libc = true,888 .link_libc = true,
710 },889 },
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 },
711 .{902 .{
712 .target = .{903 .target = .{
713 .cpu_arch = .powerpc,904 .cpu_arch = .powerpc,
...@@ -716,6 +907,18 @@ const test_targets = blk: {...@@ -716,6 +907,18 @@ const test_targets = blk: {
716 },907 },
717 .link_libc = true,908 .link_libc = true,
718 },909 },
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 },
719 .{922 .{
720 .target = .{923 .target = .{
721 .cpu_arch = .powerpc,924 .cpu_arch = .powerpc,
...@@ -752,6 +955,16 @@ const test_targets = blk: {...@@ -752,6 +955,16 @@ const test_targets = blk: {
752 },955 },
753 .link_libc = true,956 .link_libc = true,
754 },957 },
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 },
755 // Requires ELFv1 linker support.968 // Requires ELFv1 linker support.
756 // .{969 // .{
757 // .target = .{970 // .target = .{
...@@ -776,6 +989,16 @@ const test_targets = blk: {...@@ -776,6 +989,16 @@ const test_targets = blk: {
776 },989 },
777 .link_libc = true,990 .link_libc = true,
778 },991 },
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 },
779 .{1002 .{
780 .target = .{1003 .target = .{
781 .cpu_arch = .powerpc64le,1004 .cpu_arch = .powerpc64le,
...@@ -814,6 +1037,16 @@ const test_targets = blk: {...@@ -814,6 +1037,16 @@ const test_targets = blk: {
814 },1037 },
815 .link_libc = true,1038 .link_libc = true,
816 },1039 },
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 },
817 .{1050 .{
818 .target = .{1051 .target = .{
819 .cpu_arch = .riscv32,1052 .cpu_arch = .riscv32,
...@@ -852,6 +1085,16 @@ const test_targets = blk: {...@@ -852,6 +1085,16 @@ const test_targets = blk: {
852 },1085 },
853 .link_libc = true,1086 .link_libc = true,
854 },1087 },
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 },
855 .{1098 .{
856 .target = .{1099 .target = .{
857 .cpu_arch = .riscv64,1100 .cpu_arch = .riscv64,
...@@ -885,6 +1128,17 @@ const test_targets = blk: {...@@ -885,6 +1128,17 @@ const test_targets = blk: {
885 },1128 },
886 .link_libc = true,1129 .link_libc = true,
887 },1130 },
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 // },
888 .{1142 .{
889 .target = .{1143 .target = .{
890 .cpu_arch = .s390x,1144 .cpu_arch = .s390x,
...@@ -1518,6 +1772,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1518,6 +1772,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1518 .use_lld = test_target.use_lld,1772 .use_lld = test_target.use_lld,
1519 .zig_lib_dir = b.path("lib"),1773 .zig_lib_dir = b.path("lib"),
1520 });1774 });
1775 these_tests.linkage = test_target.linkage;
1521 if (options.no_builtin) these_tests.no_builtin = true;1776 if (options.no_builtin) these_tests.no_builtin = true;
1522 if (options.build_options) |build_options| {1777 if (options.build_options) |build_options| {
1523 these_tests.root_module.addOptions("build_options", build_options);1778 these_tests.root_module.addOptions("build_options", build_options);
...@@ -1532,11 +1787,14 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1532,11 +1787,14 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1532 else1787 else
1533 "";1788 "";
1534 const use_lld = if (test_target.use_lld == false) "-no-lld" else "";1789 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 "";
1535 const use_pic = if (test_target.pic == true) "-pic" else "";1793 const use_pic = if (test_target.pic == true) "-pic" else "";
15361794
1537 for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path));1795 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}", .{
1540 options.name,1798 options.name,
1541 triple_txt,1799 triple_txt,
1542 model_txt,1800 model_txt,
...@@ -1545,6 +1803,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {...@@ -1545,6 +1803,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
1545 single_threaded_suffix,1803 single_threaded_suffix,
1546 backend_suffix,1804 backend_suffix,
1547 use_lld,1805 use_lld,
1806 linkage_name,
1548 use_pic,1807 use_pic,
1549 });1808 });
15501809