mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: line coverage for gk20a_runlist_wait_pending
Use fault injection to test nvgpu_timeout_init failure case in gk20a_runlist_wait_pending. Jira NVGPU-4673 Change-Id: I62810db0877339909d99f1de8d14847557ecb8fd Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2272458 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> GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
ae44d384f3
commit
2f29272d61
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <unit/unit.h>
|
||||
|
||||
#include <nvgpu/posix/io.h>
|
||||
#include <nvgpu/posix/posix-fault-injection.h>
|
||||
|
||||
#include <nvgpu/channel.h>
|
||||
#include <nvgpu/tsg.h>
|
||||
@@ -159,10 +160,17 @@ int test_gk20a_runlist_wait_pending(struct unit_module *m,
|
||||
u32 runlist_id = nvgpu_engine_get_gr_runlist_id(g);
|
||||
u32 timeout = g->poll_timeout_default;
|
||||
int err;
|
||||
struct nvgpu_posix_fault_inj *timer_fi =
|
||||
nvgpu_timers_get_fault_injection();
|
||||
|
||||
(void)nvgpu_posix_register_io(g, &test_reg_callbacks);
|
||||
|
||||
/* nvgpu_timeout_init failure not covered yet */
|
||||
/* nvgpu_timeout_init failure */
|
||||
nvgpu_posix_enable_fault_injection(timer_fi, true, 0);
|
||||
err = gk20a_runlist_wait_pending(g, runlist_id);
|
||||
assert(err == -ETIMEDOUT);
|
||||
nvgpu_posix_enable_fault_injection(timer_fi, false, 0);
|
||||
|
||||
g->poll_timeout_default = 10; /* ms */
|
||||
|
||||
ctx->m = m;
|
||||
|
||||
@@ -92,6 +92,7 @@ int test_gk20a_runlist_hw_submit(struct unit_module *m,
|
||||
* - Check case where polling times out:
|
||||
* - Set register to indicate that runlist is pending.
|
||||
* - Call gk20a_runlist_wait_pending.
|
||||
* - Check case where nvgpu_timeout_init fails, using fault injection.
|
||||
*
|
||||
* Output: Returns PASS if all branches gave expected results. FAIL otherwise.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user