gpu: nvgpu: Update unit test for posix queue unit

Update unit test for posix queue unit to cover a missing branch.
Also add posix queue SWUTS file path in "SWUTS.sources".

Jira NVGPU-4478

Change-Id: Ib32969bc358d76686a03708f120da7da113c9533
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2282988
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Petlozu Pravareshwar
2020-01-21 05:10:02 -08:00
committed by Alex Waterman
parent f46c3064ed
commit 61b14b226f
3 changed files with 24 additions and 11 deletions

View File

@@ -82,6 +82,7 @@ INPUT += ../../../userspace/units/sync/nvgpu-sync.h
INPUT += ../../../userspace/units/posix/bitops/posix-bitops.h
INPUT += ../../../userspace/units/posix/bug/posix-bug.h
INPUT += ../../../userspace/units/posix/cond/posix-cond.h
INPUT += ../../../userspace/units/posix/queue/posix-queue.h
INPUT += ../../../userspace/units/posix/fault-injection/posix-fault-injection.h
INPUT += ../../../userspace/units/posix/fault-injection/posix-fault-injection-kmem.h
INPUT += ../../../userspace/units/posix/fault-injection/posix-fault-injection-dma-alloc.h

View File

@@ -141,7 +141,7 @@ int test_nvgpu_queue_in(struct unit_module *m, struct gk20a *g, void *args)
}
/*
* Reset "in" and "out" indexes and enueue message of length BUF_LEN
* Reset "in" and "out" indexes and enqueue message of length BUF_LEN
* with the lock.
*/
q.in = 0;
@@ -153,7 +153,7 @@ int test_nvgpu_queue_in(struct unit_module *m, struct gk20a *g, void *args)
goto fail;
}
/* Enueue message of length BUF_LEN again and expect memory full */
/* Enqueue message of length BUF_LEN again and expect memory full */
ret = nvgpu_queue_in_locked(&q, buf, BUF_LEN, &lock);
if (ret != -ENOMEM) {
err = UNIT_FAIL;
@@ -161,6 +161,16 @@ int test_nvgpu_queue_in(struct unit_module *m, struct gk20a *g, void *args)
goto fail;
}
/* Enqueue message of length BUF_LEN again (without lock) and expect
* memory full.
*/
ret = nvgpu_queue_in(&q, buf, BUF_LEN);
if (ret != -ENOMEM) {
err = UNIT_FAIL;
unit_err(m, "%d. queue_in failed err=%d\n", __LINE__, ret);
goto fail;
}
fail:
if (q.data != NULL)
free(q.data);
@@ -203,7 +213,7 @@ int test_nvgpu_queue_out(struct unit_module *m, struct gk20a *g, void *args)
}
/*
* Advance "in" index by "BUF_LEN" and deueue message of length BUF_LEN.
* Advance "in" index by "BUF_LEN" and dequeue message of length BUF_LEN
*/
q.in = BUF_LEN;
q.out = 0;
@@ -215,7 +225,7 @@ int test_nvgpu_queue_out(struct unit_module *m, struct gk20a *g, void *args)
}
/*
* Advance "in" index by "BUF_LEN" and deueue message of length BUF_LEN
* Advance "in" index by "BUF_LEN" and dequeue message of length BUF_LEN
* with the lock.
*/
q.in = BUF_LEN;

View File

@@ -34,7 +34,7 @@
* Test specification for: test_nvgpu_queue_alloc_and_free
*
* Description: Functionalities of posix queue such as allocating and freeing
* of the message queue are are tested.
* of the message queue are tested.
*
* Test Type: Feature, Error guessing, Boundary values
*
@@ -93,11 +93,13 @@ int test_nvgpu_queue_alloc_and_free(struct unit_module *m, struct gk20a *g,
* - Update "in" and "out" indexes and enqueue message of length BUF_LEN such
* that we wrap around the Queue while enqueuing the message using
* nvgpu_queue_in() API. Check that the API returns "BUF_LEN".
* - Reset "in" and "out" indexes and enueue message of length "BUF_LEN" with
* - Reset "in" and "out" indexes and enqueue message of length "BUF_LEN" with
* the lock using nvgpu_queue_in_locked() API. Check that the API returns
* "BUF_LEN".
* - Enueue message of length "BUF_LEN" again using nvgpu_queue_in_locked() API.
* Check that the API returns error "-ENOMEM".
* - Enqueue message of length "BUF_LEN" again using nvgpu_queue_in_locked()
* API. Check that the API returns error "-ENOMEM".
* - Enqueue message of length "BUF_LEN" again using nvgpu_queue_in() API. Check
* that the API returns error "-ENOMEM".
* - Uninitialize the allocated resources.
*
* Output: Returns PASS if the steps above were executed successfully. FAIL
@@ -109,7 +111,7 @@ int test_nvgpu_queue_in(struct unit_module *m, struct gk20a *g, void *args);
* Test specification for: test_nvgpu_queue_out
*
* Description: Functionalities of posix queue such as allocating queue and
* dequeueing messages from the queue are tested.
* dequeuing messages from the queue are tested.
*
* Test Type: Feature, Error guessing, Boundary values
*
@@ -127,9 +129,9 @@ 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.
* - Advance "in" index by "BUF_LEN" and deueue message of length BUF_LEN by
* - Advance "in" index by "BUF_LEN" and dequeue message of length BUF_LEN by
* calling nvgpu_queue_out() API and check that the API returns "BUF_LEN".
* - Advance "in" index by "BUF_LEN" and deueue message of length BUF_LEN by
* - Advance "in" index by "BUF_LEN" and dequeue message of length BUF_LEN by
* calling nvgpu_queue_out_locked() API and check that the API returns
* "BUF_LEN".
* - Update "in" and "out" indexes and dequeue message of length BUF_LEN such