diff --git a/lib/compiler/build_runner.zig b/lib/compiler/build_runner.zig index 421d2e72f1..2eff156b1e 100644 --- a/lib/compiler/build_runner.zig +++ b/lib/compiler/build_runner.zig @@ -841,6 +841,10 @@ fn printStepStatus( .skipped, .skipped_oom => |skip| { try ttyconf.setColor(stderr, .yellow); try stderr.writeAll(" skipped"); + if (s.result_skip_reason) |reason| { + try stderr.writeAll(": "); + try stderr.writeAll(reason); + } if (skip == .skipped_oom) { try stderr.writeAll(" (not enough memory)"); try ttyconf.setColor(stderr, .dim); diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index 421c8fa579..a6c013bec9 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -39,6 +39,7 @@ state: State, /// total system memory available. max_rss: usize, +result_skip_reason: ?[]const u8 = null, result_error_msgs: std.ArrayListUnmanaged([]const u8), result_error_bundle: std.zig.ErrorBundle, result_stderr: []const u8, diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index 9db00460a9..c23c29f878 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -1017,7 +1017,10 @@ fn runCommand( .link_libc = exe.is_linking_libc, })) { .native, .rosetta => { - if (allow_skip) return error.MakeSkipped; + if (allow_skip) { + run.step.result_skip_reason = "Invalid binary"; + return error.MakeSkipped; + } break :interpret; }, .wine => |bin_name| { @@ -1098,7 +1101,10 @@ fn runCommand( } }, .bad_dl => |foreign_dl| { - if (allow_skip) return error.MakeSkipped; + if (allow_skip) { + run.step.result_skip_reason = "Invalid binary"; + return error.MakeSkipped; + } const host_dl = b.graph.host.result.dynamic_linker.get() orelse "(none)"; @@ -1110,7 +1116,10 @@ fn runCommand( , .{ host_dl, foreign_dl }); }, .bad_os_or_cpu => { - if (allow_skip) return error.MakeSkipped; + if (allow_skip) { + run.step.result_skip_reason = "Invalid os or cpu"; + return error.MakeSkipped; + } const host_name = try b.graph.host.result.zigTriple(b.allocator); const foreign_name = try exe.rootModuleTarget().zigTriple(b.allocator); @@ -1129,7 +1138,10 @@ fn runCommand( try Step.handleVerbose2(step.owner, cwd, run.env_map, interp_argv.items); break :term spawnChildAndCollect(run, interp_argv.items, has_side_effects, prog_node, fuzz_context) catch |e| { - if (!run.failing_to_execute_foreign_is_an_error) return error.MakeSkipped; + if (!run.failing_to_execute_foreign_is_an_error) { + run.step.result_skip_reason = "Foreign binary failed"; + return error.MakeSkipped; + } return step.fail("unable to spawn interpreter {s}: {s}", .{ interp_argv.items[0], @errorName(e), @@ -1736,8 +1748,10 @@ fn failForeign( ) error{ MakeFailed, MakeSkipped, OutOfMemory } { switch (run.stdio) { .check, .zig_test => { - if (run.skip_foreign_checks) + if (run.skip_foreign_checks) { + run.step.result_skip_reason = "Foreign binary failed"; return error.MakeSkipped; + } const b = run.step.owner; const host_name = try b.graph.host.result.zigTriple(b.allocator);