gpu: nvgpu: SWUTS for enabled

Add preprocessor directives for nvgpu-enabled.h header.

Jira NVGPU-3943

Change-Id: Ieab43fc49bafcd74a907b9dd1f175b693754f559
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2191262
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
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:
Vedashree Vidwans
2019-09-05 16:29:47 -07:00
committed by Alex Waterman
parent fda0f1a9d9
commit 6b8aaf3bb8
2 changed files with 12 additions and 40 deletions

View File

@@ -27,22 +27,11 @@
#include <nvgpu/gk20a.h>
#include <nvgpu/posix/posix-fault-injection.h>
#include "nvgpu-enabled.h"
static unsigned long *original_enabled_flags;
/*
* Test nvgpu_init_enabled_flags():
*
* 1. With memory failure, check that init fails with -ENOMEM
* 2. Init works in regular scenario
*
* This test should be first to execute. Newly, inited enabled_flags will be
* used by rest of the tests in this module.
*
* Note: Since, enabled_flags are allocated during gk20a init, we store
* original allocated memory address in test_init_free_parameters structure.
* This pointer should be restored before exiting this module.
*/
static int test_nvgpu_init_enabled_flags(struct unit_module *m,
int test_nvgpu_init_enabled_flags(struct unit_module *m,
struct gk20a *g, void *args)
{
int err;
@@ -77,13 +66,7 @@ static int test_nvgpu_init_enabled_flags(struct unit_module *m,
return UNIT_SUCCESS;
}
/*
* Test nvgpu_is_enabled():
*
* As enabled_flags inited(using kzalloc) by previous test, all flags should
* be disabled (set to 0).
*/
static int test_nvgpu_enabled_flags_false_check(struct unit_module *m,
int test_nvgpu_enabled_flags_false_check(struct unit_module *m,
struct gk20a *g, void *args)
{
u32 i;
@@ -100,16 +83,7 @@ static int test_nvgpu_enabled_flags_false_check(struct unit_module *m,
return UNIT_SUCCESS;
}
/*
* Test nvgpu_set_enabled():
*
* 1. Set given flag, check that flag is enabled
* 2. Reset given flag, check that flag is disabled
*
* Flag status is checked using nvgpu_is_enabled() function. This function is
* verified in previous test.
*/
static int test_nvgpu_set_enabled(struct unit_module *m,
int test_nvgpu_set_enabled(struct unit_module *m,
struct gk20a *g, void *args)
{
u32 i;
@@ -134,13 +108,7 @@ static int test_nvgpu_set_enabled(struct unit_module *m,
return UNIT_SUCCESS;
}
/*
* Test nvgpu_free_enabled_flags(): Free memory allocated in init test.
*
* Note: Not many alternatives to verify that memory is actually freed as
* pages are cached and accessible until replaced.
*/
static int test_nvgpu_free_enabled_flags(struct unit_module *m,
int test_nvgpu_free_enabled_flags(struct unit_module *m,
struct gk20a *g, void *args)
{
nvgpu_free_enabled_flags(g);