gpu: nvgpu: add test for thread unit

Add test as part of Thread UT to increase the branch coverage.

Jira NVGPU-4478

Change-Id: I774e9677fde51d33505081d33193c93ef25617a9
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2291448
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
ajesh
2020-02-07 12:55:50 +05:30
committed by Alex Waterman
parent 2d7eb09ab4
commit 33c9379b8b
2 changed files with 33 additions and 7 deletions

View File

@@ -50,6 +50,10 @@ static int test_thread_fn(void *args)
}
}
if (data->use_return) {
return (data->use_return);
}
return 0;
}
@@ -76,6 +80,9 @@ int test_thread_cycle(struct unit_module *m, struct gk20a *g, void *args)
if (test_args->use_priority == false) {
if (test_args->use_name == true) {
if (test_args->ret_err == true) {
test_data.use_return = 1;
}
ret = nvgpu_thread_create(&test_thread, &test_data,
test_thread_fn,
"test_thread");
@@ -156,6 +163,7 @@ int test_thread_cycle(struct unit_module *m, struct gk20a *g, void *args)
struct unit_module_test posix_thread_tests[] = {
UNIT_TEST(create, test_thread_cycle, &create_normal, 0),
UNIT_TEST(create_noname, test_thread_cycle, &create_normal_noname, 0),
UNIT_TEST(create_noname_errret, test_thread_cycle, &create_normal_errret, 0),
UNIT_TEST(create_priority, test_thread_cycle, &create_priority, 0),
UNIT_TEST(create_priority_noname, test_thread_cycle, &create_priority_noname, 0),
UNIT_TEST(cycle, test_thread_cycle, &check_stop, 0),