]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuxml2argvtest: Add negative cases for TPM version
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Aug 2022 08:23:42 +0000 (10:23 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Aug 2022 06:14:43 +0000 (08:14 +0200)
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@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
tests/qemuxml2argvdata/tpm-emulator-tpm2.x86_64-latest.err [new file with mode: 0644]
tests/qemuxml2argvdata/tpm-emulator.x86_64-latest.err [new file with mode: 0644]
tests/qemuxml2argvtest.c

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 (file)
index 0000000..8c16024
--- /dev/null
@@ -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 (file)
index 0000000..172343d
--- /dev/null
@@ -0,0 +1 @@
+unsupported configuration: TPM version '1.2' is not supported
index 05537d9e9671f82ba0788e1b5a5e57625bc93cf5..bebe4f08a39aac34aa482cd2c16e496cb0a4d0eb 100644 (file)
@@ -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");