mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-08 06:48:41 +00:00
update tests summary
This commit is contained in:
committed by
Ryan Fleury
parent
31662822db
commit
49af8248ef
@@ -536,6 +536,18 @@ str8_chop(String8 str, U64 amt)
|
||||
return str;
|
||||
}
|
||||
|
||||
internal String8
|
||||
str8_chop_line(String8 *str)
|
||||
{
|
||||
U64 new_line_pos = str8_find_needle(*str, 0, str8_lit("\n"), 0);
|
||||
String8 line = str8_prefix(*str, new_line_pos);
|
||||
if (str8_ends_with(line, str8_lit("\r"), 0)) {
|
||||
line = str8_chop(line, 1);
|
||||
}
|
||||
*str = str8_skip(*str, new_line_pos + 1);
|
||||
return line;
|
||||
}
|
||||
|
||||
internal String8
|
||||
str8_skip_chop_whitespace(String8 string)
|
||||
{
|
||||
|
||||
@@ -217,6 +217,7 @@ internal String8 str8_prefix(String8 str, U64 size);
|
||||
internal String8 str8_skip(String8 str, U64 amt);
|
||||
internal String8 str8_postfix(String8 str, U64 size);
|
||||
internal String8 str8_chop(String8 str, U64 amt);
|
||||
internal String8 str8_chop_line(String8 *str);
|
||||
internal String8 str8_skip_chop_whitespace(String8 string);
|
||||
internal String8 str8_skip_chop_slashes(String8 string);
|
||||
|
||||
|
||||
+22
-28
@@ -844,28 +844,17 @@ t_kill_all(String8 pattern)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
// TODO: obsolete
|
||||
internal String8
|
||||
t_chop_line(String8 *output)
|
||||
t_chop_line(String8 *string)
|
||||
{
|
||||
U64 new_line_pos = str8_find_needle(*output, 0, str8_lit("\n"), 0);
|
||||
String8 line = str8_prefix(*output, new_line_pos);
|
||||
if (str8_ends_with(line, str8_lit("\r"), 0)) {
|
||||
line = str8_chop(line, 1);
|
||||
return str8_chop_line(string);
|
||||
}
|
||||
*output = str8_skip(*output, new_line_pos + 1);
|
||||
return line;
|
||||
}
|
||||
|
||||
// TODO: obsolete
|
||||
internal B32
|
||||
t_match_line(String8 *output, String8 expected_line)
|
||||
{
|
||||
String8 before_chop = *output;
|
||||
String8 line = t_chop_line(output);
|
||||
B32 is_match = str8_match(line, expected_line, 0);
|
||||
if ( ! is_match) {
|
||||
*output = before_chop;
|
||||
}
|
||||
return is_match;
|
||||
return str8_match_wildcard(t_chop_line(output), expected_line, 0);
|
||||
}
|
||||
|
||||
internal B32
|
||||
@@ -1220,16 +1209,19 @@ t_entry_point(CmdLine *cmdline)
|
||||
max_group_size = Max(max_group_size, cstring8_length((U8*)g_torture_tests[test_idx]->group));
|
||||
}
|
||||
|
||||
PrintHeader("Tests");
|
||||
U64 pass_count = 0;
|
||||
U64 fail_count = 0;
|
||||
U64 crash_count = 0;
|
||||
U64 max_digit_count = count_digits_u64(target_indices.count, 10);
|
||||
U64 total_time_start = now_time_us();
|
||||
|
||||
typedef struct { U64 target_idx, d; } Slowest;
|
||||
Slowest slowest[5] = {0};
|
||||
for EachElement(i, slowest) { slowest[i].target_idx = max_U64; }
|
||||
|
||||
for EachIndex(i, target_indices.count) {
|
||||
if (i == 0) { PrintHeader("Tests"); }
|
||||
|
||||
U64 target_idx = target_indices.v[i];
|
||||
T_Test *test = g_torture_tests[target_idx];
|
||||
|
||||
@@ -1280,6 +1272,8 @@ t_entry_point(CmdLine *cmdline)
|
||||
String8 s = string_from_elapsed_time(scratch.arena, t);
|
||||
fprintf(stdout, " %.*s", str8_varg(s));
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
U64 insert_idx = max_U64;
|
||||
for EachElement(i, slowest) {
|
||||
if (d > slowest[i].d) {
|
||||
@@ -1305,9 +1299,10 @@ t_entry_point(CmdLine *cmdline)
|
||||
if (g_stop_on_first_fail_or_crash) { goto exit; }
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
U64 total_time_end = now_time_us();
|
||||
|
||||
if (target_indices.count > 0 && (pass_count > 0 || fail_count > 0 || crash_count > 0 || skip_count > 0)) {
|
||||
fprintf(stderr, "\n");
|
||||
PrintHeader("Summary");
|
||||
U64 total_time_dt = total_time_end - total_time_start;
|
||||
String8 total_time_str = string_from_elapsed_time(scratch.arena, date_time_from_micro_seconds(total_time_dt));
|
||||
@@ -1316,19 +1311,24 @@ t_entry_point(CmdLine *cmdline)
|
||||
fprintf(stderr, " Crashed %llu\n", (unsigned long long)crash_count);
|
||||
fprintf(stderr, " Skipped %llu\n", (unsigned long long)skip_count);
|
||||
fprintf(stderr, " Time %.*s\n", str8_varg(total_time_str));
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
{
|
||||
fprintf(stderr, " Slow Tests\n");
|
||||
U64 slow_count = 0;
|
||||
for EachElement(i, slowest) {
|
||||
Slowest s = slowest[i];
|
||||
if (s.target_idx >= g_torture_test_count) { break; }
|
||||
slow_count += 1;
|
||||
}
|
||||
|
||||
if (slow_count > 3) {
|
||||
U64 label_max = 0;
|
||||
U64 group_max = 0;
|
||||
for EachElement(i, slowest) {
|
||||
Slowest s = slowest[i];
|
||||
if (s.target_idx >= g_torture_test_count) { break; }
|
||||
label_max = Max(strlen(g_torture_tests[s.target_idx]->label), label_max);
|
||||
group_max = Max(strlen(g_torture_tests[s.target_idx]->group), group_max);
|
||||
}
|
||||
|
||||
fprintf(stderr, " Slow Tests\n");
|
||||
for EachElement(i, slowest) {
|
||||
Slowest s = slowest[i];
|
||||
if (s.target_idx >= g_torture_test_count) { break; }
|
||||
@@ -1340,13 +1340,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
(int)(label_max - strlen(g_torture_tests[s.target_idx]->label)) + 4, dots,
|
||||
str8_varg(elapsed_time));
|
||||
}
|
||||
|
||||
if (pass_count == target_indices.count) {
|
||||
fprintf(stdout, "\n \x1b[32m" "%s" "\x1b[0m\n\n", "All Tests Passed!");
|
||||
fprintf(stderr, "--------------------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
exit:;
|
||||
|
||||
Reference in New Issue
Block a user