diff mbox series

bios-tables-test: Fix "-tpmdev: invalid option"

Message ID 20200615135051.2213-1-eric.auger@redhat.com
State New
Headers show
Series bios-tables-test: Fix "-tpmdev: invalid option" | expand

Commit Message

Eric Auger June 15, 2020, 1:50 p.m. UTC
When configure is run with "--disable-tpm", the bios-tables-test
q35/tis test fails with "-tpmdev: invalid option".

Skip the test if CONFIG_TPM is unset.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qtest/bios-tables-test.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stefan Berger June 15, 2020, 2:35 p.m. UTC | #1
On 6/15/20 9:50 AM, Eric Auger wrote:
> When configure is run with "--disable-tpm", the bios-tables-test
> q35/tis test fails with "-tpmdev: invalid option".
>
> Skip the test if CONFIG_TPM is unset.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>


Tested-by: Stefan Berger <stefanb@linux.ibm.com>


> ---
>   tests/qtest/bios-tables-test.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 53f104a9c5..b482f76c03 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -882,6 +882,7 @@ uint64_t tpm_tis_base_addr;
>   static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>                                 uint64_t base)
>   {
> +#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);
> @@ -924,6 +925,9 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>       g_free(tmp_path);
>       g_free(tmp_dir_name);
>       free_test_data(&data);
> +#else
> +    g_test_skip("TPM disabled");
> +#endif
>   }
>   
>   static void test_acpi_q35_tcg_tpm_tis(void)
Philippe Mathieu-Daudé June 15, 2020, 2:57 p.m. UTC | #2
On 6/15/20 3:50 PM, Eric Auger wrote:
> When configure is run with "--disable-tpm", the bios-tables-test
> q35/tis test fails with "-tpmdev: invalid option".
> 
> Skip the test if CONFIG_TPM is unset.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/qtest/bios-tables-test.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 53f104a9c5..b482f76c03 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -882,6 +882,7 @@ uint64_t tpm_tis_base_addr;
>  static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>                                uint64_t base)
>  {
> +#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);
> @@ -924,6 +925,9 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>      g_free(tmp_path);
>      g_free(tmp_dir_name);
>      free_test_data(&data);
> +#else
> +    g_test_skip("TPM disabled");
> +#endif
>  }
>  
>  static void test_acpi_q35_tcg_tpm_tis(void)
> 

This is simpler than Thomas' version.

Fixes: 5da7c35e25 ("bios-tables-test: Add Q35/TPM-TIS test")
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thomas Huth June 15, 2020, 4:19 p.m. UTC | #3
On 15/06/2020 16.57, Philippe Mathieu-Daudé wrote:
> On 6/15/20 3:50 PM, Eric Auger wrote:
>> When configure is run with "--disable-tpm", the bios-tables-test
>> q35/tis test fails with "-tpmdev: invalid option".
>>
>> Skip the test if CONFIG_TPM is unset.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  tests/qtest/bios-tables-test.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>> index 53f104a9c5..b482f76c03 100644
>> --- a/tests/qtest/bios-tables-test.c
>> +++ b/tests/qtest/bios-tables-test.c
>> @@ -882,6 +882,7 @@ uint64_t tpm_tis_base_addr;
>>  static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>>                                uint64_t base)
>>  {
>> +#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);
>> @@ -924,6 +925,9 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
>>      g_free(tmp_path);
>>      g_free(tmp_dir_name);
>>      free_test_data(&data);
>> +#else
>> +    g_test_skip("TPM disabled");
>> +#endif
>>  }
>>  
>>  static void test_acpi_q35_tcg_tpm_tis(void)
>>
> 
> This is simpler than Thomas' version.
> 
> Fixes: 5da7c35e25 ("bios-tables-test: Add Q35/TPM-TIS test")
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Your version is indeed nicer than mine, so let's use yours!

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 53f104a9c5..b482f76c03 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -882,6 +882,7 @@  uint64_t tpm_tis_base_addr;
 static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
                               uint64_t base)
 {
+#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);
@@ -924,6 +925,9 @@  static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
     g_free(tmp_path);
     g_free(tmp_dir_name);
     free_test_data(&data);
+#else
+    g_test_skip("TPM disabled");
+#endif
 }
 
 static void test_acpi_q35_tcg_tpm_tis(void)