[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_se
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_set |
Date: |
Tue, 20 Aug 2019 08:59:53 +0200 |
From: Wei Yang <address@hidden>
All current bitmap_set test cases set range across word, while the
handle of a range within one word is different from that.
Add case to set 1 bit as a represent for set range within one word.
Signed-off-by: Wei Yang <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/test-bitmap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c
index 18aa584..087e02a 100644
--- a/tests/test-bitmap.c
+++ b/tests/test-bitmap.c
@@ -67,6 +67,18 @@ static void bitmap_set_case(bmap_set_func set_func)
bmap = bitmap_new(BMAP_SIZE);
+ /* Set one bit at offset in second word */
+ for (offset = 0; offset <= BITS_PER_LONG; offset++) {
+ bitmap_clear(bmap, 0, BMAP_SIZE);
+ set_func(bmap, BITS_PER_LONG + offset, 1);
+ g_assert_cmpint(find_first_bit(bmap, 2 * BITS_PER_LONG),
+ ==, BITS_PER_LONG + offset);
+ g_assert_cmpint(find_next_zero_bit(bmap,
+ 3 * BITS_PER_LONG,
+ BITS_PER_LONG + offset),
+ ==, BITS_PER_LONG + offset + 1);
+ }
+
/* Both Aligned, set bits [BITS_PER_LONG, 3*BITS_PER_LONG] */
set_func(bmap, BITS_PER_LONG, 2 * BITS_PER_LONG);
g_assert_cmpuint(bmap[1], ==, -1ul);
--
1.8.3.1
- [Qemu-devel] [PULL 18/36] replay: Remove host_clock_last, (continued)
- [Qemu-devel] [PULL 18/36] replay: Remove host_clock_last, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 25/36] replay: refine replay-time module, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 29/36] cpus-common: nuke finish_safe_work, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 27/36] icount: clean up cpu_can_io at the entry to the block, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 36/36] x86: Intel AVX512_BF16 feature enabling, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 28/36] icount: remove unnecessary gen_io_end calls, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 26/36] replay: rename step-related variables and functions, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 32/36] HACKING: Document 'struct' keyword usage, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 23/36] util/qemu-timer: refactor deadline calculation for external timers, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 33/36] migration: do not rom_reset() during incoming migration, Paolo Bonzini, 2019/08/20
- [Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_set,
Paolo Bonzini <=
- [Qemu-devel] [PULL 35/36] scsi: lsi: exit infinite loop while executing script (CVE-2019-12068), Paolo Bonzini, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, no-reply, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, Peter Maydell, 2019/08/20
- Re: [Qemu-devel] [PULL 00/36] QEMU patches for 2018-08-20, no-reply, 2019/08/20