MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_bitmap_scan_operations

Function test_bitmap_scan_operations

dpdk/app/test/test_bitmap.c:16–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#define MAX_BITS 1000
15
16static int
17test_bitmap_scan_operations(struct rte_bitmap *bmp)
18{
19 uint64_t slab1_magic = 0xBADC0FFEEBADF00D;
20 uint64_t slab2_magic = 0xFEEDDEADDEADF00D;
21 uint32_t pos = 0, start_pos;
22 int i, nb_clear, nb_set;
23 uint64_t out_slab = 0;
24
25 rte_bitmap_reset(bmp);
26
27 rte_bitmap_set_slab(bmp, pos, slab1_magic);
28 rte_bitmap_set_slab(bmp, pos + RTE_BITMAP_SLAB_BIT_SIZE, slab2_magic);
29
30 if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
31 printf("Failed to get slab from bitmap.\n");
32 return TEST_FAILED;
33 }
34
35 if (slab1_magic != out_slab) {
36 printf("Scan operation sanity failed.\n");
37 return TEST_FAILED;
38 }
39
40 if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
41 printf("Failed to get slab from bitmap.\n");
42 return TEST_FAILED;
43 }
44
45 if (slab2_magic != out_slab) {
46 printf("Scan operation sanity failed.\n");
47 return TEST_FAILED;
48 }
49
50 /* Wrap around */
51 if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
52 printf("Failed to get slab from bitmap.\n");
53 return TEST_FAILED;
54 }
55
56 if (slab1_magic != out_slab) {
57 printf("Scan operation wrap around failed.\n");
58 return TEST_FAILED;
59 }
60
61 /* Scan reset check. */
62 __rte_bitmap_scan_init(bmp);
63
64 if (!rte_bitmap_scan(bmp, &pos, &out_slab)) {
65 printf("Failed to get slab from bitmap.\n");
66 return TEST_FAILED;
67 }
68
69 if (slab1_magic != out_slab) {
70 printf("Scan reset operation failed.\n");
71 return TEST_FAILED;
72 }
73

Callers 1

test_bitmap_all_clearFunction · 0.85

Calls 8

rte_bitmap_resetFunction · 0.85
rte_bitmap_set_slabFunction · 0.85
rte_bitmap_scanFunction · 0.85
__rte_bitmap_scan_initFunction · 0.85
rte_bitmap_setFunction · 0.85
rte_bitmap_clearFunction · 0.85
rte_popcount64Function · 0.85
printfFunction · 0.50

Tested by

no test coverage detected