Skip to content

Commit ada498c

Browse files
committed
test: don't run non-native tests by default
wine is slow and darling does not even complete :)
1 parent b7789f9 commit ada498c

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

build.zig

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ const supported_oses: []const std.Target.Os.Tag = &.{
55
};
66

77
pub fn build(b: *std.Build) !void {
8-
b.enable_wine = true;
9-
b.enable_darling = false; // FIXME: for some reason this causes the yes fuzz test to block forever
10-
118
const optimize = b.standardOptimizeOption(.{});
129

1310
const trace = b.option(bool, "trace", "enable tracy tracing") orelse false;
@@ -58,6 +55,17 @@ pub fn build(b: *std.Build) !void {
5855
run_step.dependOn(&run_coreutils_exe.step);
5956
}
6057

58+
const run_non_native_tests = b.option(
59+
bool,
60+
"run_non_native_tests",
61+
"run non-native tests",
62+
) orelse false;
63+
64+
if (run_non_native_tests) {
65+
b.enable_wine = true;
66+
b.enable_darling = false; // FIXME: for some reason this never finishes
67+
}
68+
6169
// test and check
6270
{
6371
const check_step = b.step("check", "");
@@ -77,6 +85,7 @@ pub fn build(b: *std.Build) !void {
7785
coverage,
7886
test_step,
7987
check_step,
88+
run_non_native_tests,
8089
);
8190
}
8291
}
@@ -122,6 +131,7 @@ fn createTestAndCheckSteps(
122131
coverage: bool,
123132
test_step: *std.Build.Step,
124133
check_step: *std.Build.Step,
134+
run_non_native_tests: bool,
125135
) !void {
126136
const module = createRootModule(
127137
b,
@@ -152,17 +162,24 @@ fn createTestAndCheckSteps(
152162
}
153163
}
154164

155-
const run_coreutils_test = b.addRunArtifact(coreutils_test);
156-
157-
// FIXME: why do we need to change both of these?
158-
run_coreutils_test.skip_foreign_checks = true;
159-
run_coreutils_test.failing_to_execute_foreign_is_an_error = false;
160-
161165
const target_test_step = b.step(
162166
b.fmt("test_{s}", .{@tagName(target.result.os.tag)}),
163167
b.fmt("Run the tests for {s}", .{@tagName(target.result.os.tag)}),
164168
);
165-
target_test_step.dependOn(&run_coreutils_test.step);
169+
170+
if (is_native_target or run_non_native_tests) {
171+
const run_coreutils_test = b.addRunArtifact(coreutils_test);
172+
173+
if (!is_native_target) {
174+
// FIXME: why do we need to change both of these?
175+
run_coreutils_test.skip_foreign_checks = true;
176+
run_coreutils_test.failing_to_execute_foreign_is_an_error = false;
177+
}
178+
179+
target_test_step.dependOn(&run_coreutils_test.step);
180+
} else {
181+
target_test_step.dependOn(&coreutils_test.step);
182+
}
166183

167184
const build_exe = b.addExecutable(.{
168185
.name = b.fmt("build_zig-coreutils-{s}", .{@tagName(target.result.os.tag)}),

0 commit comments

Comments
 (0)