From: Stefan Metzmacher Date: Wed, 18 Jul 2018 08:17:51 +0000 (+0200) Subject: pthreadpool: test pthreadpool_tevent_max_threads() returns the expected result X-Git-Tag: ldb-1.5.0~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=617d9c877df4af1ccc5b36f95dea3301e9a46d9d;p=thirdparty%2Fsamba.git pthreadpool: test pthreadpool_tevent_max_threads() returns the expected result Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/lib/pthreadpool/tests_cmocka.c b/lib/pthreadpool/tests_cmocka.c index 677800892f6..e2fb8439428 100644 --- a/lib/pthreadpool/tests_cmocka.c +++ b/lib/pthreadpool/tests_cmocka.c @@ -42,6 +42,7 @@ static int setup_pthreadpool_tevent(void **state) { struct pthreadpool_tevent_test *t; int ret; + size_t max_threads; t = talloc_zero(NULL, struct pthreadpool_tevent_test); assert_non_null(t); @@ -52,12 +53,21 @@ static int setup_pthreadpool_tevent(void **state) ret = pthreadpool_tevent_init(t->ev, UINT_MAX, &t->upool); assert_return_code(ret, 0); + max_threads = pthreadpool_tevent_max_threads(t->upool); + assert_int_equal(max_threads, UINT_MAX); + ret = pthreadpool_tevent_init(t->ev, 1, &t->opool); assert_return_code(ret, 0); + max_threads = pthreadpool_tevent_max_threads(t->opool); + assert_int_equal(max_threads, 1); + ret = pthreadpool_tevent_init(t->ev, 0, &t->spool); assert_return_code(ret, 0); + max_threads = pthreadpool_tevent_max_threads(t->spool); + assert_int_equal(max_threads, 0); + *state = t; return 0;