From nobody Thu Nov 28 00:24:23 2024 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 1534252883555121.99084465875626; Tue, 14 Aug 2018 06:21:23 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 4AE7530832D1; Tue, 14 Aug 2018 13:21:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEF6C5D6B3; Tue, 14 Aug 2018 13:21:20 +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 92B9618037EF; Tue, 14 Aug 2018 13:21:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7EDLHIv032563 for ; Tue, 14 Aug 2018 09:21:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 914142142F21; Tue, 14 Aug 2018 13:21:17 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D6E72142F20; Tue, 14 Aug 2018 13:21:16 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 14 Aug 2018 15:21:08 +0200 Message-Id: <2efc7ef1a511a7f7e4d5dbc630169242bff40a82.1534252679.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/5] tests: qemuxml2argv: modernize TPM passthrough tests 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 14 Aug 2018 13:21:21 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All supported qemus support FD passing so modify the tests to test the proper code path. Signed-off-by: Peter Krempa --- tests/qemuxml2argvdata/tpm-passthrough-crb.args | 5 +++-- tests/qemuxml2argvdata/tpm-passthrough.args | 5 +++-- tests/qemuxml2argvmock.c | 16 ++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/qemuxml2argvdata/tpm-passthrough-crb.args b/tests/qemuxm= l2argvdata/tpm-passthrough-crb.args index 8c73bc6706..4da8be1a73 100644 --- a/tests/qemuxml2argvdata/tpm-passthrough-crb.args +++ b/tests/qemuxml2argvdata/tpm-passthrough-crb.args @@ -21,7 +21,8 @@ server,nowait \ -no-shutdown \ -boot menu=3Don \ -usb \ --tpmdev passthrough,id=3Dtpm-tpm0,path=3D/dev/tpm0,\ -cancel-path=3D/sys/class/misc/tpm0/device/cancel \ +-tpmdev passthrough,id=3Dtpm-tpm0,path=3D/dev/fdset/0,cancel-path=3D/dev/f= dset/1 \ +-add-fd set=3D0,fd=3D1730 \ +-add-fd set=3D1,fd=3D1731 \ -device tpm-crb,tpmdev=3Dtpm-tpm0,id=3Dtpm0 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/tpm-passthrough.args b/tests/qemuxml2ar= gvdata/tpm-passthrough.args index d4dd371f06..8ab7693009 100644 --- a/tests/qemuxml2argvdata/tpm-passthrough.args +++ b/tests/qemuxml2argvdata/tpm-passthrough.args @@ -21,7 +21,8 @@ server,nowait \ -no-shutdown \ -boot menu=3Don \ -usb \ --tpmdev passthrough,id=3Dtpm-tpm0,path=3D/dev/tpm0,\ -cancel-path=3D/sys/class/misc/tpm0/device/cancel \ +-tpmdev passthrough,id=3Dtpm-tpm0,path=3D/dev/fdset/0,cancel-path=3D/dev/f= dset/1 \ +-add-fd set=3D0,fd=3D1730 \ +-add-fd set=3D1,fd=3D1731 \ -device tpm-tis,tpmdev=3Dtpm-tpm0,id=3Dtpm0 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index c8a5f186d5..b9ba6c9648 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -225,3 +225,19 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceD= ef *dev ATTRIBUTE_UNUSED) abort(); return 1729; } + + +int +qemuBuildTPMOpenBackendFDs(const char *tpmdev ATTRIBUTE_UNUSED, + const char *cancel_path ATTRIBUTE_UNUSED, + int *tpmfd, + int *cancelfd) +{ + if (fcntl(1730, F_GETFD) !=3D -1 || + fcntl(1731, F_GETFD) !=3D -1) + abort(); + + *tpmfd =3D 1730; + *cancelfd =3D 1731; + return 0; +} diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8a7b82a1f2..5c01fba6f0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2061,8 +2061,10 @@ mymain(void) QEMU_CAPS_KVM); DO_TEST("tpm-passthrough", + QEMU_CAPS_ADD_FD, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS); DO_TEST("tpm-passthrough-crb", + QEMU_CAPS_ADD_FD, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB); DO_TEST_PARSE_ERROR("tpm-no-backend-invalid", QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE= _TPM_TIS); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list