Skip to content

Commit

Permalink
build/test: Add a test-modules step for running all the per-target te…
Browse files Browse the repository at this point in the history
…sts.

This is useful during porting work where you're mainly concerned with tests that
e.g. run under QEMU. Combine with the new -Dtest-target-filter for an even more
streamlined workflow.
  • Loading branch information
alexrp committed Aug 14, 2024
1 parent b6009a7 commit 927bc55
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ pub fn build(b: *std.Build) !void {
});
test_step.dependOn(test_cases_step);

test_step.dependOn(tests.addModuleTests(b, .{
const test_modules_step = b.step("test-modules", "Run the per-target module tests");

test_modules_step.dependOn(tests.addModuleTests(b, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.test_slow_targets = test_slow_targets,
Expand All @@ -472,7 +474,7 @@ pub fn build(b: *std.Build) !void {
.max_rss = 1 * 1024 * 1024 * 1024,
}));

test_step.dependOn(tests.addModuleTests(b, .{
test_modules_step.dependOn(tests.addModuleTests(b, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.test_slow_targets = test_slow_targets,
Expand All @@ -486,7 +488,7 @@ pub fn build(b: *std.Build) !void {
.skip_libc = skip_libc,
}));

test_step.dependOn(tests.addModuleTests(b, .{
test_modules_step.dependOn(tests.addModuleTests(b, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.test_slow_targets = test_slow_targets,
Expand All @@ -501,7 +503,7 @@ pub fn build(b: *std.Build) !void {
.no_builtin = true,
}));

test_step.dependOn(tests.addModuleTests(b, .{
test_modules_step.dependOn(tests.addModuleTests(b, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.test_slow_targets = test_slow_targets,
Expand All @@ -516,20 +518,7 @@ pub fn build(b: *std.Build) !void {
.no_builtin = true,
}));

test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
test_step.dependOn(tests.addStandaloneTests(
b,
optimization_modes,
enable_macos_sdk,
enable_ios_sdk,
enable_symlinks_windows,
));
test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release));
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
test_step.dependOn(tests.addCliTests(b));
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));
test_step.dependOn(tests.addModuleTests(b, .{
test_modules_step.dependOn(tests.addModuleTests(b, .{
.test_filters = test_filters,
.test_target_filters = test_target_filters,
.test_slow_targets = test_slow_targets,
Expand All @@ -545,6 +534,22 @@ pub fn build(b: *std.Build) !void {
.max_rss = 5029889638,
}));

test_step.dependOn(test_modules_step);

test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes));
test_step.dependOn(tests.addStandaloneTests(
b,
optimization_modes,
enable_macos_sdk,
enable_ios_sdk,
enable_symlinks_windows,
));
test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release));
test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, enable_ios_sdk, enable_symlinks_windows));
test_step.dependOn(tests.addStackTraceTests(b, test_filters, optimization_modes));
test_step.dependOn(tests.addCliTests(b));
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filters, optimization_modes));

try addWasiUpdateStep(b, version);

const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
Expand Down

0 comments on commit 927bc55

Please sign in to comment.