diff mbox series

[v6,09/10] ACPI ERST: bios-tables-test testcase

Message ID 1628202639-16361-10-git-send-email-eric.devolder@oracle.com (mailing list archive)
State New, archived
Headers show
Series acpi: Error Record Serialization Table, ERST, support for QEMU | expand

Commit Message

Eric DeVolder Aug. 5, 2021, 10:30 p.m. UTC
This change implements the test suite checks for the ERST table.

Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
 tests/qtest/bios-tables-test.c | 43 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Igor Mammedov Sept. 21, 2021, 11:32 a.m. UTC | #1
On Thu,  5 Aug 2021 18:30:38 -0400
Eric DeVolder <eric.devolder@oracle.com> wrote:

> This change implements the test suite checks for the ERST table.
> 
> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
> ---
>  tests/qtest/bios-tables-test.c | 43 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index 51d3a4e..6ee78ec 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -1378,6 +1378,45 @@ static void test_acpi_piix4_tcg_acpi_hmat(void)
>      test_acpi_tcg_acpi_hmat(MACHINE_PC);
>  }
>  
> +static void test_acpi_erst(const char *machine)
> +{
> +    test_data data;
> +
> +    memset(&data, 0, sizeof(data));
> +    data.machine = machine;
> +    /*data.variant = ".acpierst";*/
> +    test_acpi_one(" -object memory-backend-file,id=erstnvram,"
> +                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on"
> +                    " -device acpi-erst,memdev=erstnvram",
> +                  &data);
> +    free_test_data(&data);
> +}
> +
> +static void test_acpi_piix4_erst(void)
> +{
> +    test_acpi_erst(MACHINE_PC);
> +}
> +
> +static void test_acpi_q35_erst(void)
> +{
> +    test_acpi_erst(MACHINE_Q35);
> +}
> +
> +static void test_acpi_microvm_erst(void)
> +{
> +    test_data data;
> +
> +    test_acpi_microvm_prepare(&data);
> +    data.variant = ".pcie";
> +    data.tcg_only = true; /* need constant host-phys-bits */
> +    test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=off,pcie=on "
> +                    "-object memory-backend-file,id=erstnvram,"
> +                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on "
                                 ^^^^
shouldn't the path be generated with g_dir_make_tmp() & co + corresponding cleanup

> +                    "-device acpi-erst,memdev=erstnvram",
> +                  &data);
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_virt_tcg(void)
>  {
>      test_data data = {
> @@ -1560,7 +1599,11 @@ int main(int argc, char *argv[])
>          qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>          if (strcmp(arch, "x86_64") == 0) {
>              qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
> +            qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_erst);
>          }
> +        qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_erst);
> +        qtest_add_func("acpi/q35/acpierst", test_acpi_q35_erst);
> +
>      } else if (strcmp(arch, "aarch64") == 0) {
>          qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>          qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
Eric DeVolder Oct. 4, 2021, 9:13 p.m. UTC | #2
On 9/21/21 6:32 AM, Igor Mammedov wrote:
> On Thu,  5 Aug 2021 18:30:38 -0400
> Eric DeVolder <eric.devolder@oracle.com> wrote:
> 
>> This change implements the test suite checks for the ERST table.
>>
>> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
>> ---
>>   tests/qtest/bios-tables-test.c | 43 ++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 43 insertions(+)
>>
>> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
>> index 51d3a4e..6ee78ec 100644
>> --- a/tests/qtest/bios-tables-test.c
>> +++ b/tests/qtest/bios-tables-test.c
>> @@ -1378,6 +1378,45 @@ static void test_acpi_piix4_tcg_acpi_hmat(void)
>>       test_acpi_tcg_acpi_hmat(MACHINE_PC);
>>   }
>>   
>> +static void test_acpi_erst(const char *machine)
>> +{
>> +    test_data data;
>> +
>> +    memset(&data, 0, sizeof(data));
>> +    data.machine = machine;
>> +    /*data.variant = ".acpierst";*/
>> +    test_acpi_one(" -object memory-backend-file,id=erstnvram,"
>> +                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on"
>> +                    " -device acpi-erst,memdev=erstnvram",
>> +                  &data);
>> +    free_test_data(&data);
>> +}
>> +
>> +static void test_acpi_piix4_erst(void)
>> +{
>> +    test_acpi_erst(MACHINE_PC);
>> +}
>> +
>> +static void test_acpi_q35_erst(void)
>> +{
>> +    test_acpi_erst(MACHINE_Q35);
>> +}
>> +
>> +static void test_acpi_microvm_erst(void)
>> +{
>> +    test_data data;
>> +
>> +    test_acpi_microvm_prepare(&data);
>> +    data.variant = ".pcie";
>> +    data.tcg_only = true; /* need constant host-phys-bits */
>> +    test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=off,pcie=on "
>> +                    "-object memory-backend-file,id=erstnvram,"
>> +                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on "
>                                   ^^^^
> shouldn't the path be generated with g_dir_make_tmp() & co + corresponding cleanup
done!

> 
>> +                    "-device acpi-erst,memdev=erstnvram",
>> +                  &data);
>> +    free_test_data(&data);
>> +}
>> +
>>   static void test_acpi_virt_tcg(void)
>>   {
>>       test_data data = {
>> @@ -1560,7 +1599,11 @@ int main(int argc, char *argv[])
>>           qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
>>           if (strcmp(arch, "x86_64") == 0) {
>>               qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
>> +            qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_erst);
>>           }
>> +        qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_erst);
>> +        qtest_add_func("acpi/q35/acpierst", test_acpi_q35_erst);
>> +
>>       } else if (strcmp(arch, "aarch64") == 0) {
>>           qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>>           qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
>
diff mbox series

Patch

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e..6ee78ec 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1378,6 +1378,45 @@  static void test_acpi_piix4_tcg_acpi_hmat(void)
     test_acpi_tcg_acpi_hmat(MACHINE_PC);
 }
 
+static void test_acpi_erst(const char *machine)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = machine;
+    /*data.variant = ".acpierst";*/
+    test_acpi_one(" -object memory-backend-file,id=erstnvram,"
+                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on"
+                    " -device acpi-erst,memdev=erstnvram",
+                  &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_piix4_erst(void)
+{
+    test_acpi_erst(MACHINE_PC);
+}
+
+static void test_acpi_q35_erst(void)
+{
+    test_acpi_erst(MACHINE_Q35);
+}
+
+static void test_acpi_microvm_erst(void)
+{
+    test_data data;
+
+    test_acpi_microvm_prepare(&data);
+    data.variant = ".pcie";
+    data.tcg_only = true; /* need constant host-phys-bits */
+    test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=off,pcie=on "
+                    "-object memory-backend-file,id=erstnvram,"
+                    "mem-path=tests/acpi-erst.XXXXXX,size=0x10000,share=on "
+                    "-device acpi-erst,memdev=erstnvram",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_virt_tcg(void)
 {
     test_data data = {
@@ -1560,7 +1599,11 @@  int main(int argc, char *argv[])
         qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm);
         if (strcmp(arch, "x86_64") == 0) {
             qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg);
+            qtest_add_func("acpi/microvm/acpierst", test_acpi_microvm_erst);
         }
+        qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_erst);
+        qtest_add_func("acpi/q35/acpierst", test_acpi_q35_erst);
+
     } else if (strcmp(arch, "aarch64") == 0) {
         qtest_add_func("acpi/virt", test_acpi_virt_tcg);
         qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);