[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v9 09/10] tests: Add test code for hbitmap seria
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v9 09/10] tests: Add test code for hbitmap serialization |
Date: |
Wed, 5 Oct 2016 18:31:11 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 05.10.2016 00:52, John Snow wrote:
> From: Fam Zheng <address@hidden>
>
> Signed-off-by: Fam Zheng <address@hidden>
> [Fixed minor constant issue. --js]
> Signed-off-by: John Snow <address@hidden>
>
> Signed-off-by: John Snow <address@hidden>
> ---
> tests/test-hbitmap.c | 155
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 155 insertions(+)
>
> diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
> index e3abde1..4fc5612 100644
> --- a/tests/test-hbitmap.c
> +++ b/tests/test-hbitmap.c
[...]
> +static void test_hbitmap_serialize_zeroes(TestHBitmapData *data,
> + const void *unused)
> +{
> + int i;
> + HBitmapIter iter;
> + int64_t next;
> + uint64_t positions[] = { 0, L1, L2, L3 - L1};
> + int num_positions = sizeof(positions) / sizeof(positions[0]);
> +
> + hbitmap_test_init(data, L3, 0);
> +
> + for (i = 0; i < num_positions; i++) {
> + hbitmap_set(data->hb, positions[i], L1);
> + }
> +
> + for (i = 0; i < num_positions; i++) {
> + hbitmap_deserialize_zeroes(data->hb, positions[i], L1, true);
This tries to deserialize L1 (= BITS_PER_LONG) bits; this is bad on 32
bit hosts, because the serialization granularity is (at least) 64 bits,
and the hbitmap code really doesn't like start or end positions (and
therefore also lengths) which aren't aligned to the granularity.
(Therefore, make check fails with -m32.)
Max
> + hbitmap_iter_init(&iter, data->hb, 0);
> + next = hbitmap_iter_next(&iter);
> + if (i == num_positions - 1) {
> + g_assert_cmpint(next, ==, -1);
> + } else {
> + g_assert_cmpint(next, ==, positions[i + 1]);
> + }
> + }
> +}
> +
> static void hbitmap_test_add(const char *testpath,
> void (*test_func)(TestHBitmapData *data,
> const void *user_data))
> {
> @@ -799,6 +945,15 @@ int main(int argc, char **argv)
> hbitmap_test_add("/hbitmap/meta/byte", test_hbitmap_meta_byte);
> hbitmap_test_add("/hbitmap/meta/word", test_hbitmap_meta_word);
> hbitmap_test_add("/hbitmap/meta/sector", test_hbitmap_meta_sector);
> +
> + hbitmap_test_add("/hbitmap/serialize/granularity",
> + test_hbitmap_serialize_granularity);
> + hbitmap_test_add("/hbitmap/serialize/basic",
> + test_hbitmap_serialize_basic);
> + hbitmap_test_add("/hbitmap/serialize/part",
> + test_hbitmap_serialize_part);
> + hbitmap_test_add("/hbitmap/serialize/zeroes",
> + test_hbitmap_serialize_zeroes);
> g_test_run();
>
> return 0;
>
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v9 03/10] tests: Add test code for meta bitmap, (continued)
- [Qemu-block] [PATCH v9 03/10] tests: Add test code for meta bitmap, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 02/10] HBitmap: Introduce "meta" bitmap to track bit changes, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 05/10] block: Add two dirty bitmap getters, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 01/10] block: Hide HBitmap in block dirty bitmap interface, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 08/10] block: BdrvDirtyBitmap serialization interface, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 04/10] block: Support meta dirty bitmap, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 06/10] block: Assert that bdrv_release_dirty_bitmap succeeded, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 10/10] block: More operations for meta dirty bitmap, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 07/10] hbitmap: serialization, John Snow, 2016/10/04
- [Qemu-block] [PATCH v9 09/10] tests: Add test code for hbitmap serialization, John Snow, 2016/10/04
- Re: [Qemu-block] [PATCH v9 09/10] tests: Add test code for hbitmap serialization,
Max Reitz <=