Merge pull request #23810 from alexrp/more-test-targets

This commit is contained in:
Alex Rønne Petersen 2025-05-11 20:52:47 +02:00 committed by GitHub
commit c3906718b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 378 additions and 61 deletions

View File

@ -241,8 +241,9 @@ pub fn main() !void {
// but it is handled by the parent process. The build runner // but it is handled by the parent process. The build runner
// only sees this flag. // only sees this flag.
graph.system_package_mode = true; graph.system_package_mode = true;
} else if (mem.eql(u8, arg, "--glibc-runtimes")) { } else if (mem.eql(u8, arg, "--libc-runtimes") or mem.eql(u8, arg, "--glibc-runtimes")) {
builder.glibc_runtimes_dir = nextArgOrFatal(args, &arg_idx); // --glibc-runtimes was the old name of the flag; kept for compatibility for now.
builder.libc_runtimes_dir = nextArgOrFatal(args, &arg_idx);
} else if (mem.eql(u8, arg, "--verbose-link")) { } else if (mem.eql(u8, arg, "--verbose-link")) {
builder.verbose_link = true; builder.verbose_link = true;
} else if (mem.eql(u8, arg, "--verbose-air")) { } else if (mem.eql(u8, arg, "--verbose-air")) {
@ -1279,9 +1280,10 @@ fn usage(b: *std.Build, out_stream: anytype) !void {
\\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute
\\ foreign-architecture programs on Linux hosts \\ foreign-architecture programs on Linux hosts
\\ (default: no) \\ (default: no)
\\ --glibc-runtimes [path] Enhances QEMU integration by providing glibc built \\ --libc-runtimes [path] Enhances QEMU integration by providing dynamic libc
\\ for multiple foreign architectures, allowing \\ (e.g. glibc or musl) built for multiple foreign
\\ execution of non-native programs that link with glibc. \\ architectures, allowing execution of non-native
\\ programs that link with libc.
\\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on
\\ ARM64 macOS hosts. (default: no) \\ ARM64 macOS hosts. (default: no)
\\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to

View File

@ -79,7 +79,8 @@ enable_wine: bool = false,
/// this will be the directory $glibc-build-dir/install/glibcs /// this will be the directory $glibc-build-dir/install/glibcs
/// Given the example of the aarch64 target, this is the directory /// Given the example of the aarch64 target, this is the directory
/// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`. /// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.
glibc_runtimes_dir: ?[]const u8 = null, /// Also works for dynamic musl.
libc_runtimes_dir: ?[]const u8 = null,
dep_prefix: []const u8 = "", dep_prefix: []const u8 = "",
@ -390,7 +391,7 @@ fn createChildOnly(
.enable_rosetta = parent.enable_rosetta, .enable_rosetta = parent.enable_rosetta,
.enable_wasmtime = parent.enable_wasmtime, .enable_wasmtime = parent.enable_wasmtime,
.enable_wine = parent.enable_wine, .enable_wine = parent.enable_wine,
.glibc_runtimes_dir = parent.glibc_runtimes_dir, .libc_runtimes_dir = parent.libc_runtimes_dir,
.dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }), .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),
.modules = .init(allocator), .modules = .init(allocator),
.named_writefiles = .init(allocator), .named_writefiles = .init(allocator),

View File

