From nobody Wed May 8 17:51:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1565023674; cv=none; d=zoho.com; s=zohoarc; b=a7poglE+N2mEh59BMEatXBRKgsYAIO099T50EyvE2OMi5TxIJtKIDghvrfHQxyrhwNXZZShUv+B7pLDf8R2I2Yh3GOGuD9arZQOjiC74FeDN8CXehePpKCNsUC0DoLmu11Yu3fQehMfYGRFx7xSydKejio7b/BnhJuBSQqSPqWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565023674; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=FiYuln7EGfG80InyNzSf2wfRN2j69+63PLzukztXyB4=; b=ecifeF6vXqwqnapB7GSUQGAwa4IKOGD14gMVi/ahv/enfCEJ47BqQ8ScSqzcS53CUk0J8eHLF/Wnt6bjTACh3JaAtXh2D7iYp7Z0f8IrJxS31j5qyn4hIAEZGKFm9uzCJaiMwEyLfMrVvqlvxPZNt0ZPZMpd9WTRkA98hUR30vM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1565023674062674.6189861078515; Mon, 5 Aug 2019 09:47:54 -0700 (PDT) Received: from localhost ([::1]:56052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hug9J-0000J4-5M for importer@patchew.org; Mon, 05 Aug 2019 12:47:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39428) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hug8R-0008F2-Ga for qemu-devel@nongnu.org; Mon, 05 Aug 2019 12:47:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hug8Q-0002vB-Fp for qemu-devel@nongnu.org; Mon, 05 Aug 2019 12:46:59 -0400 Received: from relay.sw.ru ([185.231.240.75]:34300) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hug8O-0002tb-8O; Mon, 05 Aug 2019 12:46:56 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1hug8L-0008WR-4G; Mon, 05 Aug 2019 19:46:53 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Date: Mon, 5 Aug 2019 19:46:52 +0300 Message-Id: <20190805164652.42409-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] tests/test-hbitmap: test next_zero and _next_dirty_area after truncate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Test that hbitmap_next_zero and hbitmap_next_dirty_area can find things after old bitmap end. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow Tested-by: John Snow --- It's a follow-up for=20 [PATCH for-4.1] util/hbitmap: update orig_size on truncate tests/test-hbitmap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index 592d8219db..eed5d288cb 100644 --- a/tests/test-hbitmap.c +++ b/tests/test-hbitmap.c @@ -1004,6 +1004,15 @@ static void test_hbitmap_next_zero_4(TestHBitmapData= *data, const void *unused) test_hbitmap_next_zero_do(data, 4); } =20 +static void test_hbitmap_next_zero_after_truncate(TestHBitmapData *data, + const void *unused) +{ + hbitmap_test_init(data, L1, 0); + hbitmap_test_truncate_impl(data, L1 * 2); + hbitmap_set(data->hb, 0, L1); + test_hbitmap_next_zero_check(data, 0); +} + static void test_hbitmap_next_dirty_area_check(TestHBitmapData *data, uint64_t offset, uint64_t count) @@ -1104,6 +1113,15 @@ static void test_hbitmap_next_dirty_area_4(TestHBitm= apData *data, test_hbitmap_next_dirty_area_do(data, 4); } =20 +static void test_hbitmap_next_dirty_area_after_truncate(TestHBitmapData *d= ata, + const void *unused) +{ + hbitmap_test_init(data, L1, 0); + hbitmap_test_truncate_impl(data, L1 * 2); + hbitmap_set(data->hb, L1 + 1, 1); + test_hbitmap_next_dirty_area_check(data, 0, UINT64_MAX); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -1169,6 +1187,8 @@ int main(int argc, char **argv) test_hbitmap_next_zero_0); hbitmap_test_add("/hbitmap/next_zero/next_zero_4", test_hbitmap_next_zero_4); + hbitmap_test_add("/hbitmap/next_zero/next_zero_after_truncate", + test_hbitmap_next_zero_after_truncate); =20 hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_0", test_hbitmap_next_dirty_area_0); @@ -1176,6 +1196,8 @@ int main(int argc, char **argv) test_hbitmap_next_dirty_area_1); hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_4", test_hbitmap_next_dirty_area_4); + hbitmap_test_add("/hbitmap/next_dirty_area/next_dirty_area_after_trunc= ate", + test_hbitmap_next_dirty_area_after_truncate); =20 g_test_run(); =20 --=20 2.18.0