* Colin McCabe ([email protected]) wrote:
> [PATCH] userspace-rcu tests: zero array before using
> 
> It seems like we need the test arrays to start out zeroed.
> 
> Without this patch, I get errors like this when running the tests:
> test_urcu: test_urcu.c:201: test_array_alloc:
> Assertion `test_array[index].a == 0xDEADBEEF || test_array[index].a ==
> 0' failed.

You're right. Patch merged. Thanks!

Mathieu

> 
> Signed-off-by: Colin McCabe <[email protected]>
> ---
>  tests/test_qsbr.c        |    2 +-
>  tests/test_urcu.c        |    2 +-
>  tests/test_urcu_assign.c |    2 +-
>  tests/test_urcu_bp.c     |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/test_qsbr.c b/tests/test_qsbr.c
> index 1ef8c26..99da27c 100644
> --- a/tests/test_qsbr.c
> +++ b/tests/test_qsbr.c
> @@ -403,7 +403,7 @@ int main(int argc, char **argv)
>       printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
>                       "main", pthread_self(), (unsigned long)gettid());
> 
> -     test_array = malloc(sizeof(*test_array) * ARRAY_SIZE);
> +     test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
>       tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
>       tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
>       count_reader = malloc(sizeof(*count_reader) * nr_readers);
> diff --git a/tests/test_urcu.c b/tests/test_urcu.c
> index e6a6489..bbdb2d8 100644
> --- a/tests/test_urcu.c
> +++ b/tests/test_urcu.c
> @@ -400,7 +400,7 @@ int main(int argc, char **argv)
>       printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
>                       "main", pthread_self(), (unsigned long)gettid());
> 
> -     test_array = malloc(sizeof(*test_array) * ARRAY_SIZE);
> +     test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
>       tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
>       tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
>       count_reader = malloc(sizeof(*count_reader) * nr_readers);
> diff --git a/tests/test_urcu_assign.c b/tests/test_urcu_assign.c
> index 24a704b..a73fc23 100644
> --- a/tests/test_urcu_assign.c
> +++ b/tests/test_urcu_assign.c
> @@ -399,7 +399,7 @@ int main(int argc, char **argv)
>       printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
>                       "main", pthread_self(), (unsigned long)gettid());
> 
> -     test_array = malloc(sizeof(*test_array) * ARRAY_SIZE);
> +     test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
>       tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
>       tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
>       count_reader = malloc(sizeof(*count_reader) * nr_readers);
> diff --git a/tests/test_urcu_bp.c b/tests/test_urcu_bp.c
> index 7f20a6a..f475fa6 100644
> --- a/tests/test_urcu_bp.c
> +++ b/tests/test_urcu_bp.c
> @@ -396,7 +396,7 @@ int main(int argc, char **argv)
>       printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
>                       "main", pthread_self(), (unsigned long)gettid());
> 
> -     test_array = malloc(sizeof(*test_array) * ARRAY_SIZE);
> +     test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
>       tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
>       tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
>       count_reader = malloc(sizeof(*count_reader) * nr_readers);
> -- 
> 1.7.4.4

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to