From ab50f22309a17c772c51931940596e707c200739 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Tue, 21 May 2019 17:38:47 -0400 Subject: bios-tables-test: add diff allowed list Expected table change is then handled like this: 1. add table to diff allowed list 2. change generating code (can be combined with 1) 3. maintainer runs a script to update expected + blows away allowed diff list Signed-off-by: Michael S. Tsirkin --- tests/bios-tables-test-allowed-diff.h | 1 + tests/bios-tables-test.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/bios-tables-test-allowed-diff.h (limited to 'tests') diff --git a/tests/bios-tables-test-allowed-diff.h b/tests/bios-tables-test-allowed-diff.h new file mode 100644 index 0000000000..dfb8523c8b --- /dev/null +++ b/tests/bios-tables-test-allowed-diff.h @@ -0,0 +1 @@ +/* List of comma-separated changed AML files to ignore */ diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 11e07be093..28d7d427e0 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -342,6 +342,22 @@ try_again: return exp_tables; } +static bool test_acpi_find_diff_allowed(AcpiSdtTable *sdt) +{ + const gchar *allowed_diff_file[] = { +#include "bios-tables-test-allowed-diff.h" + NULL + }; + const gchar **f; + + for (f = allowed_diff_file; *f; ++f) { + if (!g_strcmp0(sdt->aml_file, *f)) { + return true; + } + } + return false; +} + /* test the list of tables in @data->tables against reference tables */ static void test_acpi_asl(test_data *data) { @@ -396,7 +412,8 @@ static void test_acpi_asl(test_data *data) "see ASL difference."); } } - } + } + g_assert(test_acpi_find_diff_allowed(exp_sdt)); } g_string_free(asl, true); g_string_free(exp_asl, true); -- cgit v1.2.3 From df7cafdeb68b6572fa81d2be9a1910547c4dfafc Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Sun, 2 Jun 2019 21:29:27 -0400 Subject: bios-tables-test: list all tables that differ Fail after comparing all tables: this way user gets the full list of tables that need to be updated or whitelisted. Signed-off-by: Michael S. Tsirkin --- tests/bios-tables-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 28d7d427e0..70895e1014 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -364,7 +364,7 @@ static void test_acpi_asl(test_data *data) int i; AcpiSdtTable *sdt, *exp_sdt; test_data exp_data; - gboolean exp_err, err; + gboolean exp_err, err, all_tables_match = true; memset(&exp_data, 0, sizeof(exp_data)); exp_data.tables = load_expected_aml(data); @@ -413,11 +413,13 @@ static void test_acpi_asl(test_data *data) } } } - g_assert(test_acpi_find_diff_allowed(exp_sdt)); + all_tables_match = all_tables_match && + test_acpi_find_diff_allowed(exp_sdt); } g_string_free(asl, true); g_string_free(exp_asl, true); } + g_assert(all_tables_match); free_test_data(&exp_data); } -- cgit v1.2.3 From 200dbf3789486554cda5f34fffb0bb7218ea6b49 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 3 Jun 2019 13:22:08 +0200 Subject: tests: add expected ACPI tables for arm/virt board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Igor Mammedov Tested-by: Philippe Mathieu-Daudé Message-Id: <1559560929-260254-2-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/virt/APIC | Bin 0 -> 168 bytes tests/data/acpi/virt/DSDT | Bin 0 -> 18476 bytes tests/data/acpi/virt/FACP | Bin 0 -> 268 bytes tests/data/acpi/virt/GTDT | Bin 0 -> 96 bytes tests/data/acpi/virt/MCFG | Bin 0 -> 60 bytes tests/data/acpi/virt/SPCR | Bin 0 -> 80 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/data/acpi/virt/APIC create mode 100644 tests/data/acpi/virt/DSDT create mode 100644 tests/data/acpi/virt/FACP create mode 100644 tests/data/acpi/virt/GTDT create mode 100644 tests/data/acpi/virt/MCFG create mode 100644 tests/data/acpi/virt/SPCR (limited to 'tests') diff --git a/tests/data/acpi/virt/APIC b/tests/data/acpi/virt/APIC new file mode 100644 index 0000000000..797dfde284 Binary files /dev/null and b/tests/data/acpi/virt/APIC differ diff --git a/tests/data/acpi/virt/DSDT b/tests/data/acpi/virt/DSDT new file mode 100644 index 0000000000..20e85c7f89 Binary files /dev/null and b/tests/data/acpi/virt/DSDT differ diff --git a/tests/data/acpi/virt/FACP b/tests/data/acpi/virt/FACP new file mode 100644 index 0000000000..27de99f51b Binary files /dev/null and b/tests/data/acpi/virt/FACP differ diff --git a/tests/data/acpi/virt/GTDT b/tests/data/acpi/virt/GTDT new file mode 100644 index 0000000000..10107a65e9 Binary files /dev/null and b/tests/data/acpi/virt/GTDT differ diff --git a/tests/data/acpi/virt/MCFG b/tests/data/acpi/virt/MCFG new file mode 100644 index 0000000000..e8987e1af0 Binary files /dev/null and b/tests/data/acpi/virt/MCFG differ diff --git a/tests/data/acpi/virt/SPCR b/tests/data/acpi/virt/SPCR new file mode 100644 index 0000000000..377271a0e7 Binary files /dev/null and b/tests/data/acpi/virt/SPCR differ -- cgit v1.2.3 From ab6b6a7777449905a70f7e80790719779e7f3313 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 3 Jun 2019 13:22:09 +0200 Subject: tests: acpi: add simple arm/virt testcase adds simple arm/virt test case that starts guest with bios-tables-test.aarch64.iso.qcow2 boot image which initializes UefiTestSupport* structure in RAM once guest is booted. * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper Signed-off-by: Igor Mammedov Message-Id: <1559560929-260254-3-git-send-email-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/Makefile.include | 4 ++++ tests/bios-tables-test.c | 18 ++++++++++++++++++ tests/data/acpi/rebuild-expected-aml.sh | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Makefile.include b/tests/Makefile.include index 1865f6b322..2334969f1f 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -267,6 +267,10 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF) check-qtest-aarch64-y = tests/numa-test$(EXESUF) check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF) check-qtest-aarch64-y += tests/migration-test$(EXESUF) +# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make test unconditional +ifneq ($(ARCH),arm) +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF) +endif check-qtest-microblazeel-y += $(check-qtest-microblaze-y) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 70895e1014..d80ea7f7f3 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -832,6 +832,22 @@ static void test_acpi_piix4_tcg_dimm_pxm(void) test_acpi_tcg_dimm_pxm(MACHINE_PC); } +static void test_acpi_virt_tcg(void) +{ + test_data data = { + .machine = "virt", + .accel = "tcg", + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", + .ram_start = 0x40000000ULL, + .scan_len = 128ULL * 1024 * 1024, + }; + + test_acpi_one("-cpu cortex-a57", &data); + free_test_data(&data); +} + int main(int argc, char *argv[]) { const char *arch = qtest_get_arch(); @@ -860,6 +876,8 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem); qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm); qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); + } else if (strcmp(arch, "aarch64") == 0) { + qtest_add_func("acpi/virt", test_acpi_virt_tcg); } ret = g_test_run(); boot_sector_cleanup(disk); diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh index ff7e62249d..d2853218dd 100755 --- a/tests/data/acpi/rebuild-expected-aml.sh +++ b/tests/data/acpi/rebuild-expected-aml.sh @@ -12,7 +12,7 @@ # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. -qemu_bins="x86_64-softmmu/qemu-system-x86_64" +qemu_bins="x86_64-softmmu/qemu-system-x86_64 aarch64-softmmu/qemu-system-aarch64" if [ ! -e "tests/bios-tables-test" ]; then echo "Test: bios-tables-test is required! Run make check before this script." -- cgit v1.2.3 From 7f36f0930ffec11a551844c0452dbce33f80a525 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Tue, 4 Jun 2019 23:41:32 -0400 Subject: bios-tables-test: ignore identical binaries when binary of the tables is identical, there is no need to run iasl to check that they are functionally equivalent. Signed-off-by: Michael S. Tsirkin --- tests/bios-tables-test.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index d80ea7f7f3..0ce55182f2 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -375,6 +375,20 @@ static void test_acpi_asl(test_data *data) sdt = &g_array_index(data->tables, AcpiSdtTable, i); exp_sdt = &g_array_index(exp_data.tables, AcpiSdtTable, i); + if (sdt->aml_len == exp_sdt->aml_len && + !memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) { + /* Identical table binaries: no need to disassemble. */ + continue; + } + + fprintf(stderr, + "acpi-test: Warning! %.4s binary file mismatch. " + "Actual [aml:%s], Expected [aml:%s].\n", + exp_sdt->aml, sdt->aml_file, exp_sdt->aml_file); + + all_tables_match = all_tables_match && + test_acpi_find_diff_allowed(exp_sdt); + err = load_asl(data->tables, sdt); asl = normalize_asl(sdt->asl); @@ -413,8 +427,6 @@ static void test_acpi_asl(test_data *data) } } } - all_tables_match = all_tables_match && - test_acpi_find_diff_allowed(exp_sdt); } g_string_free(asl, true); g_string_free(exp_asl, true); -- cgit v1.2.3