From nobody Mon Feb 9 05:41:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551973493169405.4760742346558; Thu, 7 Mar 2019 07:44:53 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53575307EA96; Thu, 7 Mar 2019 15:44:51 +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 2A3FA1718A; Thu, 7 Mar 2019 15:44:51 +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 D4D3C3FA4A; Thu, 7 Mar 2019 15:44:50 +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 x27FijKE018647 for ; Thu, 7 Mar 2019 10:44:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 225FE19C69; Thu, 7 Mar 2019 15:44:45 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A7411973C for ; Thu, 7 Mar 2019 15:44:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 7 Mar 2019 16:44:33 +0100 Message-Id: <20190307154437.1405-5-abologna@redhat.com> In-Reply-To: <20190307154437.1405-1-abologna@redhat.com> References: <20190307154437.1405-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] tests: Use virAsprintf() to build titles 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 07 Mar 2019 15:44:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We're using static string concatenation at the moment, but that will no longer be a possibility in a bit. Signed-off-by: Andrea Bolognani --- tests/qemucapabilitiestest.c | 11 ++++++++--- tests/qemucaps2xmltest.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index e3c6681dd4..222ac05d79 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -196,12 +196,17 @@ mymain(void) =20 #define DO_TEST(arch, name) \ do { \ + VIR_AUTOFREE(char *) title =3D NULL; \ + VIR_AUTOFREE(char *) copyTitle =3D NULL; \ + if (virAsprintf(&title, "%s (%s)", name, arch) < 0 || \ + virAsprintf(©Title, "copy %s (%s)", name, arch) < 0) { \ + return -EXIT_FAILURE; \ + } \ data.archName =3D arch; \ data.base =3D name; \ - if (virTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \ + if (virTestRun(title, testQemuCaps, &data) < 0) \ data.ret =3D -1; \ - if (virTestRun("copy " name "(" arch ")", \ - testQemuCapsCopy, &data) < 0) \ + if (virTestRun(copyTitle, testQemuCapsCopy, &data) < 0) \ data.ret =3D -1; \ } while (0) =20 diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 46d2ce8b44..be460b42f8 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -197,10 +197,15 @@ mymain(void) return EXIT_FAILURE; =20 #define DO_TEST(arch, name) \ - data.archName =3D arch; \ - data.base =3D name; \ - if (virTestRun(name "(" arch ")", testQemuCapsXML, &data) < 0) \ - data.ret =3D -1 + do { \ + VIR_AUTOFREE(char *) title =3D NULL; \ + if (virAsprintf(&title, "%s (%s)", name, arch) < 0) \ + return -EXIT_FAILURE; \ + data.archName =3D arch; \ + data.base =3D name; \ + if (virTestRun(title, testQemuCapsXML, &data) < 0) \ + data.ret =3D -1; \ + } while (0) =20 /* Keep this in sync with qemucapabilitiestest */ DO_TEST("x86_64", "caps_1.5.3"); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list