test(benchmark): run benchmarks last with start log
This commit is contained in:
@@ -1953,7 +1953,6 @@ static const test_case_t test_cases[] = {
|
||||
{"binary v2 refresh from path", test_binary_v2_refresh_from_path},
|
||||
{"refresh from path failure preserves state", test_refresh_from_path_failure_preserves_state},
|
||||
{"binary v2 refresh replaces keys", test_binary_v2_refresh_replaces_keys},
|
||||
{"binary v2 file benchmark", test_binary_v2_file_benchmark},
|
||||
{"detection apis", test_detection_apis},
|
||||
{"detect binary version v2", test_detect_binary_version_v2},
|
||||
{"explicit version apis", test_explicit_version_apis},
|
||||
@@ -2007,6 +2006,7 @@ static const test_case_t test_cases[] = {
|
||||
{"hook alloc fail internal v2 parse index", test_hook_alloc_fail_internal_v2_parse_index},
|
||||
{"hook alloc fail internal v2 memory copy", test_hook_alloc_fail_internal_v2_memory_copy},
|
||||
#endif
|
||||
{"binary v2 file benchmark", test_binary_v2_file_benchmark},
|
||||
};
|
||||
|
||||
static void log_case(bool passed, unsigned int index, unsigned int total, long elapsed_ms, const char *name, const char *message)
|
||||
@@ -2033,6 +2033,11 @@ static void log_case(bool passed, unsigned int index, unsigned int total, long e
|
||||
|
||||
static char benchmark_summary[8192];
|
||||
|
||||
static bool is_benchmark_case(const char *name)
|
||||
{
|
||||
return name && strstr(name, "benchmark") != NULL;
|
||||
}
|
||||
|
||||
static int run_test_case(unsigned int index, unsigned int total)
|
||||
{
|
||||
test_context_t context;
|
||||
@@ -2045,6 +2050,17 @@ static int run_test_case(unsigned int index, unsigned int total)
|
||||
#ifdef IKV_TESTING
|
||||
ikv_test_hooks_reset();
|
||||
#endif
|
||||
if (is_benchmark_case(test_cases[index].name))
|
||||
{
|
||||
printf("%s[%sINFO%s]%s starting benchmark [%u/%u] %s\n",
|
||||
ANSI_WHITE,
|
||||
ANSI_YELLOW,
|
||||
ANSI_WHITE,
|
||||
ANSI_RESET,
|
||||
index + 1u,
|
||||
total,
|
||||
test_cases[index].name);
|
||||
}
|
||||
start_time = clock();
|
||||
result = test_cases[index].fn(&context);
|
||||
end_time = clock();
|
||||
|
||||
Reference in New Issue
Block a user