gpu: nvgpu: add BVEC tests for get_litter_value

All legitimate litter types are tested. Add invalid parameter
checks.

JIRA NVGPU-6390

Change-Id: Ie0e82b045f1cbfe101d1de022236c38b4b9c208e
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2549908
(cherry picked from commit 14b1f04d8744776a8efc78e57c16538cf062c7dd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2623627
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-06-25 15:51:30 +05:30
committed by mobile promotions
parent e083bd0df2
commit cce488d87e
2 changed files with 17 additions and 5 deletions

View File

@@ -113,6 +113,11 @@ int init_test_free_env(struct unit_module *m,
int test_get_litter_value(struct unit_module *m, int test_get_litter_value(struct unit_module *m,
struct gk20a *g, void *args) struct gk20a *g, void *args)
{ {
int invalid_litter_types[] = {
GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT + 1,
GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT + 2, INT_MAX};
u32 i;
assert(gv11b_get_litter_value(g, GPU_LIT_NUM_GPCS) == assert(gv11b_get_litter_value(g, GPU_LIT_NUM_GPCS) ==
proj_scal_litter_num_gpcs_v()); proj_scal_litter_num_gpcs_v());
assert(gv11b_get_litter_value(g, GPU_LIT_NUM_PES_PER_GPC) == assert(gv11b_get_litter_value(g, GPU_LIT_NUM_PES_PER_GPC) ==
@@ -202,10 +207,12 @@ int test_get_litter_value(struct unit_module *m,
2); 2);
#endif #endif
if (!EXPECT_BUG(gv11b_get_litter_value(g, U32_MAX))) { for (i = 0; i < ARRAY_SIZE(invalid_litter_types); i++) {
unit_err(m, "%s: failed to detect INVALID value\n", if (!EXPECT_BUG(gv11b_get_litter_value(g, invalid_litter_types[i]))) {
__func__); unit_err(m, "%s: failed to detect invalid value %d\n",
goto fail; __func__, invalid_litter_types[i]);
goto fail;
}
} }
return UNIT_SUCCESS; return UNIT_SUCCESS;

View File

@@ -74,12 +74,17 @@ int init_test_free_env(struct unit_module *m,
* *
* Description: Validate gv11b_get_litter_value() * Description: Validate gv11b_get_litter_value()
* *
* Test Type: Feature * Test Type: Feature, Boundary Value
* *
* Targets: gv11b_get_litter_value * Targets: gv11b_get_litter_value
* *
* Input: None * Input: None
* *
* Equivalence classes:
* Variable: value
* - Valid: {0 - 57}
* - Invalid: {58 - INT_MAX}
*
* Steps: * Steps:
* - Call gv11b_get_litter_value() with all valid values and verify correct * - Call gv11b_get_litter_value() with all valid values and verify correct
* return value. * return value.