From nobody Mon Feb 9 09:17:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601898597; cv=none; d=zohomail.com; s=zohoarc; b=WUsQmbcD2pxqxBCxFZo9JQSE+aEO6Ye5maJZ6J8PT1i3Ix7DtVrq5KR7f0EZCKk5M2p78GDq3wzMDQol2pVYv1Dn9w19NGWx+Cu2dX7c5k8n5MK5KgdnEn544neaJUifoNeWl4MP1SDsryT0F8Z8PY9FP7U18kGIVOo4xmRJXQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601898597; h=Content-Type:Content-Transfer-Encoding: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; bh=MMYLjiySFENwUnIIZ3yNJ4AiRFGqtOo/HKMy3vfSueE=; b=UL7qugTLFxh0ncUf3eQjkA1sXwIH+JgHsw1PPHCOFUrzlpHCcTSX/nZ1l8rKH01ZLZ7vaex7GTh4EsEOXyUbBAR5+3GC4Ur5gmqCSm1ahWnbZzbN6qFciaB0zAdI+jUTI/q5S8KCjS2FcxpwaVm1k67wlkIPtlw+EfiU8CEyR6A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601898597494499.0111155865951; Mon, 5 Oct 2020 04:49:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-519-MW9NdRqkPCyehDY_2AxXcg-1; Mon, 05 Oct 2020 07:49:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E418D1019626; Mon, 5 Oct 2020 11:49:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C31F655767; Mon, 5 Oct 2020 11:49:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 92FED44A5E; Mon, 5 Oct 2020 11:49:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095BneTa028049 for ; Mon, 5 Oct 2020 07:49:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3ADCA19C4F; Mon, 5 Oct 2020 11:49:40 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 976F42635E for ; Mon, 5 Oct 2020 11:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601898596; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MMYLjiySFENwUnIIZ3yNJ4AiRFGqtOo/HKMy3vfSueE=; b=CLiD2MCk3xUpubK8Sj+Xj1b0f7bRpVvJD/RTaFDGyKGOk/UzCoL+LHZfZhC74880EIq6Iz 08qR26zaFdc7ERIrB3aPr5eG8Js7VR1eCRumIAaLuKS0jiXz8k/OYec6NGBi5ZOmft/85k w3B03tRADG0v1wsl9vf2MVPm6Vn6DQE= X-MC-Unique: MW9NdRqkPCyehDY_2AxXcg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/7] virbitmaptest: Split up test4 Date: Mon, 5 Oct 2020 13:49:24 +0200 Message-Id: <1c94ce57d22501f2796065f1a98f5bbeb62736d0.1601898456.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 'test4' was testing three distinct operations on separate instances of a bitmap. Split it up into 'test4a', 'test4b' and 'test4c' so that the 'bitmap' variable is not reused. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virbitmaptest.c | 64 +++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 32187ebec4..98ac06c406 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -173,23 +173,9 @@ test3(const void *data G_GNUC_UNUSED) /* test for virBitmapNextSetBit, virBitmapLastSetBit, virBitmapNextClearBi= t */ static int -test4(const void *data G_GNUC_UNUSED) +test4a(const void *data G_GNUC_UNUSED) { - const char *bitsString =3D "0, 2-4, 6-10, 12, 14-18, 20, 22, 25"; - int size =3D 40; - int bitsPos[] =3D { - 0, 2, 3, 4, 6, 7, 8, 9, 10, 12, - 14, 15, 16, 17, 18, 20, 22, 25 - }; - int bitsPosInv[] =3D { - 1, 5, 11, 13, 19, 21, 23, 24, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 - }; virBitmapPtr bitmap =3D NULL; - ssize_t i, j; - - if (G_N_ELEMENTS(bitsPos) + G_N_ELEMENTS(bitsPosInv) !=3D size) - goto error; /* 0. empty set */ @@ -205,7 +191,20 @@ test4(const void *data G_GNUC_UNUSED) goto error; virBitmapFree(bitmap); - bitmap =3D NULL; + return 0; + + error: + virBitmapFree(bitmap); + return -1; +} + + +static int +test4b(const void *data G_GNUC_UNUSED) +{ + virBitmapPtr bitmap =3D NULL; + int size =3D 40; + size_t i; /* 1. zero set */ @@ -230,7 +229,32 @@ test4(const void *data G_GNUC_UNUSED) goto error; virBitmapFree(bitmap); - bitmap =3D NULL; + return 0; + + error: + virBitmapFree(bitmap); + return -1; +} + + +static int +test4c(const void *data G_GNUC_UNUSED) +{ + const char *bitsString =3D "0, 2-4, 6-10, 12, 14-18, 20, 22, 25"; + int size =3D 40; + int bitsPos[] =3D { + 0, 2, 3, 4, 6, 7, 8, 9, 10, 12, + 14, 15, 16, 17, 18, 20, 22, 25 + }; + int bitsPosInv[] =3D { + 1, 5, 11, 13, 19, 21, 23, 24, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 + }; + virBitmapPtr bitmap =3D NULL; + ssize_t i, j; + + if (G_N_ELEMENTS(bitsPos) + G_N_ELEMENTS(bitsPosInv) !=3D size) + goto error; /* 2. partial set */ @@ -818,7 +842,11 @@ mymain(void) ret =3D -1; if (virTestRun("test3", test3, NULL) < 0) ret =3D -1; - if (virTestRun("test4", test4, NULL) < 0) + if (virTestRun("test4a", test4a, NULL) < 0) + ret =3D -1; + if (virTestRun("test4b", test4b, NULL) < 0) + ret =3D -1; + if (virTestRun("test4c", test4c, NULL) < 0) ret =3D -1; if (virTestRun("test5", test5, NULL) < 0) ret =3D -1; --=20 2.26.2