Now that we have all the machinery needed, we can introduce two
simple test cases:
1) only TPM 1.2 is supported, but TPM 2.0 was requested in domain XML,
2) only TPM 2.0 is supported, but TPM 1.2 was requested in domain XML.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err | 1 +
tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err | 1 +
tests/qemuxml2argvtest.c | 6 ++++++
3 files changed, 8 insertions(+)
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err
diff --git a/tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err
b/tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err
new file mode 100644
index 0000000000..8c16024791
--- /dev/null
+++ b/tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: TPM version '2.0' is not supported
diff --git a/tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err
b/tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err
new file mode 100644
index 0000000000..172343d267
--- /dev/null
+++ b/tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: TPM version '1.2' is not supported
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 05537d9e96..bebe4f08a3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2564,6 +2564,12 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("aarch64-tpm", "aarch64");
DO_TEST_PARSE_ERROR_NOCAPS("aarch64-tpm-wrong-model");
+ g_setenv(TEST_TPM_ENV_VAR, TPM_VER_2_0, true);
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("tpm-emulator");
+ g_setenv(TEST_TPM_ENV_VAR, TPM_VER_1_2, true);
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("tpm-emulator-tpm2");
+ unsetenv(TEST_TPM_ENV_VAR);
+
DO_TEST_PARSE_ERROR_NOCAPS("pci-domain-invalid");
DO_TEST_PARSE_ERROR_NOCAPS("pci-bus-invalid");
DO_TEST_PARSE_ERROR_NOCAPS("pci-slot-invalid");
--
2.35.1