* [Qemu-devel] [PATCH] test-bitmap: test set 1 bit case for bitmap_set
@ 2019-08-14 0:27 Wei Yang
2019-08-14 12:38 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-08-14 0:27 UTC (permalink / raw)
To: qemu-devel; +Cc: quintela, corentincj, pl, peterx, kraxel, pbonzini, Wei Yang
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 <richardw.yang@linux.intel.com>
---
Thanks for Paolo's finding.
---
tests/test-bitmap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c
index 18aa584591..087e02a26c 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] test-bitmap: test set 1 bit case for bitmap_set
2019-08-14 0:27 [Qemu-devel] [PATCH] test-bitmap: test set 1 bit case for bitmap_set Wei Yang
@ 2019-08-14 12:38 ` Paolo Bonzini
2019-08-14 16:01 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2019-08-14 12:38 UTC (permalink / raw)
To: Wei Yang, qemu-devel; +Cc: corentincj, pl, kraxel, peterx, quintela
On 14/08/19 02:27, Wei Yang wrote:
> 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 <richardw.yang@linux.intel.com>
>
> ---
> Thanks for Paolo's finding.
>
> ---
> tests/test-bitmap.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c
> index 18aa584591..087e02a26c 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);
>
Queued, thanks for writing the testcase without no one asking! :)
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] test-bitmap: test set 1 bit case for bitmap_set
2019-08-14 12:38 ` Paolo Bonzini
@ 2019-08-14 16:01 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2019-08-14 16:01 UTC (permalink / raw)
To: Paolo Bonzini
Cc: quintela, corentincj, pl, qemu-devel, peterx, kraxel, Wei Yang
On Wed, Aug 14, 2019 at 02:38:24PM +0200, Paolo Bonzini wrote:
>On 14/08/19 02:27, Wei Yang wrote:
>> 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 <richardw.yang@linux.intel.com>
>>
>> ---
>> Thanks for Paolo's finding.
>>
>> ---
>> tests/test-bitmap.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c
>> index 18aa584591..087e02a26c 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);
>>
>
>Queued, thanks for writing the testcase without no one asking! :)
>
My pleasure to help :)
>Paolo
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-14 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 0:27 [Qemu-devel] [PATCH] test-bitmap: test set 1 bit case for bitmap_set Wei Yang
2019-08-14 12:38 ` Paolo Bonzini
2019-08-14 16:01 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).