From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL v1 3/4] test: Pass TPM interface model to functions creating command line
Date: Wed, 6 Jun 2018 15:58:04 -0400 [thread overview]
Message-ID: <20180606195805.185833-4-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180606195805.185833-1-stefanb@linux.vnet.ibm.com>
Pass the TPM interface model, such as 'tpm-crb', through to the functions
that create the command line for QEMU.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/tpm-crb-swtpm-test.c | 4 ++--
tests/tpm-tests.c | 13 ++++++++-----
tests/tpm-tests.h | 6 ++++--
tests/tpm-util.c | 11 ++++++-----
tests/tpm-util.h | 3 ++-
5 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/tests/tpm-crb-swtpm-test.c b/tests/tpm-crb-swtpm-test.c
index 4acffff568..8c0a55f3ca 100644
--- a/tests/tpm-crb-swtpm-test.c
+++ b/tests/tpm-crb-swtpm-test.c
@@ -28,7 +28,7 @@ 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_test_swtpm_test(ts->src_tpm_path, tpm_util_crb_transfer, "tpm-crb");
}
static void tpm_crb_swtpm_migration_test(const void *data)
@@ -36,7 +36,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_util_crb_transfer, "tpm-crb");
}
int main(int argc, char **argv)
diff --git a/tests/tpm-tests.c b/tests/tpm-tests.c
index adf2c618c8..10c6592aac 100644
--- a/tests/tpm-tests.c
+++ b/tests/tpm-tests.c
@@ -18,7 +18,8 @@
#include "libqtest.h"
#include "tpm-tests.h"
-void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx)
+void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
+ const char *ifmodel)
{
char *args = NULL;
QTestState *s;
@@ -36,8 +37,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx)
args = g_strdup_printf(
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
- "-device tpm-crb,tpmdev=dev",
- addr->u.q_unix.path);
+ "-device %s,tpmdev=dev",
+ addr->u.q_unix.path, ifmodel);
s = qtest_start(args);
g_free(args);
@@ -64,7 +65,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 *uri, tx_func *tx,
+ const char *ifmodel)
{
gboolean succ;
GPid src_tpm_pid, dst_tpm_pid;
@@ -87,7 +89,8 @@ 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);
+ src_tpm_addr, dst_tpm_addr, uri,
+ ifmodel);
tpm_util_startup(src_qemu, tx);
tpm_util_pcrextend(src_qemu, tx);
diff --git a/tests/tpm-tests.h b/tests/tpm-tests.h
index 377f184c77..b97688fe75 100644
--- a/tests/tpm-tests.h
+++ b/tests/tpm-tests.h
@@ -15,10 +15,12 @@
#include "tpm-util.h"
-void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx);
+void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx,
+ const char *ifmodel);
void tpm_test_swtpm_migration_test(const char *src_tpm_path,
const char *dst_tpm_path,
- const char *uri, tx_func *tx);
+ const char *uri, tx_func *tx,
+ const char *ifmodel);
#endif /* TESTS_TPM_TESTS_H */
diff --git a/tests/tpm-util.c b/tests/tpm-util.c
index e6e3b922fa..e1ac4d1bd5 100644
--- a/tests/tpm-util.c
+++ b/tests/tpm-util.c
@@ -248,25 +248,26 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
QTestState **dst_qemu,
SocketAddress *src_tpm_addr,
SocketAddress *dst_tpm_addr,
- const char *miguri)
+ const char *miguri,
+ const char *ifmodel)
{
char *src_qemu_args, *dst_qemu_args;
src_qemu_args = g_strdup_printf(
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
- "-device tpm-crb,tpmdev=dev ",
- src_tpm_addr->u.q_unix.path);
+ "-device %s,tpmdev=dev ",
+ src_tpm_addr->u.q_unix.path, ifmodel);
*src_qemu = qtest_init(src_qemu_args);
dst_qemu_args = g_strdup_printf(
"-chardev socket,id=chr,path=%s "
"-tpmdev emulator,id=dev,chardev=chr "
- "-device tpm-crb,tpmdev=dev "
+ "-device %s,tpmdev=dev "
"-incoming %s",
dst_tpm_addr->u.q_unix.path,
- miguri);
+ ifmodel, miguri);
*dst_qemu = qtest_init(dst_qemu_args);
diff --git a/tests/tpm-util.h b/tests/tpm-util.h
index b6253106d9..bb128360dd 100644
--- a/tests/tpm-util.h
+++ b/tests/tpm-util.h
@@ -39,7 +39,8 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
QTestState **dst_qemu,
SocketAddress *src_tpm_addr,
SocketAddress *dst_tpm_addr,
- const char *miguri);
+ const char *miguri,
+ const char *ifmodel);
void tpm_util_wait_for_migration_complete(QTestState *who);
--
2.14.4
next prev parent reply other threads:[~2018-06-06 19:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 19:58 [Qemu-devel] [PULL v1 0/4] Merge tpm 2018/06/06 Stefan Berger
2018-06-06 19:58 ` [Qemu-devel] [PULL v1 1/4] test: Move reusable code from tpm-crb-swtpm-test.c to tpm-util.c Stefan Berger
2018-06-06 19:58 ` [Qemu-devel] [PULL v1 2/4] test: Move common TPM test functions to tpm-tests.c Stefan Berger
2018-06-06 19:58 ` Stefan Berger [this message]
2018-06-06 19:58 ` [Qemu-devel] [PULL v1 4/4] test: Add swtpm migration test for the TPM TIS interface Stefan Berger
2018-06-07 10:24 ` [Qemu-devel] [PULL v1 0/4] Merge tpm 2018/06/06 Peter Maydell
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=20180606195805.185833-4-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).