authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-06 23:34:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-06 23:42:15-07:00
log5a52da1b7a8c467087da8f3a20ab902ec8c1e25d
tree92dc4b0274d87cfbcbe122b3a805b4289bbeac61
parent125a9aa82b55f8d1e2b6d08d61e697e6dfacbba6

CI: skip llvm backend tests in the script for testing x86 backend


4 files changed, 37 insertions(+), 11 deletions(-)

build.zig+7-5
......@@ -97,6 +97,7 @@ pub fn build(b: *std.Build) !void {
9797 const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false;
9898 const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false;
9999 const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false;
100 const skip_llvm = b.option(bool, "skip-llvm", "Main test suite skips targets that use LLVM backend") orelse false;
100101
101102 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
102103
......@@ -445,8 +446,8 @@ pub fn build(b: *std.Build) !void {
445446 .skip_windows = skip_windows,
446447 .skip_macos = skip_macos,
447448 .skip_linux = skip_linux,
449 .skip_llvm = skip_llvm,
448450 .skip_libc = skip_libc,
449 .use_llvm = use_llvm,
450451 // 2923515904 was observed on an x86_64-linux-gnu host.
451452 .max_rss = 3100000000,
452453 }));
......@@ -467,8 +468,8 @@ pub fn build(b: *std.Build) !void {
467468 .skip_windows = skip_windows,
468469 .skip_macos = skip_macos,
469470 .skip_linux = skip_linux,
471 .skip_llvm = skip_llvm,
470472 .skip_libc = skip_libc,
471 .use_llvm = use_llvm,
472473 }));
473474
474475 test_modules_step.dependOn(tests.addModuleTests(b, .{
......@@ -487,8 +488,8 @@ pub fn build(b: *std.Build) !void {
487488 .skip_windows = skip_windows,
488489 .skip_macos = skip_macos,
489490 .skip_linux = skip_linux,
491 .skip_llvm = skip_llvm,
490492 .skip_libc = true,
491 .use_llvm = use_llvm,
492493 .no_builtin = true,
493494 }));
494495
......@@ -508,8 +509,8 @@ pub fn build(b: *std.Build) !void {
508509 .skip_windows = skip_windows,
509510 .skip_macos = skip_macos,
510511 .skip_linux = skip_linux,
512 .skip_llvm = skip_llvm,
511513 .skip_libc = true,
512 .use_llvm = use_llvm,
513514 .no_builtin = true,
514515 }));
515516
......@@ -529,8 +530,8 @@ pub fn build(b: *std.Build) !void {
529530 .skip_windows = skip_windows,
530531 .skip_macos = skip_macos,
531532 .skip_linux = skip_linux,
533 .skip_llvm = skip_llvm,
532534 .skip_libc = skip_libc,
533 .use_llvm = use_llvm,
534535 // I observed a value of 5605064704 on the M2 CI.
535536 .max_rss = 6165571174,
536537 }));
......@@ -571,6 +572,7 @@ pub fn build(b: *std.Build) !void {
571572 .skip_windows = skip_windows,
572573 .skip_macos = skip_macos,
573574 .skip_linux = skip_linux,
575 .skip_llvm = skip_llvm,
574576 .skip_release = skip_release,
575577 }));
576578 test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
ci/x86_64-linux-debug.sh+1
......@@ -63,6 +63,7 @@ stage3-debug/bin/zig build test docs \
6363 -Dskip-netbsd \
6464 -Dskip-windows \
6565 -Dskip-macos \
66 -Dskip-llvm \
6667 -Dtarget=native-native-musl \
6768 --search-prefix "$PREFIX" \
6869 --zig-lib-dir "$PWD/../lib" \
lib/std/Target.zig+5-1
......@@ -2581,12 +2581,16 @@ pub fn standardDynamicLinkerPath(target: Target) DynamicLinker {
25812581}
25822582
25832583pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {
2584 return ptrBitWidth_arch_abi(cpu.arch, abi);
2585}
2586
2587pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 {
25842588 switch (abi) {
25852589 .gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32,
25862590 .gnuabi64, .muslabi64 => return 64,
25872591 else => {},
25882592 }
2589 return switch (cpu.arch) {
2593 return switch (cpu_arch) {
25902594 .avr,
25912595 .msp430,
25922596 => 16,
test/tests.zig+24-5
......@@ -2278,8 +2278,8 @@ const ModuleTestOptions = struct {
22782278 skip_windows: bool,
22792279 skip_macos: bool,
22802280 skip_linux: bool,
2281 skip_llvm: bool,
22812282 skip_libc: bool,
2282 use_llvm: ?bool = null,
22832283 max_rss: usize = 0,
22842284 no_builtin: bool = false,
22852285 build_options: ?*std.Build.Step.Options = null,
......@@ -2306,6 +2306,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
23062306 if (options.skip_macos and test_target.target.os_tag == .macos) continue;
23072307 if (options.skip_linux and test_target.target.os_tag == .linux) continue;
23082308
2309 const would_use_llvm = wouldUseLlvm(test_target.use_llvm, test_target.target, test_target.optimize_mode);
2310 if (options.skip_llvm and would_use_llvm) continue;
2311
23092312 const resolved_target = b.resolveTargetQuery(test_target.target);
23102313 const target = resolved_target.result;
23112314 const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");
......@@ -2326,10 +2329,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
23262329 if (options.skip_single_threaded and test_target.single_threaded == true)
23272330 continue;
23282331
2329 if (options.use_llvm) |use_llvm| {
2330 if (test_target.use_llvm != use_llvm) continue;
2331 }
2332
23332332 // TODO get compiler-rt tests passing for self-hosted backends.
23342333 if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and
23352334 test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt"))
......@@ -2509,6 +2508,22 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
25092508 return step;
25102509}
25112510
2511fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: OptimizeMode) bool {
2512 if (use_llvm) |x| return x;
2513 if (query.ofmt == .c) return false;
2514 switch (optimize_mode) {
2515 .Debug => {},
2516 else => return true,
2517 }
2518 const cpu_arch = query.cpu_arch orelse builtin.cpu.arch;
2519 switch (cpu_arch) {
2520 .x86_64 => if (std.Target.ptrBitWidth_arch_abi(cpu_arch, query.abi orelse .none) != 64) return true,
2521 .spirv, .spirv32, .spirv64 => return false,
2522 else => return true,
2523 }
2524 return false;
2525}
2526
25122527const CAbiTestOptions = struct {
25132528 test_target_filters: []const []const u8,
25142529 skip_non_native: bool,
......@@ -2517,6 +2532,7 @@ const CAbiTestOptions = struct {
25172532 skip_windows: bool,
25182533 skip_macos: bool,
25192534 skip_linux: bool,
2535 skip_llvm: bool,
25202536 skip_release: bool,
25212537};
25222538
......@@ -2536,6 +2552,9 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
25362552 if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue;
25372553 if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue;
25382554
2555 const would_use_llvm = wouldUseLlvm(c_abi_target.use_llvm, c_abi_target.target, .Debug);
2556 if (options.skip_llvm and would_use_llvm) continue;
2557
25392558 const resolved_target = b.resolveTargetQuery(c_abi_target.target);
25402559 const target = resolved_target.result;
25412560 const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM");