| author | |
| committer | |
| log | ea45895a2dd75200c36f9f51cb54384476224f89 |
| tree | cfd895c352f8a289328fc9318d726945d79e1f02 |
| parent | 9df02121d0d87c17173f79d55692bed9cb65722c |
2 files changed, 30 insertions(+), 34 deletions(-)
build.zig+10-10| ... | ... | @@ -416,7 +416,7 @@ pub fn build(b: *std.Build) !void { |
| 416 | 416 | chosen_opt_modes_buf[chosen_mode_index] = builtin.OptimizeMode.ReleaseSmall; |
| 417 | 417 | chosen_mode_index += 1; |
| 418 | 418 | } |
| 419 | const optimization_modes = chosen_opt_modes_buf[0..chosen_mode_index]; | |
| 419 | const optimize_modes = chosen_opt_modes_buf[0..chosen_mode_index]; | |
| 420 | 420 | |
| 421 | 421 | const test_only: ?tests.ModuleTestOptions.TestOnly = if (no_matrix) |
| 422 | 422 | .default |
| ... | ... | @@ -476,7 +476,7 @@ pub fn build(b: *std.Build) !void { |
| 476 | 476 | .root_src = "test/behavior.zig", |
| 477 | 477 | .name = "behavior", |
| 478 | 478 | .desc = "Run the behavior tests", |
| 479 | .optimize_modes = optimization_modes, | |
| 479 | .optimize_modes = optimize_modes, | |
| 480 | 480 | .include_paths = &.{}, |
| 481 | 481 | .sanitize_thread = sanitize_thread, |
| 482 | 482 | .skip_single_threaded = skip_single_threaded, |
| ... | ... | @@ -502,7 +502,7 @@ pub fn build(b: *std.Build) !void { |
| 502 | 502 | .root_src = "lib/compiler_rt.zig", |
| 503 | 503 | .name = "compiler-rt", |
| 504 | 504 | .desc = "Run the compiler_rt tests", |
| 505 | .optimize_modes = optimization_modes, | |
| 505 | .optimize_modes = optimize_modes, | |
| 506 | 506 | .include_paths = &.{}, |
| 507 | 507 | .sanitize_thread = sanitize_thread, |
| 508 | 508 | .skip_single_threaded = true, |
| ... | ... | @@ -529,7 +529,7 @@ pub fn build(b: *std.Build) !void { |
| 529 | 529 | .root_src = "lib/std/std.zig", |
| 530 | 530 | .name = "std", |
| 531 | 531 | .desc = "Run the standard library tests", |
| 532 | .optimize_modes = optimization_modes, | |
| 532 | .optimize_modes = optimize_modes, | |
| 533 | 533 | .include_paths = &.{}, |
| 534 | 534 | .sanitize_thread = sanitize_thread, |
| 535 | 535 | .skip_single_threaded = skip_single_threaded, |
| ... | ... | @@ -555,7 +555,7 @@ pub fn build(b: *std.Build) !void { |
| 555 | 555 | .root_src = "test/c.zig", |
| 556 | 556 | .name = "libc", |
| 557 | 557 | .desc = "Run the libc API tests", |
| 558 | .optimize_modes = optimization_modes, | |
| 558 | .optimize_modes = optimize_modes, | |
| 559 | 559 | .include_paths = &.{}, |
| 560 | 560 | .sanitize_thread = sanitize_thread, |
| 561 | 561 | .skip_single_threaded = true, |
| ... | ... | @@ -599,13 +599,14 @@ pub fn build(b: *std.Build) !void { |
| 599 | 599 | |
| 600 | 600 | test_step.dependOn(tests.addStandaloneTests( |
| 601 | 601 | b, |
| 602 | optimization_modes, | |
| 602 | optimize_modes, | |
| 603 | 603 | enable_macos_sdk, |
| 604 | 604 | enable_ios_sdk, |
| 605 | 605 | enable_symlinks_windows, |
| 606 | 606 | )); |
| 607 | 607 | test_step.dependOn(tests.addCAbiTests(b, .{ |
| 608 | 608 | .test_target_filters = test_target_filters, |
| 609 | .optimize_modes = optimize_modes, | |
| 609 | 610 | .skip_non_native = skip_non_native, |
| 610 | 611 | .skip_wasm = skip_wasm, |
| 611 | 612 | .skip_freebsd = skip_freebsd, |
| ... | ... | @@ -615,19 +616,18 @@ pub fn build(b: *std.Build) !void { |
| 615 | 616 | .skip_darwin = skip_darwin, |
| 616 | 617 | .skip_linux = skip_linux, |
| 617 | 618 | .skip_llvm = skip_llvm, |
| 618 | .skip_release = skip_release, | |
| 619 | 619 | .max_rss = 3_300_000_000, |
| 620 | 620 | })); |
| 621 | 621 | test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows)); |
| 622 | 622 | test_step.dependOn(tests.addStackTraceTests(b, test_filters, skip_non_native)); |
| 623 | test_step.dependOn(tests.addErrorTraceTests(b, test_filters, optimization_modes, skip_non_native)); | |
| 623 | test_step.dependOn(tests.addErrorTraceTests(b, test_filters, optimize_modes, skip_non_native)); | |
| 624 | 624 | test_step.dependOn(tests.addCliTests(b)); |
| 625 | 625 | if (tests.addDebuggerTests(b, .{ |
| 626 | 626 | .test_filters = test_filters, |
| 627 | 627 | .test_target_filters = test_target_filters, |
| 628 | 628 | .gdb = b.option([]const u8, "gdb", "path to gdb binary"), |
| 629 | 629 | .lldb = b.option([]const u8, "lldb", "path to lldb binary"), |
| 630 | .optimize_modes = optimization_modes, | |
| 630 | .optimize_modes = optimize_modes, | |
| 631 | 631 | .skip_single_threaded = skip_single_threaded, |
| 632 | 632 | .skip_libc = skip_libc, |
| 633 | 633 | })) |test_debugger_step| test_step.dependOn(test_debugger_step); |
| ... | ... | @@ -663,7 +663,7 @@ pub fn build(b: *std.Build) !void { |
| 663 | 663 | if (!skip_test_incremental) test_step.dependOn(test_incremental_step); |
| 664 | 664 | |
| 665 | 665 | if (tests.addLibcTestNszTests(b, .{ |
| 666 | .optimize_modes = optimization_modes, | |
| 666 | .optimize_modes = optimize_modes, | |
| 667 | 667 | .test_filters = test_filters, |
| 668 | 668 | .test_target_filters = test_target_filters, |
| 669 | 669 | .skip_wasm = skip_wasm, |
test/tests.zig+20-24| ... | ... | @@ -2749,6 +2749,7 @@ pub fn wouldUseLlvm(use_llvm: ?bool, query: std.Target.Query, optimize_mode: Opt |
| 2749 | 2749 | |
| 2750 | 2750 | const CAbiTestOptions = struct { |
| 2751 | 2751 | test_target_filters: []const []const u8, |
| 2752 | optimize_modes: []const OptimizeMode, | |
| 2752 | 2753 | skip_non_native: bool, |
| 2753 | 2754 | skip_wasm: bool, |
| 2754 | 2755 | skip_freebsd: bool, |
| ... | ... | @@ -2758,43 +2759,38 @@ const CAbiTestOptions = struct { |
| 2758 | 2759 | skip_darwin: bool, |
| 2759 | 2760 | skip_linux: bool, |
| 2760 | 2761 | skip_llvm: bool, |
| 2761 | skip_release: bool, | |
| 2762 | 2762 | max_rss: usize = 0, |
| 2763 | 2763 | }; |
| 2764 | 2764 | |
| 2765 | 2765 | pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 2766 | 2766 | const step = b.step("test-c-abi", "Run the C ABI tests"); |
| 2767 | 2767 | |
| 2768 | const optimize_modes: [3]OptimizeMode = .{ .Debug, .ReleaseSafe, .ReleaseFast }; | |
| 2768 | for (c_abi_targets) |c_abi_target| { | |
| 2769 | if (options.skip_non_native and !c_abi_target.target.isNative()) continue; | |
| 2769 | 2770 | |
| 2770 | for (optimize_modes) |optimize_mode| { | |
| 2771 | if (optimize_mode != .Debug and options.skip_release) continue; | |
| 2771 | if (options.skip_wasm and c_abi_target.target.cpu_arch != null and c_abi_target.target.cpu_arch.?.isWasm()) continue; | |
| 2772 | 2772 | |
| 2773 | for (c_abi_targets) |c_abi_target| { | |
| 2774 | if (options.skip_non_native and !c_abi_target.target.isNative()) continue; | |
| 2773 | if (options.skip_freebsd and c_abi_target.target.os_tag == .freebsd) continue; | |
| 2774 | if (options.skip_netbsd and c_abi_target.target.os_tag == .netbsd) continue; | |
| 2775 | if (options.skip_openbsd and c_abi_target.target.os_tag == .openbsd) continue; | |
| 2776 | if (options.skip_windows and c_abi_target.target.os_tag == .windows) continue; | |
| 2777 | if (options.skip_darwin and c_abi_target.target.os_tag != null and c_abi_target.target.os_tag.?.isDarwin()) continue; | |
| 2778 | if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue; | |
| 2775 | 2779 | |
| 2776 | if (options.skip_wasm and c_abi_target.target.cpu_arch != null and c_abi_target.target.cpu_arch.?.isWasm()) continue; | |
| 2780 | const resolved_target = b.resolveTargetQuery(c_abi_target.target); | |
| 2781 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); | |
| 2782 | const target = &resolved_target.result; | |
| 2777 | 2783 | |
| 2778 | if (options.skip_freebsd and c_abi_target.target.os_tag == .freebsd) continue; | |
| 2779 | if (options.skip_netbsd and c_abi_target.target.os_tag == .netbsd) continue; | |
| 2780 | if (options.skip_openbsd and c_abi_target.target.os_tag == .openbsd) continue; | |
| 2781 | if (options.skip_windows and c_abi_target.target.os_tag == .windows) continue; | |
| 2782 | if (options.skip_darwin and c_abi_target.target.os_tag != null and c_abi_target.target.os_tag.?.isDarwin()) continue; | |
| 2783 | if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue; | |
| 2784 | if (options.test_target_filters.len > 0) { | |
| 2785 | for (options.test_target_filters) |filter| { | |
| 2786 | if (std.mem.indexOf(u8, triple_txt, filter) != null) break; | |
| 2787 | } else continue; | |
| 2788 | } | |
| 2784 | 2789 | |
| 2785 | const would_use_llvm = wouldUseLlvm(c_abi_target.use_llvm, c_abi_target.target, .Debug); | |
| 2790 | for (options.optimize_modes) |optimize_mode| { | |
| 2791 | const would_use_llvm = wouldUseLlvm(c_abi_target.use_llvm, c_abi_target.target, optimize_mode); | |
| 2786 | 2792 | if (options.skip_llvm and would_use_llvm) continue; |
| 2787 | 2793 | |
| 2788 | const resolved_target = b.resolveTargetQuery(c_abi_target.target); | |
| 2789 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); | |
| 2790 | const target = &resolved_target.result; | |
| 2791 | ||
| 2792 | if (options.test_target_filters.len > 0) { | |
| 2793 | for (options.test_target_filters) |filter| { | |
| 2794 | if (std.mem.indexOf(u8, triple_txt, filter) != null) break; | |
| 2795 | } else continue; | |
| 2796 | } | |
| 2797 | ||
| 2798 | 2794 | const test_mod = b.createModule(.{ |
| 2799 | 2795 | .root_source_file = b.path("test/c_abi/main.zig"), |
| 2800 | 2796 | .target = resolved_target, |