From nobody Sun Feb 8 22:35:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487850992911990.3608854279356; Thu, 23 Feb 2017 03:56:32 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NBrFrc013363; Thu, 23 Feb 2017 06:53:15 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NBrDFw031829 for ; Thu, 23 Feb 2017 06:53:13 -0500 Received: from dnr.brq.redhat.com (dhcp129-180.brq.redhat.com [10.34.129.180]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NBrBWY009079 for ; Thu, 23 Feb 2017 06:53:13 -0500 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 12:53:07 +0100 Message-Id: <922618d74c28696cc7eb0fa1647a63a1c3ab3c37.1487850710.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] Use macros for testing virSystemd APIs 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This hides the unused third parameter from every line and prepares for resetting the environment after each test case in the future. --- tests/virsystemdtest.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c index f0cfabf..177cccc 100644 --- a/tests/virsystemdtest.c +++ b/tests/virsystemdtest.c @@ -518,25 +518,21 @@ mymain(void) if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", uuid) < 0) return EXIT_FAILURE; =20 - if (virTestRun("Test create container ", testCreateContainer, NULL) < = 0) - ret =3D -1; - if (virTestRun("Test terminate container ", testTerminateContainer, NU= LL) < 0) - ret =3D -1; - if (virTestRun("Test create machine ", testCreateMachine, NULL) < 0) - ret =3D -1; - if (virTestRun("Test terminate machine ", testTerminateMachine, NULL) = < 0) - ret =3D -1; - if (virTestRun("Test create no systemd ", testCreateNoSystemd, NULL) <= 0) - ret =3D -1; - if (virTestRun("Test create systemd not running ", - testCreateSystemdNotRunning, NULL) < 0) - ret =3D -1; - if (virTestRun("Test create bad systemd ", testCreateBadSystemd, NULL)= < 0) - ret =3D -1; - if (virTestRun("Test create with network ", testCreateNetwork, NULL) <= 0) - ret =3D -1; - if (virTestRun("Test getting machine name ", testGetMachineName, NULL)= < 0) - ret =3D -1; +# define DO_TEST(_name, func) \ + do { \ + if (virTestRun(_name, func, NULL) < 0) \ + ret =3D -1; \ + } while (0) + + DO_TEST("Test create container ", testCreateContainer); + DO_TEST("Test terminate container ", testTerminateContainer); + DO_TEST("Test create machine ", testCreateMachine); + DO_TEST("Test terminate machine ", testTerminateMachine); + DO_TEST("Test create no systemd ", testCreateNoSystemd); + DO_TEST("Test create systemd not running ", testCreateSystemdNotRunnin= g); + DO_TEST("Test create bad systemd ", testCreateBadSystemd); + DO_TEST("Test create with network ", testCreateNetwork); + DO_TEST("Test getting machine name ", testGetMachineName); =20 # define TEST_SCOPE(_name, unitname, _legacy) \ do { \ --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list