gpu: nvgpu: unit: static_analysis: add test for safety_checks

Add test for nvgpu_safety_checks().

JIRA NVGPU-4825

Change-Id: I0d0b94c87b1e17f3087831b904740e14e26b6355
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279563
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2020-01-15 10:22:48 -05:00
committed by Alex Waterman
parent 2cf72837ec
commit 748f83af2f
2 changed files with 27 additions and 1 deletions

View File

@@ -266,9 +266,17 @@ int test_cast(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }
int test_safety_checks(struct unit_module *m, struct gk20a *g, void *args)
{
nvgpu_safety_checks();
return UNIT_SUCCESS;
}
struct unit_module_test static_analysis_tests[] = { struct unit_module_test static_analysis_tests[] = {
UNIT_TEST(arithmetic, test_arithmetic, NULL, 0), UNIT_TEST(arithmetic, test_arithmetic, NULL, 0),
UNIT_TEST(cast, test_cast, NULL, 0), UNIT_TEST(cast, test_cast, NULL, 0),
UNIT_TEST(safety_checks, test_safety_checks, NULL, 0),
}; };
UNIT_MODULE(static_analysis, static_analysis_tests, UNIT_PRIO_NVGPU_TEST); UNIT_MODULE(static_analysis, static_analysis_tests, UNIT_PRIO_NVGPU_TEST);

View File

@@ -84,8 +84,26 @@ int test_arithmetic(struct unit_module *m, struct gk20a *g, void *args);
*/ */
int test_cast(struct unit_module *m, struct gk20a *g, void *args); int test_cast(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_safety_checks
*
* Description: Verify functionality of static analysis safety_check() API.
*
* Test Type: Feature
*
* Targets: nvgpu_safety_checks
*
* Input: None
*
* Steps:
* - Call the API nvgpu_safety_checks(). No error should occur.
*
* Output: Returns PASS if expected result is met, FAIL otherwise.
*/
int test_safety_checks(struct unit_module *m, struct gk20a *g, void *args);
/** /**
* @} * @}
*/ */
#endif /* UNIT_WORKER_H */ #endif /* UNIT_STATIC_ANALYSIS_H */