support/testing: add links runtime test

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 449ae81fae)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Julien Olivain 2024-04-11 23:39:40 +02:00 committed by Peter Korsgaard
parent 6331561b2a
commit ca30429097
3 changed files with 44 additions and 0 deletions

View File

@ -1807,6 +1807,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

View File

@ -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)

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Buildroot Test Page</title>
</head>
<body>
<p><b>Hello</b> <i>Buildroot</i> &excl;</p>
</body>
</html>