| author | |
| committer | |
| log | 5a52da1b7a8c467087da8f3a20ab902ec8c1e25d |
| tree | 92dc4b0274d87cfbcbe122b3a805b4289bbeac61 |
| parent | 125a9aa82b55f8d1e2b6d08d61e697e6dfacbba6 |
4 files changed, 37 insertions(+), 11 deletions(-)
build.zig+7-5| ... | @@ -97,6 +97,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -97,6 +97,7 @@ pub fn build(b: *std.Build) !void { |
| 97 | const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false; | 97 | const skip_windows = b.option(bool, "skip-windows", "Main test suite skips targets with windows OS") orelse false; |
| 98 | const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false; | 98 | const skip_macos = b.option(bool, "skip-macos", "Main test suite skips targets with macos OS") orelse false; |
| 99 | const skip_linux = b.option(bool, "skip-linux", "Main test suite skips targets with linux OS") orelse false; | 99 | 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; | ||
| 100 | 101 | ||
| 101 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; | 102 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; |
| 102 | 103 | ||
| ... | @@ -445,8 +446,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -445,8 +446,8 @@ pub fn build(b: *std.Build) !void { |
| 445 | .skip_windows = skip_windows, | 446 | .skip_windows = skip_windows, |
| 446 | .skip_macos = skip_macos, | 447 | .skip_macos = skip_macos, |
| 447 | .skip_linux = skip_linux, | 448 | .skip_linux = skip_linux, |
| 449 | .skip_llvm = skip_llvm, | ||
| 448 | .skip_libc = skip_libc, | 450 | .skip_libc = skip_libc, |
| 449 | .use_llvm = use_llvm, | ||
| 450 | // 2923515904 was observed on an x86_64-linux-gnu host. | 451 | // 2923515904 was observed on an x86_64-linux-gnu host. |
| 451 | .max_rss = 3100000000, | 452 | .max_rss = 3100000000, |
| 452 | })); | 453 | })); |
| ... | @@ -467,8 +468,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -467,8 +468,8 @@ pub fn build(b: *std.Build) !void { |
| 467 | .skip_windows = skip_windows, | 468 | .skip_windows = skip_windows, |
| 468 | .skip_macos = skip_macos, | 469 | .skip_macos = skip_macos, |
| 469 | .skip_linux = skip_linux, | 470 | .skip_linux = skip_linux, |
| 471 | .skip_llvm = skip_llvm, | ||
| 470 | .skip_libc = skip_libc, | 472 | .skip_libc = skip_libc, |
| 471 | .use_llvm = use_llvm, | ||
| 472 | })); | 473 | })); |
| 473 | 474 | ||
| 474 | test_modules_step.dependOn(tests.addModuleTests(b, .{ | 475 | test_modules_step.dependOn(tests.addModuleTests(b, .{ |
| ... | @@ -487,8 +488,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -487,8 +488,8 @@ pub fn build(b: *std.Build) !void { |
| 487 | .skip_windows = skip_windows, | 488 | .skip_windows = skip_windows, |
| 488 | .skip_macos = skip_macos, | 489 | .skip_macos = skip_macos, |
| 489 | .skip_linux = skip_linux, | 490 | .skip_linux = skip_linux, |
| 491 | .skip_llvm = skip_llvm, | ||
| 490 | .skip_libc = true, | 492 | .skip_libc = true, |
| 491 | .use_llvm = use_llvm, | ||
| 492 | .no_builtin = true, | 493 | .no_builtin = true, |
| 493 | })); | 494 | })); |
| 494 | 495 | ||
| ... | @@ -508,8 +509,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -508,8 +509,8 @@ pub fn build(b: *std.Build) !void { |
| 508 | .skip_windows = skip_windows, | 509 | .skip_windows = skip_windows, |
| 509 | .skip_macos = skip_macos, | 510 | .skip_macos = skip_macos, |
| 510 | .skip_linux = skip_linux, | 511 | .skip_linux = skip_linux, |
| 512 | .skip_llvm = skip_llvm, | ||
| 511 | .skip_libc = true, | 513 | .skip_libc = true, |
| 512 | .use_llvm = use_llvm, | ||
| 513 | .no_builtin = true, | 514 | .no_builtin = true, |
| 514 | })); | 515 | })); |
| 515 | 516 | ||
| ... | @@ -529,8 +530,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -529,8 +530,8 @@ pub fn build(b: *std.Build) !void { |
| 529 | .skip_windows = skip_windows, | 530 | .skip_windows = skip_windows, |
| 530 | .skip_macos = skip_macos, | 531 | .skip_macos = skip_macos, |
| 531 | .skip_linux = skip_linux, | 532 | .skip_linux = skip_linux, |
| 533 | .skip_llvm = skip_llvm, | ||
| 532 | .skip_libc = skip_libc, | 534 | .skip_libc = skip_libc, |
| 533 | .use_llvm = use_llvm, | ||
| 534 | // I observed a value of 5605064704 on the M2 CI. | 535 | // I observed a value of 5605064704 on the M2 CI. |
| 535 | .max_rss = 6165571174, | 536 | .max_rss = 6165571174, |
| 536 | })); | 537 | })); |
| ... | @@ -571,6 +572,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -571,6 +572,7 @@ pub fn build(b: *std.Build) !void { |
| 571 | .skip_windows = skip_windows, | 572 | .skip_windows = skip_windows, |
| 572 | .skip_macos = skip_macos, | 573 | .skip_macos = skip_macos, |
| 573 | .skip_linux = skip_linux, | 574 | .skip_linux = skip_linux, |
| 575 | .skip_llvm = skip_llvm, | ||
| 574 | .skip_release = skip_release, | 576 | .skip_release = skip_release, |
| 575 | })); | 577 | })); |
| 576 | test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows)); | 578 | 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 \ | ... | @@ -63,6 +63,7 @@ stage3-debug/bin/zig build test docs \ |
| 63 | -Dskip-netbsd \ | 63 | -Dskip-netbsd \ |
| 64 | -Dskip-windows \ | 64 | -Dskip-windows \ |
| 65 | -Dskip-macos \ | 65 | -Dskip-macos \ |
| 66 | -Dskip-llvm \ | ||
| 66 | -Dtarget=native-native-musl \ | 67 | -Dtarget=native-native-musl \ |
| 67 | --search-prefix "$PREFIX" \ | 68 | --search-prefix "$PREFIX" \ |
| 68 | --zig-lib-dir "$PWD/../lib" \ | 69 | --zig-lib-dir "$PWD/../lib" \ |
lib/std/Target.zig+5-1| ... | @@ -2581,12 +2581,16 @@ pub fn standardDynamicLinkerPath(target: Target) DynamicLinker { | ... | @@ -2581,12 +2581,16 @@ pub fn standardDynamicLinkerPath(target: Target) DynamicLinker { |
| 2581 | } | 2581 | } |
| 2582 | 2582 | ||
| 2583 | pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 { | 2583 | pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 { |
| 2584 | return ptrBitWidth_arch_abi(cpu.arch, abi); | ||
| 2585 | } | ||
| 2586 | |||
| 2587 | pub fn ptrBitWidth_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) u16 { | ||
| 2584 | switch (abi) { | 2588 | switch (abi) { |
| 2585 | .gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32, | 2589 | .gnux32, .muslx32, .gnuabin32, .muslabin32, .ilp32 => return 32, |
| 2586 | .gnuabi64, .muslabi64 => return 64, | 2590 | .gnuabi64, .muslabi64 => return 64, |
| 2587 | else => {}, | 2591 | else => {}, |
| 2588 | } | 2592 | } |
| 2589 | return switch (cpu.arch) { | 2593 | return switch (cpu_arch) { |
| 2590 | .avr, | 2594 | .avr, |
| 2591 | .msp430, | 2595 | .msp430, |
| 2592 | => 16, | 2596 | => 16, |
test/tests.zig+24-5| ... | @@ -2278,8 +2278,8 @@ const ModuleTestOptions = struct { | ... | @@ -2278,8 +2278,8 @@ const ModuleTestOptions = struct { |
| 2278 | skip_windows: bool, | 2278 | skip_windows: bool, |
| 2279 | skip_macos: bool, | 2279 | skip_macos: bool, |
| 2280 | skip_linux: bool, | 2280 | skip_linux: bool, |
| 2281 | skip_llvm: bool, | ||
| 2281 | skip_libc: bool, | 2282 | skip_libc: bool, |
| 2282 | use_llvm: ?bool = null, | ||
| 2283 | max_rss: usize = 0, | 2283 | max_rss: usize = 0, |
| 2284 | no_builtin: bool = false, | 2284 | no_builtin: bool = false, |
| 2285 | build_options: ?*std.Build.Step.Options = null, | 2285 | build_options: ?*std.Build.Step.Options = null, |
| ... | @@ -2306,6 +2306,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { | ... | @@ -2306,6 +2306,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2306 | if (options.skip_macos and test_target.target.os_tag == .macos) continue; | 2306 | if (options.skip_macos and test_target.target.os_tag == .macos) continue; |
| 2307 | if (options.skip_linux and test_target.target.os_tag == .linux) continue; | 2307 | if (options.skip_linux and test_target.target.os_tag == .linux) continue; |
| 2308 | 2308 | ||
| 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 | |||
| 2309 | const resolved_target = b.resolveTargetQuery(test_target.target); | 2312 | const resolved_target = b.resolveTargetQuery(test_target.target); |
| 2310 | const target = resolved_target.result; | 2313 | const target = resolved_target.result; |
| 2311 | const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); | 2314 | const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); |
| ... | @@ -2326,10 +2329,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { | ... | @@ -2326,10 +2329,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2326 | if (options.skip_single_threaded and test_target.single_threaded == true) | 2329 | if (options.skip_single_threaded and test_target.single_threaded == true) |
| 2327 | continue; | 2330 | continue; |
| 2328 | 2331 | ||
| 2329 | if (options.use_llvm) |use_llvm| { | ||
| 2330 | if (test_target.use_llvm != use_llvm) continue; | ||
| 2331 | } | ||
| 2332 | |||
| 2333 | // TODO get compiler-rt tests passing for self-hosted backends. | 2332 | // TODO get compiler-rt tests passing for self-hosted backends. |
| 2334 | if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and | 2333 | if ((target.cpu.arch != .x86_64 or target.ofmt != .elf) and |
| 2335 | test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt")) | 2334 | 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 { | ... | @@ -2509,6 +2508,22 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2509 | return step; | 2508 | return step; |
| 2510 | } | 2509 | } |
| 2511 | 2510 | ||
| 2511 | fn 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 | |||
| 2512 | const CAbiTestOptions = struct { | 2527 | const CAbiTestOptions = struct { |
| 2513 | test_target_filters: []const []const u8, | 2528 | test_target_filters: []const []const u8, |
| 2514 | skip_non_native: bool, | 2529 | skip_non_native: bool, |
| ... | @@ -2517,6 +2532,7 @@ const CAbiTestOptions = struct { | ... | @@ -2517,6 +2532,7 @@ const CAbiTestOptions = struct { |
| 2517 | skip_windows: bool, | 2532 | skip_windows: bool, |
| 2518 | skip_macos: bool, | 2533 | skip_macos: bool, |
| 2519 | skip_linux: bool, | 2534 | skip_linux: bool, |
| 2535 | skip_llvm: bool, | ||
| 2520 | skip_release: bool, | 2536 | skip_release: bool, |
| 2521 | }; | 2537 | }; |
| 2522 | 2538 | ||
| ... | @@ -2536,6 +2552,9 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { | ... | @@ -2536,6 +2552,9 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 2536 | if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue; | 2552 | if (options.skip_macos and c_abi_target.target.os_tag == .macos) continue; |
| 2537 | if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue; | 2553 | if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue; |
| 2538 | 2554 | ||
| 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 | |||
| 2539 | const resolved_target = b.resolveTargetQuery(c_abi_target.target); | 2558 | const resolved_target = b.resolveTargetQuery(c_abi_target.target); |
| 2540 | const target = resolved_target.result; | 2559 | const target = resolved_target.result; |
| 2541 | const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); | 2560 | const triple_txt = target.zigTriple(b.allocator) catch @panic("OOM"); |