From nobody Sun Feb 8 17:03:51 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1491403485112549.4935356492906; Wed, 5 Apr 2017 07:44:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7AE9C04BD46; Wed, 5 Apr 2017 14:44:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C38AA406A; Wed, 5 Apr 2017 14:44:43 +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 3213C5EC67; Wed, 5 Apr 2017 14:44:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v35EbTva007325 for ; Wed, 5 Apr 2017 10:37:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 060689C975; Wed, 5 Apr 2017 14:37:29 +0000 (UTC) Received: from caroline.brq.redhat.com (dhcp129-198.brq.redhat.com [10.34.129.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E5F7784C8; Wed, 5 Apr 2017 14:37:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A7AE9C04BD46 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A7AE9C04BD46 From: Martin Kletzander To: libvir-list@redhat.com Date: Wed, 5 Apr 2017 16:36:34 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Erik=20=C5=A0kult=C3=A9ty?= Subject: [libvirt] [PATCH v2 11/12] tests: Add support for more complicated hierarchies in vircaps2xmltest 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 05 Apr 2017 14:44:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" More directories will need to be mocked, so let's prepare for that. Signed-off-by: Martin Kletzander --- tests/vircaps2xmltest.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c index 8f02314afe8e..31d027979cab 100644 --- a/tests/vircaps2xmltest.c +++ b/tests/vircaps2xmltest.c @@ -35,6 +35,7 @@ struct virCapabilitiesData { virArch arch; bool offlineMigrate; bool liveMigrate; + bool resctrl; /* Whether both resctrl and system sysfs are used */ }; static int @@ -48,8 +49,13 @@ test_virCapabilities(const void *opaque) char *dir =3D NULL; int ret =3D -1; - if (virAsprintf(&dir, "%s/vircaps2xmldata/linux-%s", - abs_srcdir, data->filename) < 0) + /* + * We want to keep our directory structure clean, so if there's both r= esctrl + * and system used, we need to use slightly different path; a subdir. + */ + if (virAsprintf(&dir, "%s/vircaps2xmldata/linux-%s%s", + abs_srcdir, data->filename, + data->resctrl ? "/system" : "") < 0) goto cleanup; virFileMockAddPrefix("/sys/devices/system", dir); @@ -89,19 +95,19 @@ mymain(void) { int ret =3D 0; -#define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate) \ +#define DO_TEST_FULL(filename, arch, offlineMigrate, liveMigrate, resctrl)= \ do { \ struct virCapabilitiesData data =3D {filename, arch, \ offlineMigrate, \ - liveMigrate}; \ + liveMigrate, resctrl}; \ if (virTestRun(filename, test_virCapabilities, &data) < 0) \ ret =3D -1; \ } while (0) -#define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true) +#define DO_TEST(filename, arch) DO_TEST_FULL(filename, arch, true, true, f= alse) - DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false); - DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false); + DO_TEST_FULL("basic", VIR_ARCH_X86_64, false, false, false); + DO_TEST_FULL("basic", VIR_ARCH_AARCH64, true, false, false); DO_TEST("caches", VIR_ARCH_X86_64); --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list