Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing: new xxhash runtime test
@ 2024-12-30 20:11 Julien Olivain
  2024-12-30 21:44 ` Thomas Petazzoni via buildroot
  2025-01-08 20:42 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-12-30 20:11 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested in:
https://gitlab.com/jolivain/buildroot/-/jobs/8743934301
---
 DEVELOPERS                                   |  1 +
 support/testing/tests/package/test_xxhash.py | 35 ++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 support/testing/tests/package/test_xxhash.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 4fb5ae023d..a5e273056d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2004,6 +2004,7 @@ F:	support/testing/tests/package/test_wine.py
 F:	support/testing/tests/package/test_xfsprogs.py
 F:	support/testing/tests/package/test_xfsprogs/
 F:	support/testing/tests/package/test_xvisor.py
+F:	support/testing/tests/package/test_xxhash.py
 F:	support/testing/tests/package/test_xz.py
 F:	support/testing/tests/package/test_z3.py
 F:	support/testing/tests/package/test_z3/
diff --git a/support/testing/tests/package/test_xxhash.py b/support/testing/tests/package/test_xxhash.py
new file mode 100644
index 0000000000..00e0f245fc
--- /dev/null
+++ b/support/testing/tests/package/test_xxhash.py
@@ -0,0 +1,35 @@
+import os
+
+import infra.basetest
+
+
+class TestXxHash(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_XXHASH=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    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()
+
+        testfile = "data.bin"
+
+        # Check we can run the program.
+        self.assertRunOk("xxhsum --version")
+
+        # We create a test data file with random data.
+        cmd = f"dd if=/dev/urandom of={testfile} bs=1M count=1"
+        self.assertRunOk(cmd)
+
+        # For the three hash sizes, we compute the xxhash and check
+        # the integrity of the file.
+        for hsize in [32, 64, 128]:
+            hashfile = f"{testfile}.xxh{hsize}"
+            self.assertRunOk(f"xxh{hsize}sum {testfile} | tee {hashfile}")
+            self.assertRunOk(f"xxh{hsize}sum -c {hashfile}")
-- 
2.47.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-08 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 20:11 [Buildroot] [PATCH 1/1] support/testing: new xxhash runtime test Julien Olivain
2024-12-30 21:44 ` Thomas Petazzoni via buildroot
2025-01-08 20:42 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox