@@ -5,9 +5,6 @@ const supported_oses: []const std.Target.Os.Tag = &.{
55};
66
77pub 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