From 3f0a90813ac552e798be48297fa125e0fdc27ea8 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Fri, 12 Oct 2012 11:18:22 -0400 Subject: [PATCH] ck_ring: Unit test coverage for ck_ring_trydequeue. --- regressions/ck_ring/validate/ck_ring_spmc.c | 6 +++++- regressions/ck_ring/validate/ck_ring_spmc_template.c | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/regressions/ck_ring/validate/ck_ring_spmc.c b/regressions/ck_ring/validate/ck_ring_spmc.c index 6231745..78e6d7c 100644 --- a/regressions/ck_ring/validate/ck_ring_spmc.c +++ b/regressions/ck_ring/validate/ck_ring_spmc.c @@ -82,7 +82,11 @@ test_spmc(void *c) struct entry *o; /* Keep trying until we encounter at least one node. */ - while (ck_ring_dequeue_spmc(&ring_spmc, &o) == false); + if (j & 1) { + while (ck_ring_dequeue_spmc(&ring_spmc, &o) == false); + } else { + while (ck_ring_trydequeue_spmc(&ring_spmc, &o) == false); + } observed++; if (o->value < 0 diff --git a/regressions/ck_ring/validate/ck_ring_spmc_template.c b/regressions/ck_ring/validate/ck_ring_spmc_template.c index 83839bc..ad23e16 100644 --- a/regressions/ck_ring/validate/ck_ring_spmc_template.c +++ b/regressions/ck_ring/validate/ck_ring_spmc_template.c @@ -83,7 +83,13 @@ test_spmc(void *c) struct entry o; /* Keep trying until we encounter at least one node. */ - while (CK_RING_DEQUEUE_SPMC(spmc_ring, &ring_spmc, &o) == false); + if (j & 1) { + while (CK_RING_DEQUEUE_SPMC(spmc_ring, + &ring_spmc, &o) == false); + } else { + while (CK_RING_TRYDEQUEUE_SPMC(spmc_ring, + &ring_spmc, &o) == false); + } observed++; if (o.value < 0