| ... | @@ -862,18 +862,47 @@ fn runStepNames( | ... | @@ -862,18 +862,47 @@ fn runStepNames( |
| 862 | | 862 | |
| 863 | const total_count = success_count + failure_count + pending_count + skipped_count; | 863 | const total_count = success_count + failure_count + pending_count + skipped_count; |
| 864 | ttyconf.setColor(w, .cyan) catch {}; | 864 | ttyconf.setColor(w, .cyan) catch {}; |
| 865 | w.writeAll("Build Summary:") catch {}; | 865 | ttyconf.setColor(w, .bold) catch {}; |
| | 866 | w.writeAll("Build Summary: ") catch {}; |
| 866 | ttyconf.setColor(w, .reset) catch {}; | 867 | ttyconf.setColor(w, .reset) catch {}; |
| 867 | w.print(" {d}/{d} steps succeeded", .{ success_count, total_count }) catch {}; | 868 | w.print("{d}/{d} steps succeeded", .{ success_count, total_count }) catch {}; |
| 868 | if (skipped_count > 0) w.print(", {d} skipped", .{skipped_count}) catch {}; | 869 | { |
| 869 | if (failure_count > 0) w.print(", {d} failed", .{failure_count}) catch {}; | 870 | ttyconf.setColor(w, .dim) catch {}; |
| | 871 | var first = true; |
| | 872 | if (skipped_count > 0) { |
| | 873 | w.print("{s}{d} skipped", .{ if (first) " (" else ", ", skipped_count }) catch {}; |
| | 874 | first = false; |
| | 875 | } |
| | 876 | if (failure_count > 0) { |
| | 877 | w.print("{s}{d} failed", .{ if (first) " (" else ", ", failure_count }) catch {}; |
| | 878 | first = false; |
| | 879 | } |
| | 880 | if (!first) w.writeByte(')') catch {}; |
| | 881 | ttyconf.setColor(w, .reset) catch {}; |
| | 882 | } |
| 870 | | 883 | |
| 871 | if (test_count > 0) { | 884 | if (test_count > 0) { |
| 872 | w.print("; {d}/{d} tests passed", .{ test_pass_count, test_count }) catch {}; | 885 | w.print("; {d}/{d} tests passed", .{ test_pass_count, test_count }) catch {}; |
| 873 | if (test_skip_count > 0) w.print(", {d} skipped", .{test_skip_count}) catch {}; | 886 | ttyconf.setColor(w, .dim) catch {}; |
| 874 | if (test_fail_count > 0) w.print(", {d} failed", .{test_fail_count}) catch {}; | 887 | var first = true; |
| 875 | if (test_crash_count > 0) w.print(", {d} crashed", .{test_crash_count}) catch {}; | 888 | if (test_skip_count > 0) { |
| 876 | if (test_timeout_count > 0) w.print(", {d} timed out", .{test_timeout_count}) catch {}; | 889 | w.print("{s}{d} skipped", .{ if (first) " (" else ", ", test_skip_count }) catch {}; |
| | 890 | first = false; |
| | 891 | } |
| | 892 | if (test_fail_count > 0) { |
| | 893 | w.print("{s}{d} failed", .{ if (first) " (" else ", ", test_fail_count }) catch {}; |
| | 894 | first = false; |
| | 895 | } |
| | 896 | if (test_crash_count > 0) { |
| | 897 | w.print("{s}{d} crashed", .{ if (first) " (" else ", ", test_crash_count }) catch {}; |
| | 898 | first = false; |
| | 899 | } |
| | 900 | if (test_timeout_count > 0) { |
| | 901 | w.print("{s}{d} timed out", .{ if (first) " (" else ", ", test_timeout_count }) catch {}; |
| | 902 | first = false; |
| | 903 | } |
| | 904 | if (!first) w.writeByte(')') catch {}; |
| | 905 | ttyconf.setColor(w, .reset) catch {}; |
| 877 | } | 906 | } |
| 878 | | 907 | |
| 879 | w.writeAll("\n") catch {}; | 908 | w.writeAll("\n") catch {}; |
| ... | @@ -978,14 +1007,14 @@ fn printStepStatus( | ... | @@ -978,14 +1007,14 @@ fn printStepStatus( |
| 978 | } else if (s.test_results.test_count > 0) { | 1007 | } else if (s.test_results.test_count > 0) { |
| 979 | const pass_count = s.test_results.passCount(); | 1008 | const pass_count = s.test_results.passCount(); |
| 980 | assert(s.test_results.test_count == pass_count + s.test_results.skip_count); | 1009 | assert(s.test_results.test_count == pass_count + s.test_results.skip_count); |
| 981 | try stderr.print(" {d} passed", .{pass_count}); | 1010 | try stderr.print(" {d} pass", .{pass_count}); |
| 982 | if (s.test_results.skip_count > 0) { | 1011 | if (s.test_results.skip_count > 0) { |
| 983 | try ttyconf.setColor(stderr, .white); | 1012 | try ttyconf.setColor(stderr, .reset); |
| 984 | try stderr.writeAll(", "); | 1013 | try stderr.writeAll(", "); |
| 985 | try ttyconf.setColor(stderr, .yellow); | 1014 | try ttyconf.setColor(stderr, .yellow); |
| 986 | try stderr.print("{d} skipped", .{s.test_results.skip_count}); | 1015 | try stderr.print("{d} skip", .{s.test_results.skip_count}); |
| 987 | } | 1016 | } |
| 988 | try ttyconf.setColor(stderr, .white); | 1017 | try ttyconf.setColor(stderr, .reset); |
| 989 | try stderr.print(" ({d} total)", .{s.test_results.test_count}); | 1018 | try stderr.print(" ({d} total)", .{s.test_results.test_count}); |
| 990 | } else { | 1019 | } else { |
| 991 | try stderr.writeAll(" success"); | 1020 | try stderr.writeAll(" success"); |
| ... | @@ -1035,7 +1064,7 @@ fn printStepStatus( | ... | @@ -1035,7 +1064,7 @@ fn printStepStatus( |
| 1035 | try ttyconf.setColor(stderr, .reset); | 1064 | try ttyconf.setColor(stderr, .reset); |
| 1036 | }, | 1065 | }, |
| 1037 | .failure => { | 1066 | .failure => { |
| 1038 | try printStepFailure(s, stderr, ttyconf); | 1067 | try printStepFailure(s, stderr, ttyconf, false); |
| 1039 | try ttyconf.setColor(stderr, .reset); | 1068 | try ttyconf.setColor(stderr, .reset); |
| 1040 | }, | 1069 | }, |
| 1041 | } | 1070 | } |
| ... | @@ -1045,6 +1074,7 @@ fn printStepFailure( | ... | @@ -1045,6 +1074,7 @@ fn printStepFailure( |
| 1045 | s: *Step, | 1074 | s: *Step, |
| 1046 | stderr: *Writer, | 1075 | stderr: *Writer, |
| 1047 | ttyconf: tty.Config, | 1076 | ttyconf: tty.Config, |
| | 1077 | dim: bool, |
| 1048 | ) !void { | 1078 | ) !void { |
| 1049 | if (s.result_error_bundle.errorMessageCount() > 0) { | 1079 | if (s.result_error_bundle.errorMessageCount() > 0) { |
| 1050 | try ttyconf.setColor(stderr, .red); | 1080 | try ttyconf.setColor(stderr, .red); |
| ... | @@ -1055,43 +1085,49 @@ fn printStepFailure( | ... | @@ -1055,43 +1085,49 @@ fn printStepFailure( |
| 1055 | // These first values include all of the test "statuses". Every test is either passsed, | 1085 | // These first values include all of the test "statuses". Every test is either passsed, |
| 1056 | // skipped, failed, crashed, or timed out. | 1086 | // skipped, failed, crashed, or timed out. |
| 1057 | try ttyconf.setColor(stderr, .green); | 1087 | try ttyconf.setColor(stderr, .green); |
| 1058 | try stderr.print(" {d} passed", .{s.test_results.passCount()}); | 1088 | try stderr.print(" {d} pass", .{s.test_results.passCount()}); |
| 1059 | try ttyconf.setColor(stderr, .white); | 1089 | try ttyconf.setColor(stderr, .reset); |
| | 1090 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1060 | if (s.test_results.skip_count > 0) { | 1091 | if (s.test_results.skip_count > 0) { |
| 1061 | try stderr.writeAll(", "); | 1092 | try stderr.writeAll(", "); |
| 1062 | try ttyconf.setColor(stderr, .yellow); | 1093 | try ttyconf.setColor(stderr, .yellow); |
| 1063 | try stderr.print("{d} skipped", .{s.test_results.skip_count}); | 1094 | try stderr.print("{d} skip", .{s.test_results.skip_count}); |
| 1064 | try ttyconf.setColor(stderr, .white); | 1095 | try ttyconf.setColor(stderr, .reset); |
| | 1096 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1065 | } | 1097 | } |
| 1066 | if (s.test_results.fail_count > 0) { | 1098 | if (s.test_results.fail_count > 0) { |
| 1067 | try stderr.writeAll(", "); | 1099 | try stderr.writeAll(", "); |
| 1068 | try ttyconf.setColor(stderr, .red); | 1100 | try ttyconf.setColor(stderr, .red); |
| 1069 | try stderr.print("{d} failed", .{s.test_results.fail_count}); | 1101 | try stderr.print("{d} fail", .{s.test_results.fail_count}); |
| 1070 | try ttyconf.setColor(stderr, .white); | 1102 | try ttyconf.setColor(stderr, .reset); |
| | 1103 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1071 | } | 1104 | } |
| 1072 | if (s.test_results.crash_count > 0) { | 1105 | if (s.test_results.crash_count > 0) { |
| 1073 | try stderr.writeAll(", "); | 1106 | try stderr.writeAll(", "); |
| 1074 | try ttyconf.setColor(stderr, .red); | 1107 | try ttyconf.setColor(stderr, .red); |
| 1075 | try stderr.print("{d} crashed", .{s.test_results.crash_count}); | 1108 | try stderr.print("{d} crash", .{s.test_results.crash_count}); |
| 1076 | try ttyconf.setColor(stderr, .white); | 1109 | try ttyconf.setColor(stderr, .reset); |
| | 1110 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1077 | } | 1111 | } |
| 1078 | if (s.test_results.timeout_count > 0) { | 1112 | if (s.test_results.timeout_count > 0) { |
| 1079 | try stderr.writeAll(", "); | 1113 | try stderr.writeAll(", "); |
| 1080 | try ttyconf.setColor(stderr, .red); | 1114 | try ttyconf.setColor(stderr, .red); |
| 1081 | try stderr.print("{d} timed out", .{s.test_results.timeout_count}); | 1115 | try stderr.print("{d} timeout", .{s.test_results.timeout_count}); |
| 1082 | try ttyconf.setColor(stderr, .white); | 1116 | try ttyconf.setColor(stderr, .reset); |
| | 1117 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1083 | } | 1118 | } |
| 1084 | try stderr.print(" ({d} total)", .{s.test_results.test_count}); | 1119 | try stderr.print(" ({d} total)", .{s.test_results.test_count}); |
| 1085 | | 1120 | |
| 1086 | // Memory leaks are intentionally written after the total, because is isn't a test *status*, | 1121 | // Memory leaks are intentionally written after the total, because is isn't a test *status*, |
| 1087 | // but just a flag that any tests -- even passed ones -- can have. We also use a different | 1122 | // but just a flag that any tests -- even passed ones -- can have. We also use a different |
| 1088 | // separator, so it looks like: | 1123 | // separator, so it looks like: |
| 1089 | // 2 passed, 1 skipped, 2 failed (5 total); 2 leaks | 1124 | // 2 pass, 1 skip, 2 fail (5 total); 2 leaks |
| 1090 | if (s.test_results.leak_count > 0) { | 1125 | if (s.test_results.leak_count > 0) { |
| 1091 | try stderr.writeAll("; "); | 1126 | try stderr.writeAll("; "); |
| 1092 | try ttyconf.setColor(stderr, .red); | 1127 | try ttyconf.setColor(stderr, .red); |
| 1093 | try stderr.print("{d} leaks", .{s.test_results.leak_count}); | 1128 | try stderr.print("{d} leaks", .{s.test_results.leak_count}); |
| 1094 | try ttyconf.setColor(stderr, .white); | 1129 | try ttyconf.setColor(stderr, .reset); |
| | 1130 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1095 | } | 1131 | } |
| 1096 | | 1132 | |
| 1097 | // It's usually not helpful to know how many error logs there were because they tend to | 1133 | // It's usually not helpful to know how many error logs there were because they tend to |
| ... | @@ -1107,7 +1143,8 @@ fn printStepFailure( | ... | @@ -1107,7 +1143,8 @@ fn printStepFailure( |
| 1107 | try stderr.writeAll("; "); | 1143 | try stderr.writeAll("; "); |
| 1108 | try ttyconf.setColor(stderr, .red); | 1144 | try ttyconf.setColor(stderr, .red); |
| 1109 | try stderr.print("{d} error logs", .{s.test_results.log_err_count}); | 1145 | try stderr.print("{d} error logs", .{s.test_results.log_err_count}); |
| 1110 | try ttyconf.setColor(stderr, .white); | 1146 | try ttyconf.setColor(stderr, .reset); |
| | 1147 | if (dim) try ttyconf.setColor(stderr, .dim); |
| 1111 | } | 1148 | } |
| 1112 | | 1149 | |
| 1113 | try stderr.writeAll("\n"); | 1150 | try stderr.writeAll("\n"); |
| ... | @@ -1422,7 +1459,7 @@ pub fn printErrorMessages( | ... | @@ -1422,7 +1459,7 @@ pub fn printErrorMessages( |
| 1422 | try stderr.writeAll(s.name); | 1459 | try stderr.writeAll(s.name); |
| 1423 | | 1460 | |
| 1424 | if (s == failing_step) { | 1461 | if (s == failing_step) { |
| 1425 | try printStepFailure(s, stderr, ttyconf); | 1462 | try printStepFailure(s, stderr, ttyconf, true); |
| 1426 | } else { | 1463 | } else { |
| 1427 | try stderr.writeAll("\n"); | 1464 | try stderr.writeAll("\n"); |
| 1428 | } | 1465 | } |
| ... | @@ -1432,7 +1469,7 @@ pub fn printErrorMessages( | ... | @@ -1432,7 +1469,7 @@ pub fn printErrorMessages( |
| 1432 | // Just print the failing step itself. | 1469 | // Just print the failing step itself. |
| 1433 | try ttyconf.setColor(stderr, .dim); | 1470 | try ttyconf.setColor(stderr, .dim); |
| 1434 | try stderr.writeAll(failing_step.name); | 1471 | try stderr.writeAll(failing_step.name); |
| 1435 | try printStepFailure(failing_step, stderr, ttyconf); | 1472 | try printStepFailure(failing_step, stderr, ttyconf, true); |
| 1436 | try ttyconf.setColor(stderr, .reset); | 1473 | try ttyconf.setColor(stderr, .reset); |
| 1437 | } | 1474 | } |
| 1438 | | 1475 | |