From nobody Fri Dec 19 18:47:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1592241058; cv=none; d=zohomail.com; s=zohoarc; b=khURq6PeQlGM1S53Zx0g1iNg7EMb4HPTs7/Iz8LSypZRn3kIoU/nuNm93ZD9OA5JSgk7Klo6jb9LlDMSl7AQxPptRab/Gd3rf1Ui7SNMbtXGW81W4wqflszZC/2Q/wn/APvmJ2xcb43xKngWhEIIY+OQvdFFt/fVYy6mPNkK8LI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592241058; 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=CYtmGtvjagsfSkt1GC2qPlQkRTOBY0nTjrEO/VEwcw4=; b=Cxs6rekPGHH4IseaUF79hWGJEEfZcz1trFGI2b4D7aBv4f5RkB+Ncyv0hpr54FjKO2bQ60WHdwMwbFx7gXKooDvSVMimEN9g9xc2TfPKnqV3qfDiaEV1EXMopgCea7jwtAnjWUY8YmlzsjHNRYAQYj92BfQ4/mrcTVhlDza4VWI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1592241058413920.6842692580866; Mon, 15 Jun 2020 10:10:58 -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-246-HUt5BuNTOTaarq6JVOzmAg-1; Mon, 15 Jun 2020 13:10:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B62C835BAA; Mon, 15 Jun 2020 17:10:46 +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 2CCD27F4F9; Mon, 15 Jun 2020 17:10:46 +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 F3848833D6; Mon, 15 Jun 2020 17:10:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05FHAiMs004788 for ; Mon, 15 Jun 2020 13:10:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E6E710246E1; Mon, 15 Jun 2020 17:10:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5B31024715 for ; Mon, 15 Jun 2020 17:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592241057; 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=CYtmGtvjagsfSkt1GC2qPlQkRTOBY0nTjrEO/VEwcw4=; b=JFDpbPbTzkaDCHS1o4TIQHZHq13B62NVCIIMuydiRM3TGZDQZRa4wlhhA/PsAJDp47at1O 7fb3MLdy5MPl3fIJxOat0FhLNrGhw2cCPD7+2lGCe3CT80CQySUg9s3Q0ZhQcLxBdYa317 ddyh7iIXy/wWVtIX8VV3CUXy86LSVbE= X-MC-Unique: HUt5BuNTOTaarq6JVOzmAg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/32] qemublocktest: Extract printing of nodename list Date: Mon, 15 Jun 2020 19:09:59 +0200 Message-Id: <416c56ac0ec775749fda904d995348ce18a7ee06.1592240635.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.11 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" There will be multiple places where we'll need to print nodenames from a GSList of virStorageSource for testing purposes. Extract the code into a function. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 28cbaeba38..0ed9b99bc4 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -647,6 +647,23 @@ testQemuDetectBitmaps(const void *opaque) } +static void +testQemuBitmapListPrint(const char *title, + GSList *next, + virBufferPtr buf) +{ + if (!next) + return; + + virBufferAsprintf(buf, "%s\n", title); + + for (; next; next =3D next->next) { + virStorageSourcePtr src =3D next->data; + virBufferAsprintf(buf, "%s\n", src->nodeformat); + } +} + + static virStorageSourcePtr testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx) { @@ -829,7 +846,6 @@ testQemuCheckpointDeleteMerge(const void *opaque) g_autoptr(virHashTable) nodedata =3D NULL; g_autoptr(GSList) reopenimages =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - GSList *tmp; expectpath =3D g_strdup_printf("%s/%s%s-out.json", abs_srcdir, checkpointDeletePrefix, data->name); @@ -858,14 +874,7 @@ testQemuCheckpointDeleteMerge(const void *opaque) virBufferAddLit(&buf, "NULL\n"); } - if (reopenimages) { - virBufferAddLit(&buf, "reopen nodes:\n"); - - for (tmp =3D reopenimages; tmp; tmp =3D tmp->next) { - virStorageSourcePtr src =3D tmp->data; - virBufferAsprintf(&buf, "%s\n", src->nodeformat); - } - } + testQemuBitmapListPrint("reopen nodes:", reopenimages, &buf); actual =3D virBufferContentAndReset(&buf); --=20 2.26.2