All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/testing: add nano test
@ 2026-08-31 21:43 Franciszek Stachura
  2026-09-05 14:18 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Franciszek Stachura @ 2026-08-31 21:43 UTC (permalink / raw)
  To: buildroot; +Cc: Franciszek Stachura

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>
---
 DEVELOPERS                                 |  1 +
 support/testing/tests/package/test_nano.py | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 support/testing/tests/package/test_nano.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 53104cc60b..0b5060f1fc 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1170,6 +1170,7 @@ F:	package/ser2net/
 
 N:	Franciszek Stachura <fbstachura@gmail.com>
 F:	support/testing/tests/package/test_memcached.py
+F:	support/testing/tests/package/test_nano.py
 
 N:	Francois Dugast <francois.dugast.foss@gmail.com>
 F:	board/sipeed/licheepi_nano/
diff --git a/support/testing/tests/package/test_nano.py b/support/testing/tests/package/test_nano.py
new file mode 100644
index 0000000000..c1cc56d031
--- /dev/null
+++ b/support/testing/tests/package/test_nano.py
@@ -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)
-- 
2.55.0

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

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

end of thread, other threads:[~2026-09-05 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 21:43 [Buildroot] [PATCH] support/testing: add nano test Franciszek Stachura
2026-09-05 14:18 ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.