qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ani Sinha <anisinha@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Ani Sinha <anisinha@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [PATCH] acpi/tests/bios-tables-test: add an environment variable for iasl location
Date: Wed, 17 May 2023 17:37:51 +0530	[thread overview]
Message-ID: <20230517120751.14679-1-anisinha@redhat.com> (raw)

Currently the meson based QEMU build process locates the iasl binary from the
current PATH and other locations [1] and uses that to set CONFIG_IASL which is
then used by the test.

This has two disadvantages:
 - If iasl was not previously installed in the PATH, one has to install iasl
   and rebuild QEMU in order to pick up the iasl location. One cannot simply
   use the existing bios-tables-test binary because CONFIG_IASL is only set
   during the QEMU build time by meson and then bios-tables-test has to be
   rebuilt with CONFIG_IASL set in order to use iasl.
 - Sometimes, the stock iasl that comes with distributions is simply not good
   enough because it does not support the latest ACPI changes - newly
   introduced tables or new table attributes etc. In order to test ACPI code
   in QEMU, one has to clone the latest acpica upstream repository and
   rebuild iasl in order to get support for it. In those cases, one may want
   the test to use the iasl binary from a non-standard location.

In order to overcome the above two disadvantages, we introduce a new
environment variable IASL_PATH that can be set by the tester pointing to an
possibly non-standard iasl binary location. Bios-tables-test then uses this
environment variable to set its iasl location, possibly also overriding the
location that was pointed to by CONFIG_IASL that was set by meson. This way
developers can not only use this new environment variable to set iasl
location to quickly run bios-tables-test but also can point the test to a
custom iasl if required.

[1] https://mesonbuild.com/Reference-manual_functions.html#find_program

Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 tests/qtest/bios-tables-test.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

sample runs:

$ QTEST_QEMU_BINARY=./qemu-system-x86_64 V=2 ./tests/qtest/bios-tables-test
...
acpi-test: Warning! APIC binary file mismatch. Actual [aml:/tmp/aml-DLHA51], Expected [aml:tests/data/acpi/pc/APIC].
See source file tests/qtest/bios-tables-test.c for instructions on how to update expected files.
Using iasl: /usr/bin/iasl
acpi-test: Warning! APIC mismatch. Actual [asl:/tmp/asl-L9GA51.dsl, aml:/tmp/aml-DLHA51], Expected [asl:/tmp/asl-10EA51.dsl, aml:tests/data/acpi/pc/APIC].

$ QTEST_QEMU_BINARY=./qemu-system-x86_64 V=2 IASL_PATH=/home/anisinha/workspace/acpica/generate/unix/bin/iasl ./tests/qtest/bios-tables-test
...
acpi-test: Warning! APIC binary file mismatch. Actual [aml:/tmp/aml-5CQ341], Expected [aml:tests/data/acpi/pc/APIC].
See source file tests/qtest/bios-tables-test.c for instructions on how to update expected files.
User has provided an iasl path, using that: /home/anisinha/workspace/acpica/generate/unix/bin/iasl
acpi-test: Warning! APIC mismatch. Actual [asl:/tmp/asl-2GQ341.dsl, aml:/tmp/aml-5CQ341], Expected [asl:/tmp/asl-IBR341.dsl, aml:tests/data/acpi/pc/APIC].

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 7fd88b0e9c..37e8e484cb 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -440,7 +440,12 @@ static void test_acpi_asl(test_data *data)
     AcpiSdtTable *sdt, *exp_sdt;
     test_data exp_data = {};
     gboolean exp_err, err, all_tables_match = true;
+    const char *user_iasl_path = getenv("IASL_PATH");
 
+    /* if user has provided a path to iasl, use that */
+    if (user_iasl_path) {
+        iasl = user_iasl_path;
+    }
     exp_data.tables = load_expected_aml(data);
     dump_aml_files(data, false);
     for (i = 0; i < data->tables->len; ++i) {
@@ -473,6 +478,15 @@ static void test_acpi_asl(test_data *data)
             continue;
         }
 
+        if (verbosity_level >= 2) {
+            if (user_iasl_path) {
+                fprintf(stderr, "User has provided an iasl path," \
+                        "using that: %s\n", user_iasl_path);
+            } else {
+                fprintf(stderr, "Using iasl: %s\n", iasl);
+            }
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 
-- 
2.39.1



             reply	other threads:[~2023-05-17 12:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 12:07 Ani Sinha [this message]
2023-05-17 14:17 ` [PATCH] acpi/tests/bios-tables-test: add an environment variable for iasl location Michael S. Tsirkin
2023-05-17 14:27   ` Ani Sinha
2023-05-17 14:36     ` Michael S. Tsirkin
2023-05-17 14:49       ` Ani Sinha
2023-05-17 15:16         ` Alex Bennée
2023-05-17 15:25           ` Michael S. Tsirkin
2023-05-17 15:58             ` Alex Bennée
2023-05-17 16:07               ` Michael S. Tsirkin
2023-05-17 16:20                 ` Alex Bennée
2023-05-18  6:01                   ` Ani Sinha
2023-05-18 10:40                     ` Michael S. Tsirkin
2023-05-18 11:01                       ` Ani Sinha
2023-05-19 17:13                         ` Paolo Bonzini
2023-05-20  7:25                           ` Ani Sinha
2023-05-20  9:36                             ` Paolo Bonzini
2023-05-20 15:13                               ` Ani Sinha
2023-05-22 10:21                                 ` Paolo Bonzini
2023-05-18 11:19                       ` Ani Sinha
2023-05-18  6:11                   ` Ani Sinha
2023-05-17 15:48           ` Ani Sinha
2023-05-17 16:07             ` Alex Bennée
2023-05-17 16:43 ` Bernhard Beschow
2023-05-18  5:55   ` Ani Sinha
2023-05-18 10:27   ` Michael S. Tsirkin
2023-05-21  8:54 ` Michael S. Tsirkin
2023-05-21 14:51   ` Ani Sinha
2023-05-22 10:34     ` Ani Sinha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517120751.14679-1-anisinha@redhat.com \
    --to=anisinha@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).