gpu: nvgpu: unit: add negative coverage with tpc_count set to 0

Add negative testing coverage for below functions by setting tpc_count
to 0.

g->ops.gr.init.get_attrib_cb_size
g->ops.gr.init.get_alpha_cb_size

Jira NVGPU-4778

Change-Id: I105888b20bee2a991d35dc17f17854d22085a67a
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279899
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Deepak Nibade
2020-01-13 14:19:09 +05:30
committed by Alex Waterman
parent 340f35d76e
commit a0dede3a85
2 changed files with 15 additions and 0 deletions

View File

@@ -828,6 +828,14 @@ int test_gr_init_hal_error_injection(struct unit_module *m,
unit_return_fail(m, "expected size not set");
}
/*
* Trigger these HALs with tpc_count = 0, only for code coverage.
* We are not interested in return values since tpc_count cannot be
* 0 in any practical case.
*/
EXPECT_BUG(g->ops.gr.init.get_attrib_cb_size(g, 0));
EXPECT_BUG(g->ops.gr.init.get_alpha_cb_size(g, 0));
/* cleanup */
nvgpu_gr_ctx_free_patch_ctx(g, vm, gr_ctx);
nvgpu_free_gr_ctx_struct(g, gr_ctx);

View File

@@ -258,6 +258,10 @@ int test_gr_init_hal_config_error_injection(struct unit_module *m,
*
* Targets: gops_gr_init.commit_global_pagepool,
* gp10b_gr_init_commit_global_pagepool
* gops_gr_init.get_attrib_cb_size,
* gv11b_gr_init_get_attrib_cb_size,
* gops_gr_init.get_alpha_cb_size,
* gv11b_gr_init_get_alpha_cb_size
*
* Input: gr_init_setup, gr_init_prepare, gr_init_support must have
* been executed successfully.
@@ -268,6 +272,9 @@ int test_gr_init_hal_config_error_injection(struct unit_module *m,
* - Call g->ops.gr.init.commit_global_pagepool with global_ctx flag set
* to false and with arbitrary size.
* - Read back size from register and ensure correct size is set.
* - Call g->ops.gr.init.get_attrib_cb_size and g->ops.gr.init.get_alpha_cb_size
* with tpc_count = 0 for code coverage. Ensure that a BUG() is triggered.
* We are not interested in return value since tpc_count can never be 0.
* - Cleanup temporary resources.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL