From: Eric Auger <eric.auger@redhat.com>
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
Cc: marcandre.lureau@redhat.com, lersek@redhat.com, ardb@kernel.org,
philmd@redhat.com
Subject: [PATCH v3 08/10] test: tpm: pass optional machine options to swtpm test functions
Date: Wed, 26 Feb 2020 11:25:47 +0100 [thread overview]
Message-ID: <20200226102549.12158-9-eric.auger@redhat.com> (raw)
In-Reply-To: <20200226102549.12158-1-eric.auger@redhat.com>
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 <eric.auger@redhat.com>
---
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-test.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 = data;
- 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);
}
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 = data;
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);
}
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)
}
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 = NULL;
QTestState *s;
@@ -47,10 +47,11 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
g_assert_true(succ);
args = g_strdup_printf(
+ "%s "
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
"-device %s,tpmdev=dev",
- addr->u.q_unix.path, ifmodel);
+ machine_options ? : "", addr->u.q_unix.path, ifmodel);
s = qtest_start(args);
g_free(args);
@@ -78,7 +79,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *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,
tpm_util_migration_start_qemu(&src_qemu, &dst_qemu,
src_tpm_addr, dst_tpm_addr, uri,
- ifmodel);
+ ifmodel, machine_options);
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"
void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
- const char *ifmodel);
+ const char *ifmodel, const char *machine_options);
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);
#endif /* TESTS_TPM_TESTS_H */
diff --git a/tests/qtest/tpm-tis-swtpm-test.c b/tests/qtest/tpm-tis-swtpm-test.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 = data;
- 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);
}
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 = data;
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);
}
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_qemu,
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;
src_qemu_args = g_strdup_printf(
+ "%s "
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
"-device %s,tpmdev=dev ",
- src_tpm_addr->u.q_unix.path, ifmodel);
+ machine_options ? : "", src_tpm_addr->u.q_unix.path, ifmodel);
*src_qemu = qtest_init(src_qemu_args);
dst_qemu_args = g_strdup_printf(
+ "%s "
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
"-device %s,tpmdev=dev "
"-incoming %s",
+ machine_options ? : "",
dst_tpm_addr->u.q_unix.path,
ifmodel, miguri);
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);
void tpm_util_wait_for_migration_complete(QTestState *who);
--
2.20.1
next prev parent reply other threads:[~2020-02-26 10:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 10:25 [PATCH v3 00/10] vTPM for aarch64 Eric Auger
2020-02-26 10:25 ` [PATCH v3 01/10] tpm: rename TPM_TIS into TPM_TIS_ISA Eric Auger
2020-02-26 10:25 ` [PATCH v3 02/10] tpm: Use TPMState as a common struct Eric Auger
2020-02-26 10:25 ` [PATCH v3 03/10] tpm: Separate tpm_tis common functions from isa code Eric Auger
2020-02-26 10:25 ` [PATCH v3 04/10] tpm: Separate TPM_TIS and TPM_TIS_ISA configs Eric Auger
2020-02-26 10:25 ` [PATCH v3 05/10] tpm: Add the SysBus TPM TIS device Eric Auger
2020-02-26 10:25 ` [PATCH v3 06/10] hw/arm/virt: vTPM support Eric Auger
2020-02-26 13:19 ` Stefan Berger
2020-02-26 10:25 ` [PATCH v3 07/10] docs/specs/tpm: Document TPM_TIS sysbus device for ARM Eric Auger
2020-02-26 13:17 ` Stefan Berger
2020-02-26 10:25 ` Eric Auger [this message]
2020-02-26 12:28 ` [PATCH v3 08/10] test: tpm: pass optional machine options to swtpm test functions Stefan Berger
2020-02-26 10:25 ` [PATCH v3 09/10] test: tpm-tis: Get prepared to share tests between ISA and sysbus devices Eric Auger
2020-02-26 13:39 ` Stefan Berger
2020-02-26 10:25 ` [PATCH v3 10/10] test: tpm-tis: Add Sysbus TPM-TIS device test Eric Auger
2020-02-26 13:44 ` Stefan Berger
2020-02-26 13:32 ` [PATCH v3 00/10] vTPM for aarch64 Stefan Berger
2020-02-26 17:47 ` Auger Eric
2020-02-26 17:53 ` Stefan Berger
2020-02-26 18:18 ` Auger Eric
2020-02-26 20:01 ` Stefan Berger
2020-02-26 20:17 ` Auger Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200226102549.12158-9-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=ardb@kernel.org \
--cc=eric.auger.pro@gmail.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).