diff --git a/userspace/include/unit/args.h b/userspace/include/unit/args.h index 708a16551..f2413fec8 100644 --- a/userspace/include/unit/args.h +++ b/userspace/include/unit/args.h @@ -43,6 +43,7 @@ struct unit_fw_args { int verbose_lvl; bool no_color; int thread_count; + bool nvtest; const char *unit_name; const char *unit_load_path; diff --git a/userspace/src/args.c b/userspace/src/args.c index cf17c9838..79fec0767 100644 --- a/userspace/src/args.c +++ b/userspace/src/args.c @@ -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 \n", " Path to where the unit test libraries reside.\n", " -j, --num-threads \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; diff --git a/userspace/src/exec.c b/userspace/src/exec.c index 8a99437be..9f8e38508 100644 --- a/userspace/src/exec.c +++ b/userspace/src/exec.c @@ -22,12 +22,14 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -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", diff --git a/userspace/unit.sh b/userspace/unit.sh index 62d7a4446..155c3727f 100755 --- a/userspace/unit.sh +++ b/userspace/unit.sh @@ -15,7 +15,7 @@ if [ -f nvgpu_unit ]; then # if the executable is in the current directory, we are running on # target, so use that dir structure LD_LIBRARY_PATH=".:units" - NVGPU_UNIT="./nvgpu_unit -L units/" + NVGPU_UNIT="./nvgpu_unit -n -L units/" else # running on host LD_LIBRARY_PATH="build:build/units"