mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/tests: introduce unit tests for domain ID allocator
Introduce some basic infrastructure for doing domain ID allocation unit tests, and add a few tests that ensure correctness of the domain ID allocator. Use <xen-tools/bitops.h> and xen/lib/find-next-bit.c in test hardness code. Adjust find-next-bit.c to be compiled with __XEN_TOOLS__. Signed-off-by: Denis Mukhin <dmukhin@ford.com> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
1 parent
2d50650607
commit
b3d31533a0
7 files changed
+255
No files matched your search
@@ -12,6 +12,16 @@
|
||||
#define BITS_PER_LONG 32
|
||||
#endif
|
||||
|
||||
#define ffsl(x) __builtin_ffsl(x)
|
||||
|
||||
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
|
||||
|
||||
#define BITS_TO_LONGS(bits) \
|
||||
(((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
|
||||
|
||||
#define DECLARE_BITMAP(name, bits) \
|
||||
unsigned long name[BITS_TO_LONGS(bits)]
|
||||
|
||||
#define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
|
||||
#define BITMAP_SHIFT(_nr) ((_nr) % 8)
|
||||
|
||||
|
||||