diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-07-07 10:42:49 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-07-14 10:23:57 +0300 |
commit | 4c0cbd52d4400f2074956e91c260466082e24cba (patch) | |
tree | 654ebc0823ff182f5f598f11a3a9746e5a6d7085 /test | |
parent | 709291620e0a973687e3f4fedd02013db4140081 (diff) |
validation: thread: improve thread id and count tests
Improve test coverage of odp_thread_id(), odp_thread_count(),
odp_thread_count_max(), odp_cpu_id(), and ODP_THREAD_COUNT_MAX.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/api/thread/thread.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c index 7fe4a8c8f..f279dd16f 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread/thread.c @@ -1,4 +1,5 @@ /* Copyright (c) 2015-2018, Linaro Limited + * Copyright (c) 2022, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -81,20 +82,29 @@ static int thread_global_term(odp_instance_t inst) static void thread_test_odp_cpu_id(void) { - (void)odp_cpu_id(); - CU_PASS(); + CU_ASSERT(odp_cpu_id() >= 0); } static void thread_test_odp_thread_id(void) { - (void)odp_thread_id(); - CU_PASS(); + int id = odp_thread_id(); + + CU_ASSERT(id >= 0); + CU_ASSERT(id < odp_thread_count_max()); + CU_ASSERT(id < ODP_THREAD_COUNT_MAX); } static void thread_test_odp_thread_count(void) { - (void)odp_thread_count(); - CU_PASS(); + int count = odp_thread_count(); + + /* One thread running */ + CU_ASSERT(count == 1); + + CU_ASSERT(count >= 1); + CU_ASSERT(count <= odp_thread_count_max()); + CU_ASSERT(count <= ODP_THREAD_COUNT_MAX); + CU_ASSERT(odp_thread_count_max() <= ODP_THREAD_COUNT_MAX); } static int thread_func(void *arg ODP_UNUSED) |