diff --git a/userspace/units/posix/thread/posix-thread.c b/userspace/units/posix/thread/posix-thread.c index 8b4d35d72..c8af595a9 100644 --- a/userspace/units/posix/thread/posix-thread.c +++ b/userspace/units/posix/thread/posix-thread.c @@ -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), diff --git a/userspace/units/posix/thread/posix-thread.h b/userspace/units/posix/thread/posix-thread.h index 09b1ab507..53bda5d71 100644 --- a/userspace/units/posix/thread/posix-thread.h +++ b/userspace/units/posix/thread/posix-thread.h @@ -39,6 +39,7 @@ struct test_thread_args { bool stop_graceful; bool use_name; bool stop_repeat; + bool ret_err; }; static struct test_thread_args create_normal = { @@ -46,7 +47,8 @@ static struct test_thread_args create_normal = { .check_stop = false, .stop_graceful = false, .use_name = true, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false }; static struct test_thread_args create_normal_noname = { @@ -54,7 +56,17 @@ static struct test_thread_args create_normal_noname = { .check_stop = false, .stop_graceful = false, .use_name = false, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false +}; + +static struct test_thread_args create_normal_errret = { + .use_priority = false, + .check_stop = false, + .stop_graceful = false, + .use_name = true, + .stop_repeat = false, + .ret_err = true }; static struct test_thread_args create_priority = { @@ -62,7 +74,8 @@ static struct test_thread_args create_priority = { .check_stop = false, .stop_graceful = false, .use_name = true, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false }; static struct test_thread_args create_priority_noname = { @@ -70,7 +83,8 @@ static struct test_thread_args create_priority_noname = { .check_stop = false, .stop_graceful = false, .use_name = false, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false }; static struct test_thread_args check_stop = { @@ -78,7 +92,8 @@ static struct test_thread_args check_stop = { .check_stop = true, .stop_graceful = false, .use_name = true, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false }; static struct test_thread_args stop_graceful = { @@ -86,7 +101,8 @@ static struct test_thread_args stop_graceful = { .check_stop = true, .stop_graceful = true, .use_name = true, - .stop_repeat = false + .stop_repeat = false, + .ret_err = false }; static struct test_thread_args stop_graceful_repeat = { @@ -94,7 +110,8 @@ static struct test_thread_args stop_graceful_repeat = { .check_stop = true, .stop_graceful = true, .use_name = true, - .stop_repeat = true + .stop_repeat = true, + .ret_err = false }; struct unit_test_thread_data { @@ -103,6 +120,7 @@ struct unit_test_thread_data { int thread_priority; int check_stop; int callback_invoked; + int use_return; }; struct nvgpu_thread test_thread;