diff --git a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export index 17d276552..9c7fb7833 100644 --- a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export +++ b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export @@ -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 diff --git a/userspace/units/posix/bug/posix-bug.c b/userspace/units/posix/bug/posix-bug.c index 457a03e62..f7598adb4 100644 --- a/userspace/units/posix/bug/posix-bug.c +++ b/userspace/units/posix/bug/posix-bug.c @@ -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); diff --git a/userspace/units/posix/bug/posix-bug.h b/userspace/units/posix/bug/posix-bug.h index 9d4fb69b9..a7bf47da1 100644 --- a/userspace/units/posix/bug/posix-bug.h +++ b/userspace/units/posix/bug/posix-bug.h @@ -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__ */