support/testing/tests/package/test_nu.py: new runtime test

Load sample script support/testing/tests/package/sample_nu.nu onto the
target and verify proper execution by nushell

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Sebastian Weyer 2023-03-08 14:15:53 +01:00 committed by Thomas Petazzoni
parent f8047ff598
commit bea949996e
3 changed files with 40 additions and 0 deletions

View File

@ -2685,6 +2685,8 @@ F: package/ripgrep/
N: Sebastian Weyer <sebastian.weyer@smile.fr>
F: package/nushell/
F: support/testing/tests/package/sample_nu.nu
F: support/testing/tests/package/test_nu.py
N: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
F: package/mmc-utils/

View File

@ -0,0 +1,6 @@
#! /usr/bin/nu
def greet [name] {
["hello" $name]
}
greet "world"

View File

@ -0,0 +1,32 @@
import os
import infra.basetest
class TestNu(infra.basetest.BRTest):
# infra.basetest.BASIC_TOOLCHAIN_CONFIG cannot be used as it doesn't
# support a host rustc which is necessary for nushell
config = \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_SYSTEM_DHCP="eth0"
BR2_PACKAGE_NUSHELL=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
""".format(infra.filepath("tests/package/copy-sample-script-to-target.sh"),
infra.filepath("tests/package/sample_nu.nu"))
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
cmd = "nu sample_nu.nu"
self.assertRunOk(cmd)