summaryrefslogtreecommitdiff
path: root/test/test
diff options
context:
space:
mode:
authorVivek Sharma <vivek.sharma@caviumnetworks.com>2018-09-25 09:53:06 +0000
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-08 17:51:24 +0200
commitbed70e5deb1bc927c5adb375d15c1d32c6c137d8 (patch)
treedb6cd4c849735903d39015f1cd75eec2096cd039 /test/test
parent662e382244fb29d8bf03113524a139541e10123f (diff)
downloaddpdk-bed70e5deb1bc927c5adb375d15c1d32c6c137d8.zip
dpdk-bed70e5deb1bc927c5adb375d15c1d32c6c137d8.tar.gz
dpdk-bed70e5deb1bc927c5adb375d15c1d32c6c137d8.tar.xz
eal: use correct data type for bitmap slab operations
Currently, slab operations use unsigned long data type for 64-bit slab related operations. On target 'i686-native-linuxapp-gcc', unsigned long is 32-bit and thus, slab operations breaks on this target. Changing slab operations to use unsigned long long for correct functioning on all targets. Fixes: de3cfa2c9823 ("sched: initial import") Fixes: 693f715da45c ("remove extra parentheses in return statement") Cc: stable@dpdk.org Signed-off-by: Vivek Sharma <vivek.sharma@caviumnetworks.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'test/test')
-rw-r--r--test/test/test_bitmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test/test_bitmap.c b/test/test/test_bitmap.c
index c3169e9..95c5184 100644
--- a/test/test/test_bitmap.c
+++ b/test/test/test_bitmap.c
@@ -101,6 +101,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);
@@ -124,6 +125,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;
}