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

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

View File

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

View File

@@ -22,12 +22,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <pthread.h> #include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
#include <signal.h> #include <signal.h>
#include <unit/io.h> #include <unit/io.h>
#include <unit/core.h> #include <unit/core.h>
#include <unit/args.h>
#include <unit/unit.h> #include <unit/unit.h>
#include <unit/module.h> #include <unit/module.h>
#include <unit/results.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, core_msg(module->fw, "Running %s.%s\n", module->name,
t->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); 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) if (test_status != UNIT_SUCCESS)
core_msg_color(module->fw, C_RED, core_msg_color(module->fw, C_RED,
" Unit error! Test %s.%s FAILED!\n", " Unit error! Test %s.%s FAILED!\n",

View File

@@ -15,7 +15,7 @@ if [ -f nvgpu_unit ]; then
# if the executable is in the current directory, we are running on # if the executable is in the current directory, we are running on
# target, so use that dir structure # target, so use that dir structure
LD_LIBRARY_PATH=".:units" LD_LIBRARY_PATH=".:units"
NVGPU_UNIT="./nvgpu_unit -L units/" NVGPU_UNIT="./nvgpu_unit -n -L units/"
else else
# running on host # running on host
LD_LIBRARY_PATH="build:build/units" LD_LIBRARY_PATH="build:build/units"