authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-09-16 10:45:31+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-08 13:52:53+02:00
log5e96f6e102607aa5d014f1737fdbfe6ce7156475
tree3ba859637e02a2da6a6913e8467244975556e6ae
parent9d12f989a897bfde34f832ef170b4be1468b29bc
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

test: refactor compatible32bitArch() -> supportedCompatArch()

Also fix some inaccuracies in it.

1 files changed, 22 insertions(+), 25 deletions(-)

test/tests.zig+22-25
......@@ -2323,38 +2323,38 @@ pub const debugger_matrix: []const RunnerTarget = &.{
23232323 },
23242324};
23252325
2326fn compatible32bitArch(host: *const std.Target) ?std.Target.Cpu.Arch {
2326fn supportedCompatArch(host: *const std.Target, arch: std.Target.Cpu.Arch) bool {
23272327 return switch (host.os.tag) {
23282328 .freebsd => switch (host.cpu.arch) {
2329 .aarch64 => .arm,
2330 .powerpc64 => .powerpc,
2331 else => null,
2329 .aarch64 => arch == .arm,
2330 else => false,
23322331 },
23332332 .illumos => switch (host.cpu.arch) {
2334 .x86_64 => .x86,
2335 else => null,
2333 .x86_64 => arch == .x86,
2334 else => false,
23362335 },
23372336 .linux => switch (host.cpu.arch) {
2338 .aarch64 => .arm,
2339 .aarch64_be => .armeb,
2340 .mips64 => .mips,
2341 .mips64el => .mipsel,
2342 .powerpc64 => .powerpc,
2343 .sparc64 => .sparc,
2344 .x86_64 => .x86,
2345 else => null,
2337 .aarch64 => arch == .arm or arch == .thumb,
2338 .aarch64_be => arch == .armeb or arch == .thumbeb,
2339 .mips64 => arch == .mips,
2340 .mips64el => arch == .mipsel,
2341 .powerpc64 => arch == .powerpc,
2342 .riscv64 => arch == .riscv32,
2343 .sparc64 => arch == .sparc,
2344 .x86_64 => arch == .x86,
2345 else => false,
23462346 },
23472347 .netbsd => switch (host.cpu.arch) {
2348 .riscv64 => .riscv32,
2349 .sparc64 => .sparc,
2350 .x86_64 => .x86,
2351 else => null,
2348 .riscv64 => arch == .riscv32,
2349 .sparc64 => arch == .sparc,
2350 .x86_64 => arch == .x86,
2351 else => false,
23522352 },
23532353 .windows => switch (host.cpu.arch) {
2354 .x86_64 => .x86,
2355 else => null,
2354 .x86_64 => arch == .x86,
2355 else => false,
23562356 },
2357 else => null,
2357 else => false,
23582358 };
23592359}
23602360
......@@ -2362,11 +2362,8 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
23622362 if (actual_target.query.isNative()) return true;
23632363 const actual = &actual_target.result;
23642364
2365 if (actual.cpu.arch != host.cpu.arch and
2366 actual.cpu.arch != compatible32bitArch(host))
2367 {
2365 if (actual.cpu.arch != host.cpu.arch and !supportedCompatArch(host, actual.cpu.arch))
23682366 return false;
2369 }
23702367
23712368 if (actual.os.tag != host.os.tag)
23722369 return false;