gpu: nvgpu: update queue unit tests

Update queue unit tests for code coverage.

JIRA NVGPU-6904

Change-Id: I49ed6980f2d610cf8359c375a1236e8866ea6795
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2555333
(cherry picked from commit f2311f2710cab83b82ed7f5d51c54fa897051686)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2560216
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
ajesh
2021-07-07 16:11:29 +03:00
committed by mobile promotions
parent 3c70d56ddb
commit 7155ae865c
2 changed files with 61 additions and 1 deletions

View File

@@ -109,6 +109,11 @@ int test_nvgpu_queue_alloc_and_free(struct unit_module *m, struct gk20a *g,
* return 0 to indicate successful enqueue operation.
* - Enqueue message of length BUF_LEN again using nvgpu_queue_in() API. Check
* that the API returns error -ENOMEM.
* - Reset In and Out indexes and enqueue message of length BUF_LEN using
* nvgpu_queue_in_locked() API with lock parameter passed as NULL. This test
* is to increase the code coverage. Check that the API returns 0.
* - Enqueue message of length BUF_LEN again using nvgpu_queue_in_locked()
* API with lock parameter as NULL. Check that the API returns error -ENOMEM.
* - Free the allocated resources.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
@@ -139,15 +144,26 @@ int test_nvgpu_queue_in(struct unit_module *m, struct gk20a *g, void *args);
* - Dequeue message of length BUF_LEN from the empty queue calling
* nvgpu_queue_out_locked() API and check that the API returns -ENOMEM
* error.
* - Dequeue message of length BUF_LEN from the empty queue calling
* nvgpu_queue_out_locked() API with lock parameter passed as NULL and check
* that the API returns -ENOMEM error. This is for code coverage.
* - Set In index as BUF_LEN and dequeue message of length BUF_LEN by
* calling nvgpu_queue_out() API and check that the API returns 0.
* - Set In index as BUF_LEN and dequeue message of length BUF_LEN by
* calling nvgpu_queue_out_locked() API and check that the API returns 0.
* - Set In index as BUF_LEN and dequeue message of length BUF_LEN by
* calling nvgpu_queue_out_locked() API with lock parameter passed as NULL
* and check that the API returns 0. This is for code coverage.
* - Set In index as 0 and Out index as (UINT32_MAX - BUF_LEN). This
* indicates a condition were In index has wrapped around due to an enqueue
* operation. Use nvgpu_queue_out API to dequeue message of length BUF_LEN.
* The dequeue operation should successfully return 0.
* - Repeat the above step to test API nvgpu_queue_out_locked.
* - Set In index as (BUF_LEN/2 - 1) and Out index as (UINT32_MAX - BUF_LEN/2).
* This indicates a condition were In index has wrapped around due to an
* enqueue operation. Use nvgpu_queue_out_locked API to dequeue message of
* length BUF_LEN. This will cover the wrap around condition for Out index.
* The dequeue operation should successfully return 0.
* - Do fault injection so that immediate call to nvgpu_queue_out_locked() API
* would return error.
* - Invoke nvgpu_queue_out_locked() API and check that API returns -1 error.