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 15:54:55+02:00
log39a2722837816f6242dae23a158f35803772072d
tree55cdcceb99b9d68fb70c1b46f93bf66e2b0b595b
parentc0b4688393fa1a96065c2407622fcb4663c350a3
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
......@@ -2350,38 +2350,38 @@ pub const debugger_matrix: []const RunnerTarget = &.{
23502350 },
23512351};
23522352
2353fn compatible32bitArch(host: *const std.Target) ?std.Target.Cpu.Arch {
2353fn supportedCompatArch(host: *const std.Target, arch: std.Target.Cpu.Arch) bool {
23542354 return switch (host.os.tag) {
23552355 .freebsd => switch (host.cpu.arch) {
2356 .aarch64 => .arm,
2357 .powerpc64 => .powerpc,
2358 else => null,
2356 .aarch64 => arch == .arm,
2357 else => false,
23592358 },
23602359 .illumos => switch (host.cpu.arch) {
2361 .x86_64 => .x86,
2362 else => null,
2360 .x86_64 => arch == .x86,
2361 else => false,
23632362 },
23642363 .linux => switch (host.cpu.arch) {
2365 .aarch64 => .arm,
2366 .aarch64_be => .armeb,
2367 .mips64 => .mips,
2368 .mips64el => .mipsel,
2369 .powerpc64 => .powerpc,
2370 .sparc64 => .sparc,
2371 .x86_64 => .x86,
2372 else => null,
2364 .aarch64 => arch == .arm or arch == .thumb,
2365 .aarch64_be => arch == .armeb or arch == .thumbeb,
2366 .mips64 => arch == .mips,
2367 .mips64el => arch == .mipsel,
2368 .powerpc64 => arch == .powerpc,
2369 .riscv64 => arch == .riscv32,
2370 .sparc64 => arch == .sparc,
2371 .x86_64 => arch == .x86,
2372 else => false,
23732373 },
23742374 .netbsd => switch (host.cpu.arch) {
2375 .riscv64 => .riscv32,
2376 .sparc64 => .sparc,
2377 .x86_64 => .x86,
2378 else => null,
2375 .riscv64 => arch == .riscv32,
2376 .sparc64 => arch == .sparc,
2377 .x86_64 => arch == .x86,
2378 else => false,
23792379 },
23802380 .windows => switch (host.cpu.arch) {
2381 .x86_64 => .x86,
2382 else => null,
2381 .x86_64 => arch == .x86,
2382 else => false,
23832383 },
2384 else => null,
2384 else => false,
23852385 };
23862386}
23872387
......@@ -2389,11 +2389,8 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
23892389 if (actual_target.query.isNative()) return true;
23902390 const actual = &actual_target.result;
23912391
2392 if (actual.cpu.arch != host.cpu.arch and
2393 actual.cpu.arch != compatible32bitArch(host))
2394 {
2392 if (actual.cpu.arch != host.cpu.arch and !supportedCompatArch(host, actual.cpu.arch))
23952393 return false;
2396 }
23972394
23982395 if (actual.os.tag != host.os.tag)
23992396 return false;