* [Buildroot] [PATCH 1/1] support/testing/tests/package/test_acpica.py: run runtime test
@ 2023-07-13 20:18 Julien Olivain
2023-07-13 20:30 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2023-07-13 20:18 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
DEVELOPERS | 2 +
support/testing/tests/package/test_acpica.py | 91 +++++++++++++++++++
.../test_acpica/rootfs-overlay/root/dsdt.asl | 9 ++
3 files changed, 102 insertions(+)
create mode 100644 support/testing/tests/package/test_acpica.py
create mode 100644 support/testing/tests/package/test_acpica/rootfs-overlay/root/dsdt.asl
diff --git a/DEVELOPERS b/DEVELOPERS
index 0918e9f721..b58203a9f5 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1728,6 +1728,8 @@ F: support/testing/tests/package/sample_python_gnupg.py
F: support/testing/tests/package/sample_python_hwdata.py
F: support/testing/tests/package/sample_python_pyalsa.py
F: support/testing/tests/package/sample_python_spake2.py
+F: support/testing/tests/package/test_acpica.py
+F: support/testing/tests/package/test_acpica/
F: support/testing/tests/package/test_bzip2.py
F: support/testing/tests/package/test_compressor_base.py
F: support/testing/tests/package/test_ddrescue.py
diff --git a/support/testing/tests/package/test_acpica.py b/support/testing/tests/package/test_acpica.py
new file mode 100644
index 0000000000..f7dd64d7f0
--- /dev/null
+++ b/support/testing/tests/package/test_acpica.py
@@ -0,0 +1,91 @@
+import os
+
+import infra.basetest
+
+
+class TestAcpica(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ """
+ BR2_PACKAGE_ACPICA=y
+ BR2_ROOTFS_OVERLAY="{}"
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """.format(
+ # overlay to add an ASL source file
+ infra.filepath("tests/package/test_acpica/rootfs-overlay"))
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-initrd", cpio_file])
+ self.emulator.login()
+
+ # Check a program can execute
+ self.assertRunOk("iasl -v")
+
+ # Check "acpiexamples" demo is running
+ self.assertRunOk("acpiexamples")
+
+ # Check "acpihelp" convert error code 0x1 to AE_ERROR
+ self.assertRunOk("acpihelp -e 1 | grep -F AE_ERROR")
+
+ # Check "acpihelp" convert 0xA3 opcode to NoOpOp
+ self.assertRunOk("acpihelp -o 0xA3 | grep -F NoOpOp")
+
+ # Compile a simple ASL file
+ # The output file is automatically set to "dsdt.aml"
+ self.assertRunOk("iasl dsdt.asl")
+
+ # Evaluate the AML with acpiexec
+ # STR0 is expected to be "Hello Buildroot!"
+ cmd = "acpiexec -b 'evaluate STR0' dsdt.aml"
+ cmd += " | grep -F '\"Hello Buildroot!\"'"
+ self.assertRunOk(cmd)
+
+ # INT1 is exepcted to be 12345678
+ cmd = "acpiexec -b 'evaluate INT1' dsdt.aml"
+ cmd += " | grep -F 12345678"
+ self.assertRunOk(cmd)
+
+ # Evalute the TEST method which prints its argument
+ cmd = "acpiexec -b 'evaluate TST2 \"Hello World\"' dsdt.aml"
+ cmd += " | grep -F 'Arg0=Hello World'"
+ self.assertRunOk(cmd)
+
+ # dump aml to text
+ self.assertRunOk("acpidump -f dsdt.aml -o dsdt.dump")
+
+ # Rebuild dump to binary with acpixtract
+ # Output is implicitly into the dsdt.dat file
+ self.assertRunOk("acpixtract -a dsdt.dump")
+
+ # Compare with acpibin
+ # The rebuilt dsdt.dat is expected to be the same
+ cmd = "acpibin -a dsdt.aml dsdt.dat"
+ cmd += " | grep -F 'Files compare exactly'"
+ self.assertRunOk(cmd)
+
+ # Compare with cmp, to check acpibin
+ self.assertRunOk("cmp dsdt.aml dsdt.dat")
+
+ # Disassemble the compiled ASL
+ # Output file is implicitly "dsdt.dsl", we rename it to
+ # "disa.dsl" to make sure it will not clash with the original
+ # file, when recompiling.
+ self.assertRunOk("iasl dsdt.aml && mv -v dsdt.dsl disa.dsl")
+
+ # Disassembled output should contain our string
+ self.assertRunOk("grep STR0 disa.dsl | grep '\"Hello Buildroot!\"'")
+
+ # Recompile the disassembled file
+ self.assertRunOk("iasl disa.dsl")
+
+ # Compare the first compiled file with the one recompiled from
+ # the disassembly. There are expected to be identical.
+ cmd = "acpibin -a dsdt.aml disa.aml"
+ cmd += " | grep -F 'Files compare exactly'"
+ self.assertRunOk(cmd)
+
+ # Also compare with "cmp"
+ self.assertRunOk("cmp dsdt.aml disa.aml")
diff --git a/support/testing/tests/package/test_acpica/rootfs-overlay/root/dsdt.asl b/support/testing/tests/package/test_acpica/rootfs-overlay/root/dsdt.asl
new file mode 100644
index 0000000000..24f51565be
--- /dev/null
+++ b/support/testing/tests/package/test_acpica/rootfs-overlay/root/dsdt.asl
@@ -0,0 +1,9 @@
+DefinitionBlock ("", "DSDT", 2, "", "", 0x0)
+{
+ Name (STR0, "Hello Buildroot!")
+ Name (INT1, 0x12345678)
+ Method (TST2, 1)
+ {
+ printf ("Arg0=%o", Arg0)
+ }
+}
--
2.41.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] support/testing/tests/package/test_acpica.py: run runtime test
2023-07-13 20:18 [Buildroot] [PATCH 1/1] support/testing/tests/package/test_acpica.py: run runtime test Julien Olivain
@ 2023-07-13 20:30 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-13 20:30 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Thu, 13 Jul 2023 22:18:08 +0200
Julien Olivain <ju.o@free.fr> wrote:
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> DEVELOPERS | 2 +
> support/testing/tests/package/test_acpica.py | 91 +++++++++++++++++++
> .../test_acpica/rootfs-overlay/root/dsdt.asl | 9 ++
> 3 files changed, 102 insertions(+)
> create mode 100644 support/testing/tests/package/test_acpica.py
> create mode 100644 support/testing/tests/package/test_acpica/rootfs-overlay/root/dsdt.asl
Applied to master, thanks. Sadly, I only spotted the minor typo in the
commit title after pushing :)
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-13 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 20:18 [Buildroot] [PATCH 1/1] support/testing/tests/package/test_acpica.py: run runtime test Julien Olivain
2023-07-13 20:30 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox