From ca498398832a91e02f7e6274f8c70678f6baa2a8 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 1 Mar 2014 15:48:40 -0500 Subject: [PATCH] regressions/ck_fifo: Add coverage for deinit routines. --- regressions/ck_fifo/validate/ck_fifo_mpmc.c | 5 +++++ regressions/ck_fifo/validate/ck_fifo_spsc.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/regressions/ck_fifo/validate/ck_fifo_mpmc.c b/regressions/ck_fifo/validate/ck_fifo_mpmc.c index 2d7f237..dd1b996 100644 --- a/regressions/ck_fifo/validate/ck_fifo_mpmc.c +++ b/regressions/ck_fifo/validate/ck_fifo_mpmc.c @@ -117,6 +117,7 @@ main(int argc, char *argv[]) { int i, r; struct context *context; + ck_fifo_mpmc_entry_t *garbage; pthread_t *thread; if (argc != 4) { @@ -139,6 +140,10 @@ main(int argc, char *argv[]) assert(thread); ck_fifo_mpmc_init(&fifo, malloc(sizeof(ck_fifo_mpmc_entry_t))); + ck_fifo_mpmc_deinit(&fifo, &garbage); + free(garbage); + ck_fifo_mpmc_init(&fifo, malloc(sizeof(ck_fifo_mpmc_entry_t))); + for (i = 0; i < nthr; i++) { context[i].tid = i; r = pthread_create(thread + i, NULL, test, context + i); diff --git a/regressions/ck_fifo/validate/ck_fifo_spsc.c b/regressions/ck_fifo/validate/ck_fifo_spsc.c index 4eaba88..fcfc1fc 100644 --- a/regressions/ck_fifo/validate/ck_fifo_spsc.c +++ b/regressions/ck_fifo/validate/ck_fifo_spsc.c @@ -144,6 +144,8 @@ main(int argc, char *argv[]) assert(thread); for (i = 0; i < nthr; i++) { + ck_fifo_spsc_entry_t *garbage; + context[i].tid = i; if (i == 0) { context[i].previous = nthr - 1; @@ -156,6 +158,9 @@ main(int argc, char *argv[]) context[i].previous = i - 1; } + ck_fifo_spsc_init(fifo + i, malloc(sizeof(ck_fifo_spsc_entry_t))); + ck_fifo_spsc_deinit(fifo + i, &garbage); + free(garbage); ck_fifo_spsc_init(fifo + i, malloc(sizeof(ck_fifo_spsc_entry_t))); r = pthread_create(thread + i, NULL, test, context + i); assert(r == 0); @@ -166,3 +171,4 @@ main(int argc, char *argv[]) return (0); } +