From nobody Mon Feb 9 03:46:33 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=1601624625; cv=none; d=zohomail.com; s=zohoarc; b=Ki15B+B2ozvjDCQvHzqqjj2TWYSAiPFG3MqMdrQCfRBkUakGLZdK43tDrQ0bu22C3/1G3/MNtzDBhQtTGhoxuqs2QZdcEAf4fO3QGSqOdOp0Brt9jgOPjejO84/52ThmhUcd+tpT10K+BZBTWuneYHD/xnz9VQIRQAZXHDbmyHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601624625; 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=zu4tHG3FeYiFxY5yiGkVtlpHhETZDFz3bxaIg3jLdFw=; b=MC8l88DjSTOlDUQDU53C2oahZkAFwmzmzZsOlhw76Civ4cgUU9qPkF6jIvQ9FNB0h1NE4bumEoMOwkq4RiwcG+1NuhRY3KDyQH6hz2UGT08kwKn1gtBGsRYJiSzpZsV/P/Nswv325bDmPz5chb1K3PB8/y4Yg6O7yCCXLj5U/NU= 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 1601624625181744.1394090927483; Fri, 2 Oct 2020 00:43:45 -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-225-VKgNYskBOR6CvAR7_qtVVw-1; Fri, 02 Oct 2020 03:43:42 -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 7AF6C803F57; Fri, 2 Oct 2020 07:43:36 +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 5B1F35578C; Fri, 2 Oct 2020 07:43:36 +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 F24F744A65; Fri, 2 Oct 2020 07:43:35 +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 0927hPQp004188 for ; Fri, 2 Oct 2020 03:43:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 07BC01972A; Fri, 2 Oct 2020 07:43:25 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59FFD1992F for ; Fri, 2 Oct 2020 07:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601624624; 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=zu4tHG3FeYiFxY5yiGkVtlpHhETZDFz3bxaIg3jLdFw=; b=Dan5xvU54DOVZFxbIvrjRYeXqPTzEcLz2bb2IdmXetY9zm/qaVUidC171YKVUVxozH0q3H /cxJZfe2/he/dbKiUzxjgQsU8bkx4mv16jiz2rWi8b/fwqLlfi+a+OjmpddK/n7sbDgLWd yTvRlztJNTLqZj4vbWoNNEoh4hFHb3U= X-MC-Unique: VKgNYskBOR6CvAR7_qtVVw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/15] virbitmaptest: Add few more cases for virBitmapToString Date: Fri, 2 Oct 2020 09:43:03 +0200 Message-Id: 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" Test an empty bitmap including it's extension via the self-expanding APIs and and a "0" and "" strings when converting the string back and forth. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virbitmaptest.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 56110971c9..c14a6c7e26 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -605,7 +605,7 @@ test12(const void *opaque G_GNUC_UNUSED) static int test13(const void *opaque G_GNUC_UNUSED) { - const char *strings[] =3D { "1234feebee", "000c0fefe" }; + const char *strings[] =3D { "1234feebee", "000c0fefe", "0", "" }; size_t i =3D 0; for (i =3D 0; i < G_N_ELEMENTS(strings); i++) { @@ -684,6 +684,36 @@ test15(const void *opaque) } +/* virBitmapNewEmpty + virBitmapToString */ +static int +test16(const void *opaque G_GNUC_UNUSED) +{ + g_autoptr(virBitmap) map =3D virBitmapNewEmpty(); + g_autofree char *res_empty =3D NULL; + g_autofree char *res_set =3D NULL; + + if (!(res_empty =3D virBitmapToString(map)) || + STRNEQ_NULLABLE(res_empty, "")) { + fprintf(stderr, "\n expected bitmap string '%s' actual string '%s'= \n", + "", NULLSTR(res_empty)); + return -1; + } + + if (virBitmapSetBitExpand(map, 2) < 0 || + virBitmapSetBitExpand(map, 11) < 0) + abort(); + + if (!(res_set =3D virBitmapToString(map)) || + STRNEQ_NULLABLE(res_set, "804")) { + fprintf(stderr, "\n expected bitmap string '%s' actual string '%s'= \n", + "804", NULLSTR(res_set)); + return -1; + } + + return 0; +} + + #define TESTBINARYOP(A, B, RES, FUNC) \ testBinaryOpData.a =3D A; \ testBinaryOpData.b =3D B; \ @@ -751,6 +781,9 @@ mymain(void) TESTBINARYOP("12345", "0,^0", "12345", test15); TESTBINARYOP("0,^0", "0,^0", "0,^0", test15); + if (virTestRun("test16", test16, NULL) < 0) + ret =3D -1; + return ret; } --=20 2.26.2