From 449ae81faeff23a54693e337439f5c5685bd7bb8 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Thu, 11 Apr 2024 23:39:40 +0200 Subject: [PATCH] support/testing: add links runtime test Signed-off-by: Julien Olivain Signed-off-by: Thomas Petazzoni --- DEVELOPERS | 2 ++ support/testing/tests/package/test_links.py | 33 +++++++++++++++++++ .../test_links/rootfs-overlay/root/file.html | 9 +++++ 3 files changed, 44 insertions(+) create mode 100644 support/testing/tests/package/test_links.py create mode 100644 support/testing/tests/package/test_links/rootfs-overlay/root/file.html diff --git a/DEVELOPERS b/DEVELOPERS index 7e855e580f..8addd747b2 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1834,6 +1834,8 @@ F: support/testing/tests/package/test_libcamera.py F: support/testing/tests/package/test_libcamera/ F: support/testing/tests/package/test_libgpgme.py F: support/testing/tests/package/test_libjxl.py +F: support/testing/tests/package/test_links.py +F: support/testing/tests/package/test_links/ F: support/testing/tests/package/test_lrzip.py F: support/testing/tests/package/test_ltrace.py F: support/testing/tests/package/test_lvm2.py diff --git a/support/testing/tests/package/test_links.py b/support/testing/tests/package/test_links.py new file mode 100644 index 0000000000..ed52bb2d5f --- /dev/null +++ b/support/testing/tests/package/test_links.py @@ -0,0 +1,33 @@ +import os + +import infra.basetest + + +class TestLinks(infra.basetest.BRTest): + rootfs_overlay = \ + infra.filepath("tests/package/test_links/rootfs-overlay") + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + f""" + BR2_PACKAGE_LINKS=y + BR2_ROOTFS_OVERLAY="{rootfs_overlay}" + 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() + + self.assertRunOk("links -version") + + expected_str = "Hello Buildroot !" + html_file = "/root/file.html" + url = f"file://{html_file}" + + cmd = f"links -dump {url}" + out, ret = self.emulator.run(cmd) + self.assertEqual(ret, 0) + self.assertEqual(out[0].strip(), expected_str) diff --git a/support/testing/tests/package/test_links/rootfs-overlay/root/file.html b/support/testing/tests/package/test_links/rootfs-overlay/root/file.html new file mode 100644 index 0000000000..65b33cb5a7 --- /dev/null +++ b/support/testing/tests/package/test_links/rootfs-overlay/root/file.html @@ -0,0 +1,9 @@ + + + + Buildroot Test Page + + +

Hello Buildroot !

+ +