mirror of https://github.com/xemu-project/xemu.git
test: Pass TPM interface model to functions creating command line
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>
This commit is contained in:
parent
2b4ccb87ec
commit
ea71a33691
|
@ -28,7 +28,7 @@ static void tpm_crb_swtpm_test(const void *data)
|
||||||
{
|
{
|
||||||
const TestState *ts = 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)
|
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;
|
const TestState *ts = data;
|
||||||
|
|
||||||
tpm_test_swtpm_migration_test(ts->src_tpm_path, ts->dst_tpm_path, ts->uri,
|
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)
|
int main(int argc, char **argv)
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
#include "libqtest.h"
|
#include "libqtest.h"
|
||||||
#include "tpm-tests.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;
|
char *args = NULL;
|
||||||
QTestState *s;
|
QTestState *s;
|
||||||
|
@ -36,8 +37,8 @@ void tpm_test_swtpm_test(const char *src_tpm_path, tx_func *tx)
|
||||||
args = g_strdup_printf(
|
args = g_strdup_printf(
|
||||||
"-chardev socket,id=chr,path=%s "
|
"-chardev socket,id=chr,path=%s "
|
||||||
"-tpmdev emulator,id=dev,chardev=chr "
|
"-tpmdev emulator,id=dev,chardev=chr "
|
||||||
"-device tpm-crb,tpmdev=dev",
|
"-device %s,tpmdev=dev",
|
||||||
addr->u.q_unix.path);
|
addr->u.q_unix.path, ifmodel);
|
||||||
|
|
||||||
s = qtest_start(args);
|
s = qtest_start(args);
|
||||||
g_free(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,
|
void tpm_test_swtpm_migration_test(const char *src_tpm_path,
|
||||||
const char *dst_tpm_path,
|
const char *dst_tpm_path,
|
||||||
const char *uri, tx_func *tx)
|
const char *uri, tx_func *tx,
|
||||||
|
const char *ifmodel)
|
||||||
{
|
{
|
||||||
gboolean succ;
|
gboolean succ;
|
||||||
GPid src_tpm_pid, dst_tpm_pid;
|
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,
|
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_startup(src_qemu, tx);
|
||||||
tpm_util_pcrextend(src_qemu, tx);
|
tpm_util_pcrextend(src_qemu, tx);
|
||||||
|
|
|
@ -15,10 +15,12 @@
|
||||||
|
|
||||||
#include "tpm-util.h"
|
#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,
|
void tpm_test_swtpm_migration_test(const char *src_tpm_path,
|
||||||
const char *dst_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 */
|
#endif /* TESTS_TPM_TESTS_H */
|
||||||
|
|
|
@ -248,25 +248,26 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
|
||||||
QTestState **dst_qemu,
|
QTestState **dst_qemu,
|
||||||
SocketAddress *src_tpm_addr,
|
SocketAddress *src_tpm_addr,
|
||||||
SocketAddress *dst_tpm_addr,
|
SocketAddress *dst_tpm_addr,
|
||||||
const char *miguri)
|
const char *miguri,
|
||||||
|
const char *ifmodel)
|
||||||
{
|
{
|
||||||
char *src_qemu_args, *dst_qemu_args;
|
char *src_qemu_args, *dst_qemu_args;
|
||||||
|
|
||||||
src_qemu_args = g_strdup_printf(
|
src_qemu_args = g_strdup_printf(
|
||||||
"-chardev socket,id=chr,path=%s "
|
"-chardev socket,id=chr,path=%s "
|
||||||
"-tpmdev emulator,id=dev,chardev=chr "
|
"-tpmdev emulator,id=dev,chardev=chr "
|
||||||
"-device tpm-crb,tpmdev=dev ",
|
"-device %s,tpmdev=dev ",
|
||||||
src_tpm_addr->u.q_unix.path);
|
src_tpm_addr->u.q_unix.path, ifmodel);
|
||||||
|
|
||||||
*src_qemu = qtest_init(src_qemu_args);
|
*src_qemu = qtest_init(src_qemu_args);
|
||||||
|
|
||||||
dst_qemu_args = g_strdup_printf(
|
dst_qemu_args = g_strdup_printf(
|
||||||
"-chardev socket,id=chr,path=%s "
|
"-chardev socket,id=chr,path=%s "
|
||||||
"-tpmdev emulator,id=dev,chardev=chr "
|
"-tpmdev emulator,id=dev,chardev=chr "
|
||||||
"-device tpm-crb,tpmdev=dev "
|
"-device %s,tpmdev=dev "
|
||||||
"-incoming %s",
|
"-incoming %s",
|
||||||
dst_tpm_addr->u.q_unix.path,
|
dst_tpm_addr->u.q_unix.path,
|
||||||
miguri);
|
ifmodel, miguri);
|
||||||
|
|
||||||
*dst_qemu = qtest_init(dst_qemu_args);
|
*dst_qemu = qtest_init(dst_qemu_args);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
|
||||||
QTestState **dst_qemu,
|
QTestState **dst_qemu,
|
||||||
SocketAddress *src_tpm_addr,
|
SocketAddress *src_tpm_addr,
|
||||||
SocketAddress *dst_tpm_addr,
|
SocketAddress *dst_tpm_addr,
|
||||||
const char *miguri);
|
const char *miguri,
|
||||||
|
const char *ifmodel);
|
||||||
|
|
||||||
void tpm_util_wait_for_migration_complete(QTestState *who);
|
void tpm_util_wait_for_migration_complete(QTestState *who);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue