gpu: nvgpu: add test for bug unit

Add a new test for warn message functionality as part of bug UT.

Jira NVGPU-4478

Change-Id: I2a250e4f6dc6946027e995ec3f340bb113c60f58
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2281019
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@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
2020-01-21 09:47:40 +05:30
committed by Alex Waterman
parent bfef02181a
commit 97718da708
3 changed files with 47 additions and 0 deletions

View File

@@ -616,6 +616,7 @@ nvgpu_pmu_early_init
nvgpu_pmu_remove_support
nvgpu_pmu_reset
nvgpu_posix_bug
nvgpu_posix_warn
nvgpu_posix_cleanup
nvgpu_posix_enable_fault_injection
nvgpu_posix_fault_injection_get_container

View File

@@ -138,9 +138,28 @@ int test_bug_cb(struct unit_module *m,
return UNIT_SUCCESS;
}
int test_warn_msg(struct unit_module *m,
struct gk20a *g, void *args)
{
bool ret;
ret = nvgpu_posix_warn(0, "");
if (ret != 0) {
unit_return_fail(m, "nvgpu_posix_warn failed for cond 0\n");
}
ret = nvgpu_posix_warn(1, "");
if (ret != 1) {
unit_return_fail(m, "nvgpu_posix_warn failed for cond 1\n");
}
return UNIT_SUCCESS;
}
struct unit_module_test posix_bug_tests[] = {
UNIT_TEST(expect_bug, test_expect_bug, NULL, 0),
UNIT_TEST(bug_cb, test_bug_cb, NULL, 0),
UNIT_TEST(warn_msg, test_warn_msg, NULL, 0),
};
UNIT_MODULE(posix_bug, posix_bug_tests, UNIT_PRIO_POSIX_TEST);

View File

@@ -86,4 +86,31 @@ int test_expect_bug(struct unit_module *m, struct gk20a *g, void *args);
*/
int test_bug_cb(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for test_warn_msg
*
* Description: Test the warn message functionality.
*
* Test Type: Feature
*
* Targets: nvgpu_posix_warn
*
* Inputs: None
*
* Steps:
* 1) Call nvgpu_posix_warn function with cond as 0.
* 2) Check the return value from function nvgpu_posix_warn. If it is not
* equal to 0, return FAIL.
* 3) Call nvgpu_posix_warn function with cond as 1.
* 4) Check the return value from function nvgpu_posix_warn. If it is not
* equal to 1, return FAIL.
* 5) Return PASS.
*
* Output:
* The test returns PASS if both the calls of nvgpu_posix_warn function returns
* the expected return value. Otherwise, the test returns FAIL.
*
*/
int test_warn_msg(struct unit_module *m, struct gk20a *g, void *args);
#endif /* __UNIT_POSIX_BUG_H__ */