[Buildroot] [PATCH v4 3/3] support/testing: add snappy test
Flaviu Nistor <[email protected]> Thu, 30 Jul 2026 10:59:40 +0300
| Newsgroups | net.busybox.buildroot |
|---|---|
| Message-ID | <[email protected]> |
Add a simple test case that imports the module and does a simple compress decompress routine. Signed-off-by: Flaviu Nistor <[email protected]> --- DEVELOPERS | 2 ++ .../tests/package/sample_python_snappy.py | 7 ++++ .../tests/package/test_python_snappy.py | 34 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 support/testing/tests/package/sample_python_snappy.py create mode 100644 support/testing/tests/package/test_python_snappy.py diff --git a/DEVELOPERS b/DEVELOPERS index dbe05b7806..153b2f4af5 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1140,6 +1140,8 @@ F: package/python-cramjam/ F: package/python-rich/ F: package/python-smmap2/ F: package/python-snappy/ +F: support/testing/tests/package/sample_python_snappy.py +F: support/testing/tests/package/test_python_snappy.py N: Flávio Tapajós <[email protected]> F: configs/asus_tinker-s_rk3288_defconfig diff --git a/support/testing/tests/package/sample_python_snappy.py b/support/testing/tests/package/sample_python_snappy.py new file mode 100644 index 0000000000..ff2c07c05a --- /dev/null +++ b/support/testing/tests/package/sample_python_snappy.py @@ -0,0 +1,7 @@ +import snappy + +payload = b"Buildroot python-snappy runtime test\n" +compressed = snappy.compress(payload) +decompressed = snappy.uncompress(compressed) + +assert decompressed == payload diff --git a/support/testing/tests/package/test_python_snappy.py b/support/testing/tests/package/test_python_snappy.py new file mode 100644 index 0000000000..8c0092bd23 --- /dev/null +++ b/support/testing/tests/package/test_python_snappy.py @@ -0,0 +1,34 @@ +import os + +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonPy3Snappy(TestPythonPackageBase): + __test__ = True + config = """ + BR2_aarch64=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.135" + BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y + BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config" + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_SNAPPY=y + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + interpreter = "python3" + sample_scripts = ["tests/package/sample_python_snappy.py"] + timeout = 20 + + def login(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + kern = os.path.join(self.builddir, "images", "Image") + self.emulator.boot(arch="aarch64", + kernel=kern, + kernel_cmdline=["console=ttyAMA0"], + options=["-M", "virt", "-cpu", "cortex-a57", "-m", "256M", + "-initrd", cpio_file]) + self.emulator.login() -- 2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot