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

@@ -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);