regressions/ck_fifo: Add coverage for deinit routines.

ck_pring
Samy Al Bahra 11 years ago
parent 5ec8191ded
commit ca49839883

@ -117,6 +117,7 @@ main(int argc, char *argv[])
{ {
int i, r; int i, r;
struct context *context; struct context *context;
ck_fifo_mpmc_entry_t *garbage;
pthread_t *thread; pthread_t *thread;
if (argc != 4) { if (argc != 4) {
@ -139,6 +140,10 @@ main(int argc, char *argv[])
assert(thread); assert(thread);
ck_fifo_mpmc_init(&fifo, malloc(sizeof(ck_fifo_mpmc_entry_t))); 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++) { for (i = 0; i < nthr; i++) {
context[i].tid = i; context[i].tid = i;
r = pthread_create(thread + i, NULL, test, context + i); r = pthread_create(thread + i, NULL, test, context + i);

@ -144,6 +144,8 @@ main(int argc, char *argv[])
assert(thread); assert(thread);
for (i = 0; i < nthr; i++) { for (i = 0; i < nthr; i++) {
ck_fifo_spsc_entry_t *garbage;
context[i].tid = i; context[i].tid = i;
if (i == 0) { if (i == 0) {
context[i].previous = nthr - 1; context[i].previous = nthr - 1;
@ -156,6 +158,9 @@ main(int argc, char *argv[])
context[i].previous = i - 1; 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))); ck_fifo_spsc_init(fifo + i, malloc(sizeof(ck_fifo_spsc_entry_t)));
r = pthread_create(thread + i, NULL, test, context + i); r = pthread_create(thread + i, NULL, test, context + i);
assert(r == 0); assert(r == 0);
@ -166,3 +171,4 @@ main(int argc, char *argv[])
return (0); return (0);
} }

Loading…
Cancel
Save