summaryrefslogtreecommitdiff
path: root/lib/pthreadpool
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2018-07-18 10:17:51 +0200
committerRalph Boehme <slow@samba.org>2018-07-24 17:38:26 +0200
commit617d9c877df4af1ccc5b36f95dea3301e9a46d9d (patch)
treeb652e5260820875586f7d6d3e0695d8b88422afd /lib/pthreadpool
parent26b35cb20c604afa6db19912e3ff43978dbece61 (diff)
downloadsamba-617d9c877df4af1ccc5b36f95dea3301e9a46d9d.tar.gz
pthreadpool: test pthreadpool_tevent_max_threads() returns the expected result
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib/pthreadpool')
-rw-r--r--lib/pthreadpool/tests_cmocka.c10
1 files changed, 10 insertions, 0 deletions
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;