gpu: nvgpu: unit: add output to make nvtest happy

This adds the correct output for the nvtest interpreter in GVS to track
the per-test pass/fails.

JIRA NVGPU-1042

Change-Id: I7f4a1a63c64988520db08029231f0db9deeaee7d
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1850293
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2018-09-26 14:40:25 -04:00
committed by Abdul Salam
parent 24a678ea81
commit 334f5869c9
4 changed files with 23 additions and 2 deletions

View File

@@ -34,6 +34,7 @@ static struct option core_opts[] = {
{ "verbose", 0, NULL, 'v' },
{ "quiet", 0, NULL, 'q' },
{ "no-color", 0, NULL, 'C' },
{ "nvtest", 0, NULL, 'n' },
{ "unit-load-path", 1, NULL, 'L' },
{ "num-threads", 1, NULL, 'j' },
@@ -41,7 +42,7 @@ static struct option core_opts[] = {
{ NULL, 0, NULL, 0 }
};
static const char *core_opts_str = "hvqCL:j:";
static const char *core_opts_str = "hvqCnL:j:";
void core_print_help(struct unit_fw *fw)
{
@@ -62,6 +63,7 @@ void core_print_help(struct unit_fw *fw)
" -C, --no-color Disable color printing; for example, if writing\n",
" output to a file the color escape sequences will\n",
" corrupt that file.\n",
" -n, --nvtest Enable nvtest-formatted output results\n",
" -L, --unit-load-path <PATH>\n",
" Path to where the unit test libraries reside.\n",
" -j, --num-threads <COUNT>\n",
@@ -122,6 +124,9 @@ int core_parse_args(struct unit_fw *fw, int argc, char **argv)
case 'C':
args->no_color = true;
break;
case 'n':
args->nvtest = true;
break;
case 'L':
args->unit_load_path = optarg;
break;

View File

@@ -22,12 +22,14 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <unit/io.h>
#include <unit/core.h>
#include <unit/args.h>
#include <unit/unit.h>
#include <unit/module.h>
#include <unit/results.h>
@@ -81,8 +83,21 @@ 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",