@ -1026,11 +1026,11 @@ fn runCommand(
} }
const root_target = exe.rootModuleTarget(); const root_target = exe.rootModuleTarget();
const need_cross_glibc = root_target.isGnuLibC() and const need_cross_libc = exe.is_linking_libc and
exe.is_linking_libc; (root_target.isGnuLibC() or (root_target.isMuslLibC() and exe.linkage == .dynamic));
const other_target = exe.root_module.resolved_target.?.result; const other_target = exe.root_module.resolved_target.?.result;
switch (std.zig.system.getExternalExecutor(b.graph.host.result, &other_target, .{ switch (std.zig.system.getExternalExecutor(b.graph.host.result, &other_target, .{
.qemu_fixes_dl = need_cross_glibc and b.glibc_runtimes_dir != null, .qemu_fixes_dl = need_cross_libc and b.libc_runtimes_dir != null,
.link_libc = exe.is_linking_libc, .link_libc = exe.is_linking_libc,
})) { })) {
.native, .rosetta => { .native, .rosetta => {
@ -1047,31 +1047,29 @@ fn runCommand(
}, },
.qemu => |bin_name| { .qemu => |bin_name| {
if (b.enable_qemu) { if (b.enable_qemu) {
const glibc_dir_arg = if (need_cross_glibc)
b.glibc_runtimes_dir orelse
return failForeign(run, "--glibc-runtimes", argv[0], exe)
else
null;
try interp_argv.append(bin_name); try interp_argv.append(bin_name);
if (glibc_dir_arg) |dir| { if (need_cross_libc) {
try interp_argv.append("-L"); if (b.libc_runtimes_dir) |dir| {
try interp_argv.append(b.pathJoin(&.{ try interp_argv.append("-L");
dir, try interp_argv.append(b.pathJoin(&.{
try std.zig.target.glibcRuntimeTriple( dir,
b.allocator, try if (root_target.isGnuLibC()) std.zig.target.glibcRuntimeTriple(
root_target.cpu.arch, b.allocator,
root_target.os.tag, root_target.cpu.arch,
root_target.abi, root_target.os.tag,
), root_target.abi,
})); ) else if (root_target.isMuslLibC()) std.zig.target.muslRuntimeTriple(
b.allocator,
root_target.cpu.arch,
root_target.abi,
) else unreachable,
}));
} else return failForeign(run, "--libc-runtimes", argv[0], exe);
} }
try interp_argv.appendSlice(argv); try interp_argv.appendSlice(argv);
} else { } else return failForeign(run, "-fqemu", argv[0], exe);
return failForeign(run, "-fqemu", argv[0], exe);
}
}, },
.darling => |bin_name| { .darling => |bin_name| {
if (b.enable_darling) { if (b.enable_darling) {

View File

@ -838,7 +838,6 @@ pub const Abi = enum {
.aix => if (arch == .powerpc) .eabihf else .none, .aix => if (arch == .powerpc) .eabihf else .none,
.haiku => switch (arch) { .haiku => switch (arch) {
.arm, .arm,
.thumb,
.powerpc, .powerpc,
=> .eabihf, => .eabihf,
else => .none, else => .none,
@ -877,22 +876,13 @@ pub const Abi = enum {
}, },
.freebsd => switch (arch) { .freebsd => switch (arch) {
.arm, .arm,
.armeb,
.thumb,
.thumbeb,
.powerpc, .powerpc,
=> .eabihf, => .eabihf,
// Soft float tends to be more common for MIPS.
.mips,
.mipsel,
=> .eabi,
else => .none, else => .none,
}, },
.netbsd => switch (arch) { .netbsd => switch (arch) {
.arm, .arm,
.armeb, .armeb,
.thumb,
.thumbeb,
.powerpc, .powerpc,
=> .eabihf, => .eabihf,
// Soft float tends to be more common for MIPS. // Soft float tends to be more common for MIPS.
@ -903,7 +893,6 @@ pub const Abi = enum {
}, },
.openbsd => switch (arch) { .openbsd => switch (arch) {
.arm, .arm,
.thumb,
=> .eabi, => .eabi,
.powerpc, .powerpc,
=> .eabihf, => .eabihf,
@ -2205,7 +2194,6 @@ pub const DynamicLinker = struct {
.haiku => switch (cpu.arch) { .haiku => switch (cpu.arch) {
.arm, .arm,
.thumb,
.aarch64, .aarch64,
.m68k, .m68k,
.powerpc, .powerpc,
@ -2234,9 +2222,7 @@ pub const DynamicLinker = struct {
.linux => if (abi.isAndroid()) .linux => if (abi.isAndroid())
switch (cpu.arch) { switch (cpu.arch) {
.arm, .arm => if (abi == .androideabi) init("/system/bin/linker") else none,
.thumb,
=> if (abi == .androideabi) init("/system/bin/linker") else none,
.aarch64, .aarch64,
.riscv64, .riscv64,
@ -2454,19 +2440,11 @@ pub const DynamicLinker = struct {
.freebsd => switch (cpu.arch) { .freebsd => switch (cpu.arch) {
.arm, .arm,
.armeb,
.thumb,
.thumbeb,
.aarch64, .aarch64,
.mips,
.mipsel,
.mips64,
.mips64el,
.powerpc, .powerpc,
.powerpc64, .powerpc64,
.powerpc64le, .powerpc64le,
.riscv64, .riscv64,
.sparc64,
.x86, .x86,
.x86_64, .x86_64,
=> initFmt("{s}/libexec/ld-elf.so.1", .{ => initFmt("{s}/libexec/ld-elf.so.1", .{
@ -2481,8 +2459,6 @@ pub const DynamicLinker = struct {
.netbsd => switch (cpu.arch) { .netbsd => switch (cpu.arch) {
.arm, .arm,
.armeb, .armeb,
.thumb,
.thumbeb,
.aarch64, .aarch64,
.aarch64_be, .aarch64_be,
.m68k, .m68k,
@ -2491,6 +2467,8 @@ pub const DynamicLinker = struct {
.mips64, .mips64,
.mips64el, .mips64el,
.powerpc, .powerpc,
.powerpc64,
.riscv32,
.riscv64, .riscv64,
.sparc, .sparc,
.sparc64, .sparc64,
@ -2502,7 +2480,6 @@ pub const DynamicLinker = struct {
.openbsd => switch (cpu.arch) { .openbsd => switch (cpu.arch) {
.arm, .arm,
.thumb,
.aarch64, .aarch64,
.mips64, .mips64,
.mips64el, .mips64el,
@ -2530,11 +2507,16 @@ pub const DynamicLinker = struct {
}, },
.illumos, .illumos,
=> switch (cpu.arch) {
.x86,
.x86_64,
=> initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}),
else => none,
},
.solaris, .solaris,
=> switch (cpu.arch) { => switch (cpu.arch) {
.sparc,
.sparc64, .sparc64,
.x86,
.x86_64, .x86_64,
=> initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}), => initFmt("/lib/{s}ld.so.1", .{if (ptrBitWidth_cpu_abi(cpu, .none) == 64) "64/" else ""}),
else => none, else => none,

View File

@ -1394,6 +1394,7 @@ test "pwritev, preadv" {
test "setEndPos" { test "setEndPos" {
// https://github.com/ziglang/zig/issues/20747 (open fd does not have write permission) // https://github.com/ziglang/zig/issues/20747 (open fd does not have write permission)
if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest; if (native_os == .wasi and builtin.link_libc) return error.SkipZigTest;
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23806
var tmp = tmpDir(.{}); var tmp = tmpDir(.{});
defer tmp.cleanup(); defer tmp.cleanup();

View File

@ -781,6 +781,7 @@ fn testExpect(comptime H: type, seed: anytype, input: []const u8, expected: u64)
test "xxhash3" { test "xxhash3" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
const H = XxHash3; const H = XxHash3;
// Non-Seeded Tests // Non-Seeded Tests
@ -814,6 +815,7 @@ test "xxhash3" {
test "xxhash3 smhasher" { test "xxhash3 smhasher" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
const Test = struct { const Test = struct {
fn do() !void { fn do() !void {
@ -827,6 +829,7 @@ test "xxhash3 smhasher" {
test "xxhash3 iterative api" { test "xxhash3 iterative api" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23807
const Test = struct { const Test = struct {
fn do() !void { fn do() !void {

View File

@ -8,6 +8,8 @@ const expectEqual = std.testing.expectEqual;
const fs = std.fs; const fs = std.fs;
test "fallocate" { test "fallocate" {
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23809
var tmp = std.testing.tmpDir(.{}); var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup(); defer tmp.cleanup();

View File

@ -1391,6 +1391,8 @@ fn expectMode(dir: posix.fd_t, file: []const u8, mode: posix.mode_t) !void {
} }
test "fchmodat smoke test" { test "fchmodat smoke test" {
if (builtin.cpu.arch.isMIPS64() and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23808
if (!std.fs.has_executable_bit) return error.SkipZigTest; if (!std.fs.has_executable_bit) return error.SkipZigTest;
var tmp = tmpDir(.{}); var tmp = tmpDir(.{});

View File

@ -131,6 +131,20 @@ pub fn glibcRuntimeTriple(
}; };
} }
/// Returns the subdirectory triple to be used to find the correct musl for the given `arch` and
/// `abi` in an installation directory.
///
/// `abi` must be a musl ABI, i.e. `.isMusl()`.
pub fn muslRuntimeTriple(
allocator: Allocator,
arch: std.Target.Cpu.Arch,
abi: std.Target.Abi,
) Allocator.Error![]const u8 {
assert(abi.isMusl());
return std.Target.linuxTripleSimple(allocator, arch, .linux, abi);
}
pub fn osArchName(target: std.Target) [:0]const u8 { pub fn osArchName(target: std.Target) [:0]const u8 {
return switch (target.os.tag) { return switch (target.os.tag) {
.linux => switch (target.cpu.arch) { .linux => switch (target.cpu.arch) {

View File

@ -1204,6 +1204,7 @@ test "arrays and vectors with big integers" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_llvm and (builtin.abi == .gnuabin32 or builtin.abi == .muslabin32)) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/23805
inline for (.{ u65528, u65529, u65535 }) |Int| { inline for (.{ u65528, u65529, u65535 }) |Int| {
var a: [1]Int = undefined; var a: [1]Int = undefined;

View File

@ -20,6 +20,7 @@ pub const StackTracesContext = @import("src/StackTrace.zig");
pub const DebuggerContext = @import("src/Debugger.zig"); pub const DebuggerContext = @import("src/Debugger.zig");
const TestTarget = struct { const TestTarget = struct {
linkage: ?std.builtin.LinkMode = null,
target: std.Target.Query = .{}, target: std.Target.Query = .{},
optimize_mode: std.builtin.OptimizeMode = .Debug, optimize_mode: std.builtin.OptimizeMode = .Debug,
link_libc: ?bool = null, link_libc: ?bool = null,
@ -30,8 +31,9 @@ const TestTarget = struct {
strip: ?bool = null, strip: ?bool = null,
skip_modules: []const []const u8 = &.{}, skip_modules: []const []const u8 = &.{},
// This is intended for targets that are known to be slow to compile, or require a newer LLVM // This is intended for targets that, for any reason, shouldn't be run as part of a normal test
// version than is present on the CI machines, etc. // invocation. This could be because of a slow backend, requiring a newer LLVM version, being
// too niche, etc.
extra_target: bool = false, extra_target: bool = false,
}; };
@ -240,6 +242,15 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .x86_64,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .x86_64, .cpu_arch = .x86_64,
@ -248,6 +259,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .x86_64,
.os_tag = .linux,
.abi = .muslx32,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .x86_64, .cpu_arch = .x86_64,
@ -273,6 +294,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// https://github.com/ziglang/zig/issues/7935
// .{
// .target = .{
// .cpu_arch = .x86,
// .os_tag = .linux,
// .abi = .musl,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .x86, .cpu_arch = .x86,
@ -297,6 +329,15 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .aarch64,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .aarch64, .cpu_arch = .aarch64,
@ -329,6 +370,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .aarch64_be,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .aarch64_be, .cpu_arch = .aarch64_be,
@ -360,6 +411,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// Crashes in weird ways when applying relocations.
// .{
// .target = .{
// .cpu_arch = .arm,
// .os_tag = .linux,
// .abi = .musleabi,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .arm, .cpu_arch = .arm,
@ -368,6 +430,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// Crashes in weird ways when applying relocations.
// .{
// .target = .{
// .cpu_arch = .arm,
// .os_tag = .linux,
// .abi = .musleabihf,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .arm, .cpu_arch = .arm,
@ -407,6 +480,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// Crashes in weird ways when applying relocations.
// .{
// .target = .{
// .cpu_arch = .armeb,
// .os_tag = .linux,
// .abi = .musleabi,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .armeb, .cpu_arch = .armeb,
@ -415,6 +499,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// Crashes in weird ways when applying relocations.
// .{
// .target = .{
// .cpu_arch = .armeb,
// .os_tag = .linux,
// .abi = .musleabihf,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .armeb, .cpu_arch = .armeb,
@ -516,6 +611,19 @@ const test_targets = blk: {
// https://github.com/llvm/llvm-project/pull/111217 // https://github.com/llvm/llvm-project/pull/111217
.skip_modules = &.{"std"}, .skip_modules = &.{"std"},
}, },
// Currently crashes in qemu-hexagon.
// .{
// .target = .{
// .cpu_arch = .hexagon,
// .os_tag = .linux,
// .abi = .musl,
// },
// .linkage = .dynamic,
// .link_libc = true,
// // https://github.com/llvm/llvm-project/pull/111217
// .skip_modules = &.{"std"},
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
@ -534,6 +642,17 @@ const test_targets = blk: {
.link_libc = true, .link_libc = true,
.skip_modules = &.{"std"}, .skip_modules = &.{"std"},
}, },
.{
.target = .{
.cpu_arch = .loongarch64,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.skip_modules = &.{"std"},
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .loongarch64, .cpu_arch = .loongarch64,
@ -566,6 +685,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips,
.os_tag = .linux,
.abi = .musleabi,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mips, .cpu_arch = .mips,
@ -574,6 +703,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips,
.os_tag = .linux,
.abi = .musleabihf,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mips, .cpu_arch = .mips,
@ -613,6 +752,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mipsel,
.os_tag = .linux,
.abi = .musleabi,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mipsel, .cpu_arch = .mipsel,
@ -621,6 +770,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mipsel,
.os_tag = .linux,
.abi = .musleabihf,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mipsel, .cpu_arch = .mipsel,
@ -653,6 +812,34 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips64,
.os_tag = .linux,
.abi = .muslabi64,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{
.target = .{
.cpu_arch = .mips64,
.os_tag = .linux,
.abi = .muslabin32,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .mips64,
.os_tag = .linux,
.abi = .muslabin32,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mips64, .cpu_arch = .mips64,
@ -661,6 +848,14 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips64,
.os_tag = .linux,
.abi = .gnuabin32,
},
.link_libc = true,
},
.{ .{
.target = .{ .target = .{
@ -677,6 +872,34 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips64el,
.os_tag = .linux,
.abi = .muslabi64,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{
.target = .{
.cpu_arch = .mips64el,
.os_tag = .linux,
.abi = .muslabin32,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .mips64el,
.os_tag = .linux,
.abi = .muslabin32,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .mips64el, .cpu_arch = .mips64el,
@ -685,6 +908,14 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .mips64el,
.os_tag = .linux,
.abi = .gnuabin32,
},
.link_libc = true,
},
.{ .{
.target = .{ .target = .{
@ -708,6 +939,18 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .powerpc,
.os_tag = .linux,
.abi = .musleabi,
},
.linkage = .dynamic,
.link_libc = true,
// https://github.com/ziglang/zig/issues/2256
.skip_modules = &.{"std"},
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .powerpc, .cpu_arch = .powerpc,
@ -716,6 +959,18 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .powerpc,
.os_tag = .linux,
.abi = .musleabihf,
},
.linkage = .dynamic,
.link_libc = true,
// https://github.com/ziglang/zig/issues/2256
.skip_modules = &.{"std"},
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .powerpc, .cpu_arch = .powerpc,
@ -752,6 +1007,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .powerpc64,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
// Requires ELFv1 linker support. // Requires ELFv1 linker support.
// .{ // .{
// .target = .{ // .target = .{
@ -776,6 +1041,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .powerpc64le,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .powerpc64le, .cpu_arch = .powerpc64le,
@ -814,6 +1089,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .riscv32,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .riscv32, .cpu_arch = .riscv32,
@ -852,6 +1137,16 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
.{
.target = .{
.cpu_arch = .riscv64,
.os_tag = .linux,
.abi = .musl,
},
.linkage = .dynamic,
.link_libc = true,
.extra_target = true,
},
.{ .{
.target = .{ .target = .{
.cpu_arch = .riscv64, .cpu_arch = .riscv64,
@ -885,6 +1180,17 @@ const test_targets = blk: {
}, },
.link_libc = true, .link_libc = true,
}, },
// Currently hangs in qemu-s390x.
// .{
// .target = .{
// .cpu_arch = .s390x,
// .os_tag = .linux,
// .abi = .musl,
// },
// .linkage = .dynamic,
// .link_libc = true,
// .extra_target = true,
// },
.{ .{
.target = .{ .target = .{
.cpu_arch = .s390x, .cpu_arch = .s390x,
@ -1518,6 +1824,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
.use_lld = test_target.use_lld, .use_lld = test_target.use_lld,
.zig_lib_dir = b.path("lib"), .zig_lib_dir = b.path("lib"),
}); });
these_tests.linkage = test_target.linkage;
if (options.no_builtin) these_tests.no_builtin = true; if (options.no_builtin) these_tests.no_builtin = true;
if (options.build_options) |build_options| { if (options.build_options) |build_options| {
these_tests.root_module.addOptions("build_options", build_options); these_tests.root_module.addOptions("build_options", build_options);
@ -1532,11 +1839,14 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
else else
""; "";
const use_lld = if (test_target.use_lld == false) "-no-lld" else ""; const use_lld = if (test_target.use_lld == false) "-no-lld" else "";
const linkage_name = if (test_target.linkage) |linkage| switch (linkage) {
inline else => |t| "-" ++ @tagName(t),
} else "";
const use_pic = if (test_target.pic == true) "-pic" else ""; const use_pic = if (test_target.pic == true) "-pic" else "";
for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path)); for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path));
const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{ const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}{s}", .{
options.name, options.name,
triple_txt, triple_txt,
model_txt, model_txt,
@ -1545,6 +1855,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
single_threaded_suffix, single_threaded_suffix,
backend_suffix, backend_suffix,
use_lld, use_lld,
linkage_name,
use_pic, use_pic,
}); });