Skip to content

Commit 11176d2

Browse files
authored
Merge pull request #21073 from alexrp/test-changes
`test`: QoL for port work, more mips re-enablement
2 parents 05c7968 + 55cc9dd commit 11176d2

14 files changed

+140
-69
lines changed

build.zig

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ pub fn build(b: *std.Build) !void {
379379
}
380380

381381
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};
382+
const test_target_filters = b.option([]const []const u8, "test-target-filter", "Skip tests whose target triple do not match any filter") orelse &[0][]const u8{};
383+
const test_slow_targets = b.option(bool, "test-slow-targets", "Enable running module tests for targets that have a slow compiler backend") orelse false;
382384

383385
const test_cases_options = b.addOptions();
384386

@@ -455,8 +457,12 @@ pub fn build(b: *std.Build) !void {
455457
});
456458
test_step.dependOn(test_cases_step);
457459

458-
test_step.dependOn(tests.addModuleTests(b, .{
460+
const test_modules_step = b.step("test-modules", "Run the per-target module tests");
461+
462+
test_modules_step.dependOn(tests.addModuleTests(b, .{
459463
.test_filters = test_filters,
464+
.test_target_filters = test_target_filters,
465+
.test_slow_targets = test_slow_targets,
460466
.root_src = "test/behavior.zig",
461467
.name = "behavior",
462468
.desc = "Run the behavior tests",
@@ -468,8 +474,10 @@ pub fn build(b: *std.Build) !void {
468474
.max_rss = 1 * 1024 * 1024 * 1024,
469475
}));
470476

471-
test_step.dependOn(tests.addModuleTests(b, .{
477+
test_modules_step.dependOn(tests.addModuleTests(b, .{
472478
.test_filters = test_filters,
479+
.test_target_filters = test_target_filters,
480+
.test_slow_targets = test_slow_targets,
473481
.root_src = "test/c_import.zig",
474482
.name = "c-import",
475483
.desc = "Run the @cImport tests",
@@ -480,8 +488,10 @@ pub fn build(b: *std.Build) !void {
480488
.skip_libc = skip_libc,
481489
}));
482490

483-
test_step.dependOn(tests.addModuleTests(b, .{
491+
test_modules_step.dependOn(tests.addModuleTests(b, .{
484492
.test_filters = test_filters,
493+
.test_target_filters = test_target_filters,
494+
.test_slow_targets = test_slow_targets,
485495
.root_src = "lib/compiler_rt.zig",
486496
.name = "compiler-rt",
487497
.desc = "Run the compiler_rt tests",
@@ -493,8 +503,10 @@ pub fn build(b: *std.Build) !void {
493503
.no_builtin = true,
494504
}));
495505

496-
test_step.dependOn(tests.addModuleTests(b, .{
506+
test_modules_step.dependOn(tests.addModuleTests(b, .{
497507
.test_filters = test_filters,
508+
.test_target_filters = test_target_filters,
509+
.test_slow_targets = test_slow_targets,
498510
.root_src = "lib/c.zig",
499511
.name = "universal-libc",
500512
.desc = "Run the universal libc tests",
@@ -506,6 +518,24 @@ pub fn build(b: *std.Build) !void {
506518
.no_builtin = true,
507519
}));
508520

521+
test_modules_step.dependOn(tests.addModuleTests(b, .{
522+
.test_filters = test_filters,
523+
.test_target_filters = test_target_filters,
524+
.test_slow_targets = test_slow_targets,
525+
.root_src = "lib/std/std.zig",
526+
.name = "std",
527+
.desc = "Run the standard library tests",
528+
.optimize_modes = optimization_modes,
529+
.include_paths = &.{},
530+
.skip_single_threaded = skip_single_threaded,
531+
.skip_non_native = skip_non_native,
532+
.skip_libc = skip_libc,
533+
// I observed a value of 4572626944 on the M2 CI.
534+
.max_rss = 5029889638,
535+
}));
536+
537+
test_step.dependOn(test_modules_step);
538+
509539
test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
510540
test_step.dependOn(tests.addStandaloneTests(
511541
b,
@@ -519,39 +549,25 @@ pub fn build(b: *std.Build) !void {
519549
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
520550
test_step.dependOn(tests.addCliTests(b));
521551
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
522-
test_step.dependOn(tests.addModuleTests(b, .{
523-
.test_filters = test_filters,
524-
.root_src = "lib/std/std.zig",
525-
.name = "std",
526-
.desc = "Run the standard library tests",
527-
.optimize_modes = optimization_modes,
528-
.include_paths = &.{},
529-
.skip_single_threaded = skip_single_threaded,
530-
.skip_non_native = skip_non_native,
531-
.skip_libc = skip_libc,
532-
// I observed a value of 4572626944 on the M2 CI.
533-
.max_rss = 5029889638,
534-
}));
535552

536553
try addWasiUpdateStep(b, version);
537554

538555
const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
539556
const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
540-
const update_mingw_exe = b.addExecutable(.{
541-
.name = "update_mingw",
542-
.target = b.graph.host,
543-
.root_source_file = b.path("tools/update_mingw.zig"),
544-
});
545-
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
546-
update_mingw_run.addDirectoryArg(b.path("lib"));
547557
if (opt_mingw_src_path) |mingw_src_path| {
558+
const update_mingw_exe = b.addExecutable(.{
559+
.name = "update_mingw",
560+
.target = b.graph.host,
561+
.root_source_file = b.path("tools/update_mingw.zig"),
562+
});
563+
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
564+
update_mingw_run.addDirectoryArg(b.path("lib"));
548565
update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path });
566+
567+
update_mingw_step.dependOn(&update_mingw_run.step);
549568
} else {
550-
// Intentionally cause an error if this build step is requested.
551-
update_mingw_run.addArg("--missing-mingw-source-directory");
569+
update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step);
552570
}
553-
554-
update_mingw_step.dependOn(&update_mingw_run.step);
555571
}
556572

557573
fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {

ci/aarch64-linux-debug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ stage3-debug/bin/zig build test docs \
6262
-Dtarget=native-native-musl \
6363
--search-prefix "$PREFIX" \
6464
--zig-lib-dir "$PWD/../lib" \
65-
-Denable-tidy
65+
-Denable-tidy \
66+
-Dtest-slow-targets
6667

6768
# Ensure that updating the wasm binary from this commit will result in a viable build.
6869
stage3-debug/bin/zig build update-zig1

ci/aarch64-linux-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ stage3-release/bin/zig build test docs \
6262
-Dtarget=native-native-musl \
6363
--search-prefix "$PREFIX" \
6464
--zig-lib-dir "$PWD/../lib" \
65-
-Denable-tidy
65+
-Denable-tidy \
66+
-Dtest-slow-targets
6667

6768
# Ensure that stage3 and stage4 are byte-for-byte identical.
6869
stage3-release/bin/zig build \

ci/aarch64-macos-debug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ stage3-debug/bin/zig build test docs \
5555
-Denable-macos-sdk \
5656
-Dstatic-llvm \
5757
-Dskip-non-native \
58-
--search-prefix "$PREFIX"
58+
--search-prefix "$PREFIX" \
59+
-Dtest-slow-targets

ci/aarch64-macos-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ stage3-release/bin/zig build test docs \
5555
-Denable-macos-sdk \
5656
-Dstatic-llvm \
5757
-Dskip-non-native \
58-
--search-prefix "$PREFIX"
58+
--search-prefix "$PREFIX" \
59+
-Dtest-slow-targets
5960

6061
# Ensure that stage3 and stage4 are byte-for-byte identical.
6162
stage3-release/bin/zig build \

ci/aarch64-windows.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ Write-Output "Main test suite..."
6767
--search-prefix "$PREFIX_PATH" `
6868
-Dstatic-llvm `
6969
-Dskip-non-native `
70-
-Denable-symlinks-windows
70+
-Denable-symlinks-windows `
71+
-Dtest-slow-targets
7172
CheckLastExitCode
7273

7374
# Ensure that stage3 and stage4 are byte-for-byte identical.

ci/x86_64-linux-debug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ stage3-debug/bin/zig build test docs \
7070
-Dtarget=native-native-musl \
7171
--search-prefix "$PREFIX" \
7272
--zig-lib-dir "$PWD/../lib" \
73-
-Denable-tidy
73+
-Denable-tidy \
74+
-Dtest-slow-targets
7475

7576
# Ensure that updating the wasm binary from this commit will result in a viable build.
7677
stage3-debug/bin/zig build update-zig1

ci/x86_64-linux-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ stage3-release/bin/zig build test docs \
7070
-Dtarget=native-native-musl \
7171
--search-prefix "$PREFIX" \
7272
--zig-lib-dir "$PWD/../lib" \
73-
-Denable-tidy
73+
-Denable-tidy \
74+
-Dtest-slow-targets
7475

7576
# Ensure that stage3 and stage4 are byte-for-byte identical.
7677
stage3-release/bin/zig build \

ci/x86_64-macos-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ stage3/bin/zig build test docs \
5959
-Denable-macos-sdk \
6060
-Dstatic-llvm \
6161
-Dskip-non-native \
62-
--search-prefix "$PREFIX"
62+
--search-prefix "$PREFIX" \
63+
-Dtest-slow-targets
6364

6465
# Ensure that stage3 and stage4 are byte-for-byte identical.
6566
stage3/bin/zig build \

ci/x86_64-windows-debug.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ Write-Output "Main test suite..."
6868
-Dstatic-llvm `
6969
-Dskip-non-native `
7070
-Dskip-release `
71-
-Denable-symlinks-windows
71+
-Denable-symlinks-windows `
72+
-Dtest-slow-targets
7273
CheckLastExitCode
7374

7475
Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..."

0 commit comments

Comments
 (0)