aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest/bihash_test.c
diff options
context:
space:
mode:
authorJing Peng <pj.hades@gmail.com>2022-04-11 16:36:28 -0400
committerDamjan Marion <dmarion@me.com>2022-04-12 08:05:43 +0000
commit679c0de84e01aeb096efd1c6d27155587360a877 (patch)
treed6a8c7c6db852fd25aba5758ef2b6cb0741abb73 /src/plugins/unittest/bihash_test.c
parent98859a41a4bbf3277da1e368b566916f5e39c982 (diff)
tests: fix bihash unit test threads count
In test_bihash_threads, if a test thread fails to be created, it is still counted towards the total thread count, which could lead to never-ending test loop. This patch fixes the issue. Type: fix Signed-off-by: Jing Peng <pj.hades@gmail.com> Change-Id: Ic0f1d4dde9c5ea672b52f0e2e49f16d42f982b77
Diffstat (limited to 'src/plugins/unittest/bihash_test.c')
-rw-r--r--src/plugins/unittest/bihash_test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/unittest/bihash_test.c b/src/plugins/unittest/bihash_test.c
index f4ca3bb29b4..f0c6da2acc3 100644
--- a/src/plugins/unittest/bihash_test.c
+++ b/src/plugins/unittest/bihash_test.c
@@ -207,16 +207,16 @@ test_bihash_threads (bihash_test_main_t * tm)
tm->thread_barrier = 1;
/* Start the worker threads */
+ tm->threads_running = 0;
for (i = 0; i < tm->nthreads; i++)
{
rv = pthread_create (&handle, NULL, test_bihash_thread_fn,
(void *) (uword) i);
if (rv)
- {
- clib_unix_warning ("pthread_create returned %d", rv);
- }
+ clib_unix_warning ("pthread_create returned %d", rv);
+ else
+ tm->threads_running++;
}
- tm->threads_running = i;
tm->sequence_number = 0;
CLIB_MEMORY_BARRIER ();