Since virt machine is common for multiple architectures, add "arch" in
the path to search expected AML files. Since the AML files are still
under old path, support both by searching with and without arch in the
path.
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
tests/qtest/bios-tables-test.c | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index c4a4d1c7bf..c73174ad00 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -78,6 +78,7 @@
typedef struct {
bool tcg_only;
const char *machine;
+ const char *arch;
const char *machine_param;
const char *variant;
const char *uefi_fl1;
@@ -262,8 +263,19 @@ static void dump_aml_files(test_data *data, bool rebuild)
g_assert(exp_sdt->aml);
if (rebuild) {
- aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+ aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir,
+ data->machine, data->arch,
sdt->aml, ext);
+
+ /*
+ * To keep test cases not failing when the DATA files are moved to
+ * ARCH under virt folder, add this check as well.
+ */
+ if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
+ aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir,
+ data->machine, sdt->aml, ext);
+ }
+
if (!g_file_test(aml_file, G_FILE_TEST_EXISTS) &&
sdt->aml_len == exp_sdt->aml_len &&
!memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) {
@@ -398,8 +410,13 @@ static GArray *load_expected_aml(test_data *data)
memset(&exp_sdt, 0, sizeof(exp_sdt));
try_again:
- aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
- sdt->aml, ext);
+ aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir, data->machine,
+ data->arch, sdt->aml, ext);
+ if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
+ aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+ sdt->aml, ext);
+ }
+
if (verbosity_level >= 2) {
fprintf(stderr, "Looking for expected file '%s'\n", aml_file);
}
@@ -1574,6 +1591,7 @@ static void test_acpi_aarch64_virt_tcg_memhp(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1667,6 +1685,7 @@ static void test_acpi_aarch64_virt_tcg_numamem(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1689,6 +1708,7 @@ static void test_acpi_aarch64_virt_tcg_pxb(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1762,6 +1782,7 @@ static void test_acpi_aarch64_virt_tcg_acpi_hmat(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1918,6 +1939,7 @@ static void test_acpi_aarch64_virt_tcg(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -1937,6 +1959,7 @@ static void test_acpi_aarch64_virt_tcg_topology(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.variant = ".topology",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
@@ -2020,6 +2043,7 @@ static void test_acpi_aarch64_virt_viot(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
@@ -2196,6 +2220,7 @@ static void test_acpi_aarch64_virt_oem_fields(void)
{
test_data data = {
.machine = "virt",
+ .arch = "aarch64",
.tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
--
2.40.1
On Fri, 24 May 2024 11:44:04 +0530
Sunil V L <sunilvl@ventanamicro.com> wrote:
> Since virt machine is common for multiple architectures, add "arch" in
> the path to search expected AML files. Since the AML files are still
> under old path, support both by searching with and without arch in the
> path.
>
> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
other than need to swap machine/arch order mentioned in
the next patch look good to me
> ---
> tests/qtest/bios-tables-test.c | 31 ++++++++++++++++++++++++++++---
> 1 file changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index c4a4d1c7bf..c73174ad00 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -78,6 +78,7 @@
> typedef struct {
> bool tcg_only;
> const char *machine;
> + const char *arch;
> const char *machine_param;
> const char *variant;
> const char *uefi_fl1;
> @@ -262,8 +263,19 @@ static void dump_aml_files(test_data *data, bool rebuild)
> g_assert(exp_sdt->aml);
>
> if (rebuild) {
> - aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
> + aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir,
> + data->machine, data->arch,
> sdt->aml, ext);
> +
> + /*
> + * To keep test cases not failing when the DATA files are moved to
> + * ARCH under virt folder, add this check as well.
> + */
> + if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
> + aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir,
> + data->machine, sdt->aml, ext);
> + }
> +
> if (!g_file_test(aml_file, G_FILE_TEST_EXISTS) &&
> sdt->aml_len == exp_sdt->aml_len &&
> !memcmp(sdt->aml, exp_sdt->aml, sdt->aml_len)) {
> @@ -398,8 +410,13 @@ static GArray *load_expected_aml(test_data *data)
> memset(&exp_sdt, 0, sizeof(exp_sdt));
>
> try_again:
> - aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
> - sdt->aml, ext);
> + aml_file = g_strdup_printf("%s/%s/%s/%.4s%s", data_dir, data->machine,
> + data->arch, sdt->aml, ext);
> + if (!g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
> + aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
> + sdt->aml, ext);
> + }
> +
> if (verbosity_level >= 2) {
> fprintf(stderr, "Looking for expected file '%s'\n", aml_file);
> }
> @@ -1574,6 +1591,7 @@ static void test_acpi_aarch64_virt_tcg_memhp(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -1667,6 +1685,7 @@ static void test_acpi_aarch64_virt_tcg_numamem(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -1689,6 +1708,7 @@ static void test_acpi_aarch64_virt_tcg_pxb(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -1762,6 +1782,7 @@ static void test_acpi_aarch64_virt_tcg_acpi_hmat(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -1918,6 +1939,7 @@ static void test_acpi_aarch64_virt_tcg(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -1937,6 +1959,7 @@ static void test_acpi_aarch64_virt_tcg_topology(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .variant = ".topology",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> @@ -2020,6 +2043,7 @@ static void test_acpi_aarch64_virt_viot(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> @@ -2196,6 +2220,7 @@ static void test_acpi_aarch64_virt_oem_fields(void)
> {
> test_data data = {
> .machine = "virt",
> + .arch = "aarch64",
> .tcg_only = true,
> .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
© 2016 - 2026 Red Hat, Inc.