mirror of https://gitee.com/openkylin/qemu.git
tests: add hbitmap iter test
Test that hbitmap iter is resistant to bitmap resetting. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 20170628120530.31251-5-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
f63ea4e92b
commit
eedc4b6d8d
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue