From nobody Sat Feb 7 06:49:39 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565999025; cv=none; d=zoho.com; s=zohoarc; b=I+pbR1oHHrk3yw4eJKoxd7MEMoSrZcl/FuUFojVWgoZFnq3t2SAAzQDVLI1NbVA15MxoYHR6pJHNnSvU8W36KIiUk3ZkjL5PsBmY7m7QI2bVs8hHgjwvtp0qIblNePF3Bkq0uyvmHCCnKYmH7BZ380pmuUTRs1IHLEVCRmpdV60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999025; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Cu669AmHlUNvR8MdzgU3aOQt2JKw7TQ2XRUdfYQVvnE=; b=Dej9b2Ch8+QrHD0s//Eck+a5hYv1lnPdSkRbzqpfduqroBzWH0h7Q9MgAabG7+B13V1VLPLIT26WTeHg3nhyAGocCZ5CSCce5JXjF0aErjgLouh2ive7svuXdyaNLmhekOO0b4v3TUb/6DppS8iX752tPYp8mTBZ0X6SHHuVcPY= 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 1565999025963614.468006443993; Fri, 16 Aug 2019 16:43:45 -0700 (PDT) Received: from localhost ([::1]:33474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylsm-0003MM-KD for importer@patchew.org; Fri, 16 Aug 2019 19:43:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47240) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hylQ4-00078l-Jx for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hylQ2-0006OP-OC for qemu-devel@nongnu.org; Fri, 16 Aug 2019 19:14:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hylPz-0006J4-5h; Fri, 16 Aug 2019 19:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6C57CA1FE; Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 311CB19C6A; Fri, 16 Aug 2019 23:13:55 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 16 Aug 2019 19:13:18 -0400 Message-Id: <20190816231318.8650-37-jsnow@redhat.com> In-Reply-To: <20190816231318.8650-1-jsnow@redhat.com> References: <20190816231318.8650-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 16 Aug 2019 23:13:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 36/36] 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: peter.maydell@linaro.org, Vladimir Sementsov-Ogievskiy , jsnow@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Test that hbitmap_next_zero and hbitmap_next_dirty_area can find things after old bitmap end. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-id: 20190805164652.42409-1-vsementsov@virtuozzo.com Tested-by: John Snow Reviewed-by: John Snow Signed-off-by: John Snow --- tests/test-hbitmap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c index 592d8219db2..eed5d288cbc 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.21.0