ISA and sysbus TPM-TIS devices will share their tests. Only
the main() will change (instantiation option is different).
Also the base address of the TPM-TIS device is going to be
different. on x86 it is located at 0xFED40000 while on ARM
it can be located at any location, discovered through the
device tree description.
So we put shared test functions in a new object module.
Each test needs to set tpm_tis_base_addr global variable.
Signed-off-by: Eric Auger <address@hidden>
---
tests/qtest/Makefile.include | 2 +-
tests/qtest/tpm-crb-swtpm-test.c | 3 +
tests/qtest/tpm-crb-test.c | 2 +
tests/qtest/tpm-tis-swtpm-test.c | 3 +
tests/qtest/tpm-tis-test.c | 414 +----------------------------
tests/qtest/tpm-tis-util.c | 433 +++++++++++++++++++++++++++++++
tests/qtest/tpm-tis-util.h | 23 ++
tests/qtest/tpm-util.c | 3 -
tests/qtest/tpm-util.h | 5 +
9 files changed, 473 insertions(+), 415 deletions(-)
create mode 100644 tests/qtest/tpm-tis-util.c
create mode 100644 tests/qtest/tpm-tis-util.h
diff --git a/tests/qtest/Makefile.include b/tests/qtest/Makefile.include
index 028af5b782..44aac68b25 100644
--- a/tests/qtest/Makefile.include
+++ b/tests/qtest/Makefile.include
@@ -302,7 +302,7 @@ tests/qtest/tpm-crb-swtpm-test$(EXESUF):
tests/qtest/tpm-crb-swtpm-test.o tests/
tests/qtest/tpm-crb-test$(EXESUF): tests/qtest/tpm-crb-test.o
tests/qtest/tpm-emu.o $(test-io-obj-y)
tests/qtest/tpm-tis-swtpm-test$(EXESUF): tests/qtest/tpm-tis-swtpm-test.o
tests/qtest/tpm-emu.o \
tests/qtest/tpm-util.o tests/qtest/tpm-tests.o $(test-io-obj-y)
-tests/qtest/tpm-tis-test$(EXESUF): tests/qtest/tpm-tis-test.o
tests/qtest/tpm-emu.o $(test-io-obj-y)
+tests/qtest/tpm-tis-test$(EXESUF): tests/qtest/tpm-tis-test.o
tests/qtest/tpm-tis-util.o tests/qtest/tpm-emu.o $(test-io-obj-y)
# QTest rules
diff --git a/tests/qtest/tpm-crb-swtpm-test.c b/tests/qtest/tpm-crb-swtpm-test.c
index 5228cb7af4..ac92f08bee 100644
--- a/tests/qtest/tpm-crb-swtpm-test.c
+++ b/tests/qtest/tpm-crb-swtpm-test.c
@@ -18,6 +18,9 @@
#include "libqtest.h"
#include "qemu/module.h"
#include "tpm-tests.h"
+#include "hw/acpi/tpm.h"
+
+uint64_t tpm_tis_base_addr = TPM_TIS_ADDR_BASE;
typedef struct TestState {
char *src_tpm_path;
diff --git a/tests/qtest/tpm-crb-test.c b/tests/qtest/tpm-crb-test.c
index 632fb7fbd8..cdd09e5396 100644
--- a/tests/qtest/tpm-crb-test.c
+++ b/tests/qtest/tpm-crb-test.c
@@ -19,6 +19,8 @@
#include "qemu/module.h"
#include "tpm-emu.h"
+uint64_t tpm_tis_base_addr = TPM_TIS_ADDR_BASE;
+