From nobody Thu Nov 13 22:12:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582751428; cv=none; d=zohomail.com; s=zohoarc; b=TQAeGN5Iw54wSqMEo0eWtUfpDUa059txreENjSvq24gUXZvT+mKH7XhUH2fGZu5/458apQYZQ5aPeoHx0/spCLMKW24+uN7TG0OdKwGsUIztZQQrQxfO7EGOV/CyYKW98eyZeAPmdRj3nzHBQjQyQ1X2XmLTdJlYnSi5AEdaKJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582751428; h=Content-Type:Content-Transfer-Encoding:Cc: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=xE5jsrMFKoz4Jm4BhG/H5KdS21jbi/S6sSPfBTDBqKc=; b=ZQmO67cTt8yTm0T97l4f7eCtuKufJQ8Le6ohm2bRM4CxvWlCeFvZd1D3foJRa2cMPpTwrJMYnVPPGOtc2aivgR/S2KtQE5Il2KYdOpHglHlN1CeeZIWqUD0ywepMRUxdymG3vQMEtye3uumJh5iMJBp0ugALWhY6Vvfz0CKVDDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582751428370925.061743798331; Wed, 26 Feb 2020 13:10:28 -0800 (PST) Received: from localhost ([::1]:50104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j73wp-0003mZ-6i for importer@patchew.org; Wed, 26 Feb 2020 16:10:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46250) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j73o4-000093-Mm for qemu-devel@nongnu.org; Wed, 26 Feb 2020 16:01:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j73o3-0004Jf-42 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 16:01:24 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23670 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j73o3-0004IJ-0K for qemu-devel@nongnu.org; Wed, 26 Feb 2020 16:01:23 -0500 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-38-qX6RrZdTOb-yypDEfvMlUg-1; Wed, 26 Feb 2020 16:01:19 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7FAE140B; Wed, 26 Feb 2020 21:01:17 +0000 (UTC) Received: from laptop.redhat.com (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CA8A4D9E2; Wed, 26 Feb 2020 21:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582750882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xE5jsrMFKoz4Jm4BhG/H5KdS21jbi/S6sSPfBTDBqKc=; b=h6YtbG3E0QyzCRNBFuDlQbDfj/es84l6jXm0KB7GGU+0WcbhvqeTZGaPW0o8CDG1Vr24W+ y5GfUCGS8GmP+XKyKooWZi46PWiO5rw8KIqzTRX2TvfgftEwXKqyKU+FkniW9g4Xx38RVt MmSpR9KzprIiAkGizjXyyfp1wSWCM1c= X-MC-Unique: qX6RrZdTOb-yypDEfvMlUg-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, stefanb@linux.ibm.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org Subject: [PATCH v4 08/10] test: tpm: pass optional machine options to swtpm test functions Date: Wed, 26 Feb 2020 21:59:40 +0100 Message-Id: <20200226205942.11424-9-eric.auger@redhat.com> In-Reply-To: <20200226205942.11424-1-eric.auger@redhat.com> References: <20200226205942.11424-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, lersek@redhat.com, ardb@kernel.org, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We plan to use swtpm test functions on ARM for testing the sysbus TPM-TIS device. However on ARM there is no default machine type. So we need to explictly pass some machine options on startup. Let's allow this by adding a new parameter to both swtpm test functions and update all call sites. Signed-off-by: Eric Auger Reviewed-by: Stefan Berger --- v3 -> v4: - added Stefan's R-b --- tests/qtest/tpm-crb-swtpm-test.c | 5 +++-- tests/qtest/tpm-tests.c | 10 ++++++---- tests/qtest/tpm-tests.h | 5 +++-- tests/qtest/tpm-tis-swtpm-test.c | 5 +++-- tests/qtest/tpm-util.c | 8 ++++++-- tests/qtest/tpm-util.h | 3 ++- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/qtest/tpm-crb-swtpm-test.c b/tests/qtest/tpm-crb-swtpm-t= est.c index 2c4fb8ae29..5228cb7af4 100644 --- a/tests/qtest/tpm-crb-swtpm-test.c +++ b/tests/qtest/tpm-crb-swtpm-test.c @@ -29,7 +29,8 @@ static void tpm_crb_swtpm_test(const void *data) { const TestState *ts =3D data; =20 - tpm_test_swtpm_test(ts->src_tpm_path, tpm_util_crb_transfer, "tpm-crb"= ); + tpm_test_swtpm_test(ts->src_tpm_path, tpm_util_crb_transfer, + "tpm-crb", NULL); } =20 static void tpm_crb_swtpm_migration_test(const void *data) @@ -37,7 +38,7 @@ static void tpm_crb_swtpm_migration_test(const void *data) const TestState *ts =3D data; =20 tpm_test_swtpm_migration_test(ts->src_tpm_path, ts->dst_tpm_path, ts->= uri, - tpm_util_crb_transfer, "tpm-crb"); + tpm_util_crb_transfer, "tpm-crb", NULL); } =20 int main(int argc, char **argv) diff --git a/tests/qtest/tpm-tests.c b/tests/qtest/tpm-tests.c index 6e45a0ba85..a2f2838e15 100644 --- a/tests/qtest/tpm-tests.c +++ b/tests/qtest/tpm-tests.c @@ -30,7 +30,7 @@ tpm_test_swtpm_skip(void) } =20 void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx, - const char *ifmodel) + const char *ifmodel, const char *machine_options) { char *args =3D NULL; QTestState *s; @@ -47,10 +47,11 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_f= unc *tx, g_assert_true(succ); =20 args =3D g_strdup_printf( + "%s " "-chardev socket,id=3Dchr,path=3D%s " "-tpmdev emulator,id=3Ddev,chardev=3Dchr " "-device %s,tpmdev=3Ddev", - addr->u.q_unix.path, ifmodel); + machine_options ? : "", addr->u.q_unix.path, ifmodel); =20 s =3D qtest_start(args); g_free(args); @@ -78,7 +79,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_fun= c *tx, void tpm_test_swtpm_migration_test(const char *src_tpm_path, const char *dst_tpm_path, const char *uri, tx_func *tx, - const char *ifmodel) + const char *ifmodel, + const char *machine_options) { gboolean succ; GPid src_tpm_pid, dst_tpm_pid; @@ -100,7 +102,7 @@ void tpm_test_swtpm_migration_test(const char *src_tpm_= path, =20 tpm_util_migration_start_qemu(&src_qemu, &dst_qemu, src_tpm_addr, dst_tpm_addr, uri, - ifmodel); + ifmodel, machine_options); =20 tpm_util_startup(src_qemu, tx); tpm_util_pcrextend(src_qemu, tx); diff --git a/tests/qtest/tpm-tests.h b/tests/qtest/tpm-tests.h index b97688fe75..a5df35ab5b 100644 --- a/tests/qtest/tpm-tests.h +++ b/tests/qtest/tpm-tests.h @@ -16,11 +16,12 @@ #include "tpm-util.h" =20 void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx, - const char *ifmodel); + const char *ifmodel, const char *machine_options); =20 void tpm_test_swtpm_migration_test(const char *src_tpm_path, const char *dst_tpm_path, const char *uri, tx_func *tx, - const char *ifmodel); + const char *ifmodel, + const char *machine_options); =20 #endif /* TESTS_TPM_TESTS_H */ diff --git a/tests/qtest/tpm-tis-swtpm-test.c b/tests/qtest/tpm-tis-swtpm-t= est.c index 9f58a3a92b..9470f15751 100644 --- a/tests/qtest/tpm-tis-swtpm-test.c +++ b/tests/qtest/tpm-tis-swtpm-test.c @@ -29,7 +29,8 @@ static void tpm_tis_swtpm_test(const void *data) { const TestState *ts =3D data; =20 - tpm_test_swtpm_test(ts->src_tpm_path, tpm_util_tis_transfer, "tpm-tis"= ); + tpm_test_swtpm_test(ts->src_tpm_path, tpm_util_tis_transfer, + "tpm-tis", NULL); } =20 static void tpm_tis_swtpm_migration_test(const void *data) @@ -37,7 +38,7 @@ static void tpm_tis_swtpm_migration_test(const void *data) const TestState *ts =3D data; =20 tpm_test_swtpm_migration_test(ts->src_tpm_path, ts->dst_tpm_path, ts->= uri, - tpm_util_tis_transfer, "tpm-tis"); + tpm_util_tis_transfer, "tpm-tis", NULL); } =20 int main(int argc, char **argv) diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c index e08b137651..7ecdae2fc6 100644 --- a/tests/qtest/tpm-util.c +++ b/tests/qtest/tpm-util.c @@ -258,23 +258,27 @@ void tpm_util_migration_start_qemu(QTestState **src_q= emu, SocketAddress *src_tpm_addr, SocketAddress *dst_tpm_addr, const char *miguri, - const char *ifmodel) + const char *ifmodel, + const char *machine_options) { char *src_qemu_args, *dst_qemu_args; =20 src_qemu_args =3D g_strdup_printf( + "%s " "-chardev socket,id=3Dchr,path=3D%s " "-tpmdev emulator,id=3Ddev,chardev=3Dchr " "-device %s,tpmdev=3Ddev ", - src_tpm_addr->u.q_unix.path, ifmodel); + machine_options ? : "", src_tpm_addr->u.q_unix.path, ifmodel); =20 *src_qemu =3D qtest_init(src_qemu_args); =20 dst_qemu_args =3D g_strdup_printf( + "%s " "-chardev socket,id=3Dchr,path=3D%s " "-tpmdev emulator,id=3Ddev,chardev=3Dchr " "-device %s,tpmdev=3Ddev " "-incoming %s", + machine_options ? : "", dst_tpm_addr->u.q_unix.path, ifmodel, miguri); =20 diff --git a/tests/qtest/tpm-util.h b/tests/qtest/tpm-util.h index 5755698ad2..15e3924942 100644 --- a/tests/qtest/tpm-util.h +++ b/tests/qtest/tpm-util.h @@ -44,7 +44,8 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu, SocketAddress *src_tpm_addr, SocketAddress *dst_tpm_addr, const char *miguri, - const char *ifmodel); + const char *ifmodel, + const char *machine_options); =20 void tpm_util_wait_for_migration_complete(QTestState *who); =20 --=20 2.20.1