gpu: nvgpu: unit: add test function name to logs

This patch adds the test function name to output logs to make it
easier to establish traceability between SWUTS and test results.
Also, the unit test name as defined in the UNIT_TEST macro can
now be used to clarify the subcase when a given test function is
used several times with different arguments.

JIRA NVGPU-3510

Change-Id: I652ecd8c06fd89e4d78d419f73b35b69ae71a8ef
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2241879
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nicolas Benech
2019-11-18 17:17:28 -05:00
committed by Alex Waterman
parent 1ab3f73230
commit 86f1b2336a
6 changed files with 2182 additions and 1336 deletions

View File

@@ -108,18 +108,18 @@ static void *core_exec_module(void *module_param)
if (t->test_lvl > module->fw->args->test_lvl) {
core_add_test_record(module->fw, module, t, SKIPPED);
core_vbs(module->fw, 1, "Skipping L%d test %s.%s\n",
t->test_lvl, module->name, t->name);
t->test_lvl, module->name, t->fn_name);
continue;
}
core_msg(module->fw, "Running %s.%s\n", module->name,
t->name);
core_msg(module->fw, "Running %s.%s(%s)\n", module->name,
t->fn_name, t->case_name);
test_status = t->fn(module, g, t->args);
if (test_status != UNIT_SUCCESS)
core_msg_color(module->fw, C_RED,
" Unit error! Test %s.%s FAILED!\n",
module->name, t->name);
" Unit error! Test %s.%s(%s) FAILED!\n",
module->name, t->fn_name, t->case_name);
core_add_test_record(module->fw, module, t,
test_status == UNIT_SUCCESS ? PASSED : FAILED);
@@ -149,8 +149,9 @@ thread_exit:
static void thread_error_handler(int sig, siginfo_t *siginfo, void *context)
{
core_msg_color(thread_local_module->fw, C_RED,
" Signal %d in Test: %s.%s!\n", sig,
thread_local_module->name, thread_local_test->name);
" Signal %d in Test: %s.%s(%s)!\n", sig,
thread_local_module->name, thread_local_test->fn_name,
thread_local_test->case_name);
core_add_test_record(thread_local_module->fw, thread_local_module,
thread_local_test, FAILED);
sem_post(&unit_thread_semaphore);

View File

@@ -54,14 +54,14 @@ static int check_module(struct unit_fw *fw, struct unit_module *mod)
for (i = 0; i < mod->nr_tests; i++) {
struct unit_module_test *test = &mod->tests[i];
if (test->name == NULL) {
if (test->fn_name == NULL) {
core_err(fw, "%s: Unnamed test\n", mod->name);
return -1;
}
if (test->fn == NULL) {
core_err(fw, "%s: Test %s missing function \n",
mod->name, test->name);
core_err(fw, "%s: Test %s missing function\n",
mod->name, test->fn_name);
return -1;
}
}

View File

@@ -126,7 +126,8 @@ static void dump_test_record(FILE *logfile, struct unit_test_record *rec,
{
first ? fprintf(logfile, "\t{") : fprintf(logfile, ",\n\t{");
fprintf(logfile, "\"unit\": \"%s\", ", rec->mod->name);
fprintf(logfile, "\"test\": \"%s\", ", rec->test->name);
fprintf(logfile, "\"test\": \"%s\", ", rec->test->fn_name);
fprintf(logfile, "\"case\": \"%s\", ", rec->test->case_name);
fprintf(logfile, "\"status\": %s, ", status ? "true":"false");
fprintf(logfile, "\"uid\": \"%s\", ", rec->test->jama.unique_id);
fprintf(logfile, "\"vc\": \"%s\", ",
@@ -179,9 +180,10 @@ void core_print_test_status(struct unit_fw *fw)
core_msg(fw, "Skipped tests:\n");
core_msg(fw, "\n");
for_record_in_test_list(skipped_tests, rec) {
core_msg(fw, " %s.%s\n",
core_msg(fw, " %s.%s(%s)\n",
rec->mod->name,
rec->test->name);
rec->test->fn_name,
rec->test->case_name);
}
core_msg(fw, "\n");
@@ -189,9 +191,10 @@ void core_print_test_status(struct unit_fw *fw)
core_msg(fw, "\n");
for_record_in_test_list(failing_tests, rec) {
core_msg(fw, " %s.%s\n",
core_msg(fw, " %s.%s(%s)\n",
rec->mod->name,
rec->test->name);
rec->test->fn_name,
rec->test->case_name);
}
dump_test_log(fw, &fw->results->passing, &fw->results->failing);