aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/bios-tables-test.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2021-08-02 17:52:44 -0400
committerStefan Berger <stefanb@linux.ibm.com>2021-08-31 17:33:12 -0400
commit58edc32cfc796d56336a283aace5bdb5de25dc80 (patch)
treea776a408895a8fd1090becc37570e32d26217cdd /tests/qtest/bios-tables-test.c
parent343776a68528a132ff9068bb0731f584b38ff2ea (diff)
tests: Use QMP to check whether a TPM device model is available
Use QMP to check whether a given TPM device model is available and if it is not the case then do not register the tests that require it. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20210802215246.1433175-9-stefanb@linux.ibm.com
Diffstat (limited to 'tests/qtest/bios-tables-test.c')
-rw-r--r--tests/qtest/bios-tables-test.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 4ccbe56158..89bf55c838 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1094,7 +1094,6 @@ uint64_t tpm_tis_base_addr;
static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
uint64_t base, enum TPMVersion tpm_version)
{
-#ifdef CONFIG_TPM
gchar *tmp_dir_name = g_strdup_printf("qemu-test_acpi_%s_tcg_%s.XXXXXX",
machine, tpm_if);
char *tmp_path = g_dir_make_tmp(tmp_dir_name, NULL);
@@ -1140,9 +1139,6 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
g_free(tmp_dir_name);
g_free(args);
free_test_data(&data);
-#else
- g_test_skip("TPM disabled");
-#endif
}
static void test_acpi_q35_tcg_tpm_tis(void)
@@ -1518,7 +1514,9 @@ int main(int argc, char *argv[])
return ret;
}
qtest_add_func("acpi/q35/oem-fields", test_acpi_oem_fields_q35);
- qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
+ if (tpm_model_is_available("-machine q35", "tpm-tis")) {
+ qtest_add_func("acpi/q35/tpm2-tis", test_acpi_q35_tcg_tpm_tis);
+ }
qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
qtest_add_func("acpi/oem-fields", test_acpi_oem_fields_pc);
qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);