diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-02-26 09:17:37 +0100 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-02-26 09:21:27 +0100 |
commit | 597cb1874068054d4c0be41f161a72ef37888930 (patch) | |
tree | 8899c19634bd8e393a8eac05f33925e4d75bd77d /test/test/test_bitmap.c | |
parent | 6e7cbd63706f3435b9d9a2057a37db1da01db9a7 (diff) |
New upstream version 17.11.5upstream-17.11-stable
Change-Id: I8d2aa1aee2a9a78614dff5a01008f91e88e810c7
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'test/test/test_bitmap.c')
-rw-r--r-- | test/test/test_bitmap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c index 7045d332..e8c3a780 100644 --- a/test/test/test_bitmap.c +++ b/test/test/test_bitmap.c @@ -129,6 +129,7 @@ test_bitmap_slab_set_get(struct rte_bitmap *bmp) static int test_bitmap_set_get_clear(struct rte_bitmap *bmp) { + uint64_t val; int i; rte_bitmap_reset(bmp); @@ -152,6 +153,23 @@ test_bitmap_set_get_clear(struct rte_bitmap *bmp) } } + rte_bitmap_reset(bmp); + + /* Alternate slab set test */ + for (i = 0; i < MAX_BITS; i++) { + if (i % RTE_BITMAP_SLAB_BIT_SIZE) + rte_bitmap_set(bmp, i); + } + + for (i = 0; i < MAX_BITS; i++) { + val = rte_bitmap_get(bmp, i); + if (((i % RTE_BITMAP_SLAB_BIT_SIZE) && !val) || + (!(i % RTE_BITMAP_SLAB_BIT_SIZE) && val)) { + printf("Failed to get set bit.\n"); + return TEST_FAILED; + } + } + return TEST_SUCCESS; } |