| ... | @@ -822,9 +822,19 @@ fn runCommand( | ... | @@ -822,9 +822,19 @@ fn runCommand( |
| 822 | }, | 822 | }, |
| 823 | }, | 823 | }, |
| 824 | .zig_test => { | 824 | .zig_test => { |
| | 825 | const prefix: []const u8 = p: { |
| | 826 | if (result.stdio.test_metadata) |tm| { |
| | 827 | if (tm.next_index <= tm.names.len) { |
| | 828 | const name = tm.testName(tm.next_index - 1); |
| | 829 | break :p b.fmt("while executing test '{s}', ", .{name}); |
| | 830 | } |
| | 831 | } |
| | 832 | break :p ""; |
| | 833 | }; |
| 825 | const expected_term: std.process.Child.Term = .{ .Exited = 0 }; | 834 | const expected_term: std.process.Child.Term = .{ .Exited = 0 }; |
| 826 | if (!termMatches(expected_term, result.term)) { | 835 | if (!termMatches(expected_term, result.term)) { |
| 827 | return step.fail("the following command {} (expected {}):\n{s}", .{ | 836 | return step.fail("{s}the following command {} (expected {}):\n{s}", .{ |
| | 837 | prefix, |
| 828 | fmtTerm(result.term), | 838 | fmtTerm(result.term), |
| 829 | fmtTerm(expected_term), | 839 | fmtTerm(expected_term), |
| 830 | try Step.allocPrintCmd(arena, self.cwd, final_argv), | 840 | try Step.allocPrintCmd(arena, self.cwd, final_argv), |
| ... | @@ -832,8 +842,8 @@ fn runCommand( | ... | @@ -832,8 +842,8 @@ fn runCommand( |
| 832 | } | 842 | } |
| 833 | if (!result.stdio.test_results.isSuccess()) { | 843 | if (!result.stdio.test_results.isSuccess()) { |
| 834 | return step.fail( | 844 | return step.fail( |
| 835 | "the following test command failed:\n{s}", | 845 | "{s}the following test command failed:\n{s}", |
| 836 | .{try Step.allocPrintCmd(arena, self.cwd, final_argv)}, | 846 | .{ prefix, try Step.allocPrintCmd(arena, self.cwd, final_argv) }, |
| 837 | ); | 847 | ); |
| 838 | } | 848 | } |
| 839 | }, | 849 | }, |
| ... | @@ -922,6 +932,7 @@ const StdIoResult = struct { | ... | @@ -922,6 +932,7 @@ const StdIoResult = struct { |
| 922 | stdout_null: bool, | 932 | stdout_null: bool, |
| 923 | stderr_null: bool, | 933 | stderr_null: bool, |
| 924 | test_results: Step.TestResults, | 934 | test_results: Step.TestResults, |
| | 935 | test_metadata: ?TestMetadata, |
| 925 | }; | 936 | }; |
| 926 | | 937 | |
| 927 | fn evalZigTest( | 938 | fn evalZigTest( |
| ... | @@ -1057,6 +1068,7 @@ fn evalZigTest( | ... | @@ -1057,6 +1068,7 @@ fn evalZigTest( |
| 1057 | .skip_count = skip_count, | 1068 | .skip_count = skip_count, |
| 1058 | .leak_count = leak_count, | 1069 | .leak_count = leak_count, |
| 1059 | }, | 1070 | }, |
| | 1071 | .test_metadata = metadata, |
| 1060 | }; | 1072 | }; |
| 1061 | } | 1073 | } |
| 1062 | | 1074 | |
| ... | @@ -1172,6 +1184,7 @@ fn evalGeneric(self: *RunStep, child: *std.process.Child) !StdIoResult { | ... | @@ -1172,6 +1184,7 @@ fn evalGeneric(self: *RunStep, child: *std.process.Child) !StdIoResult { |
| 1172 | .stdout_null = stdout_null, | 1184 | .stdout_null = stdout_null, |
| 1173 | .stderr_null = stderr_null, | 1185 | .stderr_null = stderr_null, |
| 1174 | .test_results = .{}, | 1186 | .test_results = .{}, |
| | 1187 | .test_metadata = null, |
| 1175 | }; | 1188 | }; |
| 1176 | } | 1189 | } |
| 1177 | | 1190 | |