mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-19 16:40:46 -09:00
support/testing: add nano test
Add a basic runtime test for nano. The test attempts to write a file using the editor. Signed-off-by: Franciszek Stachura <fbstachura@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
967380b316
commit
0e631348db
@@ -1170,6 +1170,7 @@ F: package/ser2net/
|
|||||||
|
|
||||||
N: Franciszek Stachura <fbstachura@gmail.com>
|
N: Franciszek Stachura <fbstachura@gmail.com>
|
||||||
F: support/testing/tests/package/test_memcached.py
|
F: support/testing/tests/package/test_memcached.py
|
||||||
|
F: support/testing/tests/package/test_nano.py
|
||||||
|
|
||||||
N: Francois Dugast <francois.dugast.foss@gmail.com>
|
N: Francois Dugast <francois.dugast.foss@gmail.com>
|
||||||
F: board/sipeed/licheepi_nano/
|
F: board/sipeed/licheepi_nano/
|
||||||
|
|||||||
41
support/testing/tests/package/test_nano.py
Normal file
41
support/testing/tests/package/test_nano.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import infra.basetest
|
||||||
|
|
||||||
|
|
||||||
|
class TestNano(infra.basetest.BRTest):
|
||||||
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + """
|
||||||
|
BR2_TARGET_ROOTFS_CPIO=y
|
||||||
|
BR2_PACKAGE_NANO=y
|
||||||
|
"""
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
cmd = "nano -V | grep 'GNU nano'"
|
||||||
|
self.assertRunOk(cmd)
|
||||||
|
|
||||||
|
self.emulator.qemu.sendline("nano")
|
||||||
|
|
||||||
|
# send file contents
|
||||||
|
self.emulator.qemu.send("test")
|
||||||
|
# ^X for exit
|
||||||
|
self.emulator.qemu.send(chr(0x18))
|
||||||
|
# y for 'Save modified buffer?'
|
||||||
|
self.emulator.qemu.send("y")
|
||||||
|
# target filename
|
||||||
|
self.emulator.qemu.send("file")
|
||||||
|
# ^M for enter
|
||||||
|
self.emulator.qemu.send(chr(0xd))
|
||||||
|
|
||||||
|
self.emulator.qemu.sendline("clear; reset")
|
||||||
|
|
||||||
|
# wait for prompt
|
||||||
|
self.emulator.qemu.expect("# ")
|
||||||
|
|
||||||
|
cmd = "cat file | grep '^test$'"
|
||||||
|
self.assertRunOk(cmd)
|
||||||
Reference in New Issue
Block a user