gpu: nvgpu: unit: print nvtest info for whole test

The nvtest output required to run as part of the nvgpu_submit framework
was being printed per unit test. However, when we run each test in a
thread with -j, the nvtest output was mixed among the tests as they
finished and the results were not consistent.

This patch changes the unit test framework to only output the nvtest
start/pass/fail messages for the entire unit test framework run so that
the output is consistent. This will allow enabling of threaded runs in
GVS.

For the NVTEST output, we want to use the binary name, so save that from
argv[0] to use later.

JIRA NVGPU-1042

Change-Id: I71697e75d4a0bba8c5aa2425bc25de57322826d7
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1924616
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2018-10-10 09:15:02 -04:00
committed by mobile promotions
parent 9bf47eff8a
commit 78eca5bdc3
3 changed files with 21 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ struct unit_fw_args {
bool no_color;
int thread_count;
bool nvtest;
const char *binary_name;
const char *unit_name;
const char *unit_load_path;

View File

@@ -102,6 +102,15 @@ int core_parse_args(struct unit_fw *fw, int argc, char **argv)
memset(args, 0, sizeof(*args));
set_arg_defaults(args);
args->binary_name = strrchr(argv[0], '/');
if (args->binary_name == NULL) {
/* no slash, so use the whole name */
args->binary_name = argv[0];
} else {
/* move past the slash */
args->binary_name++;
}
fw->args = args;
while (1) {

View File

@@ -83,21 +83,9 @@ static void *core_exec_module(void *module_param)
core_msg(module->fw, "Running %s.%s\n", module->name,
t->name);
if (args(module->fw)->nvtest) {
/* special prints for NVTEST fw in GVS */
printf("[%s: %s.%s]\n",
"start",
module->name, t->name);
}
test_status = t->fn(module, g, t->args);
if (args(module->fw)->nvtest) {
/* special prints for NVTEST fw in GVS */
printf("[%s: %s.%s]\n",
test_status == UNIT_SUCCESS ? "pass" : "fail",
module->name, t->name);
}
if (test_status != UNIT_SUCCESS)
core_msg_color(module->fw, C_RED,
" Unit error! Test %s.%s FAILED!\n",
@@ -183,6 +171,10 @@ int core_exec(struct unit_fw *fw)
struct unit_module **modules;
int err = 0;
if (args(fw)->nvtest) {
/* special prints for NVTEST fw in GVS */
printf("[start: %s]\n", args(fw)->binary_name);
}
core_vbs(fw, 1, "Using %d threads\n", fw->args->thread_count);
sem_init(&unit_thread_semaphore, 0, fw->args->thread_count);
@@ -215,5 +207,12 @@ int core_exec(struct unit_fw *fw)
}
}
if (args(fw)->nvtest) {
/* special prints for NVTEST fw in GVS */
printf("[%s: %s]\n",
fw->results->nr_tests == fw->results->nr_passing ?
"pass" : "fail",
args(fw)->binary_name);
}
return 0;
}