From f42bc7ef373d8e255de428d2c3bac2755f28e3b1 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 15 May 2013 16:26:57 +0200 Subject: [PATCH] tests: fix incorrect counter - not initialized to 0 in 2 tests, - within inner loop in 3rd test, thus always 0. Signed-off-by: Mathieu Desnoyers --- tests/test_urcu_lfs.c | 3 +-- tests/test_urcu_wfcq.c | 2 +- tests/test_urcu_wfs.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index 67ccaa2..9636f5b 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -274,6 +274,7 @@ void do_test_pop_all(enum test_sync sync) static void *thr_dequeuer(void *_count) { unsigned long long *count = _count; + unsigned int counter = 0; printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "dequeuer", (unsigned long) pthread_self(), @@ -291,8 +292,6 @@ static void *thr_dequeuer(void *_count) assert(test_pop || test_pop_all); for (;;) { - unsigned int counter = 0; - if (test_pop && test_pop_all) { /* both pop and pop all */ if (counter & 1) diff --git a/tests/test_urcu_wfcq.c b/tests/test_urcu_wfcq.c index cb1cc23..a3bd7e5 100644 --- a/tests/test_urcu_wfcq.c +++ b/tests/test_urcu_wfcq.c @@ -285,7 +285,7 @@ static void do_test_splice(enum test_sync sync) static void *thr_dequeuer(void *_count) { unsigned long long *count = _count; - unsigned int counter; + unsigned int counter = 0; printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "dequeuer", (unsigned long) pthread_self(), diff --git a/tests/test_urcu_wfs.c b/tests/test_urcu_wfs.c index a379fa3..043d842 100644 --- a/tests/test_urcu_wfs.c +++ b/tests/test_urcu_wfs.c @@ -270,7 +270,7 @@ static void do_test_pop_all(enum test_sync sync) static void *thr_dequeuer(void *_count) { unsigned long long *count = _count; - unsigned int counter; + unsigned int counter = 0; printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "dequeuer", (unsigned long) pthread_self(), -- 2.34.1