From 50f3a943178d55743226cb365ee4fdaa5115ab7b Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 7 Jan 2020 14:02:43 -0500 Subject: [PATCH] gpu: nvgpu: unit: init: add coverage in quiesce This adds an additional test for where the cond init fails which was not previously covered. JIRA NVGPU-4818 Change-Id: I61f9808b3b438bacce6e41a7d1f84a3206837a8e Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2275222 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/init/nvgpu-init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/userspace/units/init/nvgpu-init.c b/userspace/units/init/nvgpu-init.c index 10c413c28..39671b606 100644 --- a/userspace/units/init/nvgpu-init.c +++ b/userspace/units/init/nvgpu-init.c @@ -708,6 +708,8 @@ int test_quiesce(struct unit_module *m, struct gk20a *g, void *args) int ret = UNIT_SUCCESS; struct nvgpu_posix_fault_inj *thread_fi = nvgpu_thread_get_fault_injection(); + struct nvgpu_posix_fault_inj *cond_fi = + nvgpu_cond_get_fault_injection(); int err; unsigned long *save_enabled_ptr; @@ -791,9 +793,18 @@ int test_quiesce(struct unit_module *m, struct gk20a *g, void *args) nvgpu_thread_join(&g->sw_quiesce_thread); nvgpu_set_power_state(g, NVGPU_STATE_POWERED_ON); - /* coverage for thread creation failing when creating thread */ + /* coverage for cond init failing */ nvgpu_sw_quiesce_remove_support(g); set_poweron_funcs_success(g); + nvgpu_posix_enable_fault_injection(cond_fi, true, 0); + err = nvgpu_finalize_poweron(g); + if (err == 0) { + unit_return_fail(m, "failed to detect cond init error\n"); + } + nvgpu_posix_enable_fault_injection(cond_fi, false, 0); + + /* coverage for thread creation failing when creating thread */ + /* Note: quiesce is disabled from cond test above */ nvgpu_posix_enable_fault_injection(thread_fi, true, 0); err = nvgpu_finalize_poweron(g); if (err == 0) {