]> Git Repo - qemu.git/commitdiff
tests: add hbitmap iter test
authorVladimir Sementsov-Ogievskiy <[email protected]>
Wed, 28 Jun 2017 12:05:04 +0000 (15:05 +0300)
committerMax Reitz <[email protected]>
Tue, 11 Jul 2017 15:44:57 +0000 (17:44 +0200)
Test that hbitmap iter is resistant to bitmap resetting.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-id: 20170628120530[email protected]
Signed-off-by: Max Reitz <[email protected]>
tests/test-hbitmap.c

index 23773d2051fb042e3194ed6234b0b7a79d23ec98..1acb353889935cb37336bca1bfd6892d74a6f10d 100644 (file)
@@ -909,6 +909,22 @@ static void hbitmap_test_add(const char *testpath,
                hbitmap_test_teardown);
 }
 
+static void test_hbitmap_iter_and_reset(TestHBitmapData *data,
+                                        const void *unused)
+{
+    HBitmapIter hbi;
+
+    hbitmap_test_init(data, L1 * 2, 0);
+    hbitmap_set(data->hb, 0, data->size);
+
+    hbitmap_iter_init(&hbi, data->hb, BITS_PER_LONG - 1);
+
+    hbitmap_iter_next(&hbi);
+
+    hbitmap_reset_all(data->hb);
+    hbitmap_iter_next(&hbi);
+}
+
 int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
@@ -966,6 +982,9 @@ int main(int argc, char **argv)
                      test_hbitmap_serialize_part);
     hbitmap_test_add("/hbitmap/serialize/zeroes",
                      test_hbitmap_serialize_zeroes);
+
+    hbitmap_test_add("/hbitmap/iter/iter_and_reset",
+                     test_hbitmap_iter_and_reset);
     g_test_run();
 
     return 0;
This page took 0.025893 seconds and 4 git commands to generate.