Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing/tests/package/test_screen.py: new runtime test
@ 2023-09-08 20:55 Julien Olivain
  2023-09-10 16:36 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2023-09-08 20:55 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                   |  1 +
 support/testing/tests/package/test_screen.py | 61 ++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 support/testing/tests/package/test_screen.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 9b500f3701..bf25f2c61e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1794,6 +1794,7 @@ F:	support/testing/tests/package/test_python_pyalsa.py
 F:	support/testing/tests/package/test_python_spake2.py
 F:	support/testing/tests/package/test_rdma_core.py
 F:	support/testing/tests/package/test_rdma_core/
+F:	support/testing/tests/package/test_screen.py
 F:	support/testing/tests/package/test_stress_ng.py
 F:	support/testing/tests/package/test_xz.py
 F:	support/testing/tests/package/test_z3.py
diff --git a/support/testing/tests/package/test_screen.py b/support/testing/tests/package/test_screen.py
new file mode 100644
index 0000000000..bb3ce29ba0
--- /dev/null
+++ b/support/testing/tests/package/test_screen.py
@@ -0,0 +1,61 @@
+import os
+
+import infra.basetest
+
+
+class TestScreen(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_SCREEN=y
+        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()
+
+        session_name = "BuildrootSession"
+        message = "HelloBuildroot"
+        screen_dump = "screen.dump.txt"
+
+        # Check the program can execute
+        self.assertRunOk("screen --version")
+
+        # There is no "screen" running yet. Listing sessions is
+        # expected to fail.
+        _, exit_code = self.emulator.run("screen -ls")
+        self.assertNotEqual(exit_code, 0)
+
+        # We now start a detached and named session.
+        self.assertRunOk(f"screen -dmS {session_name}")
+
+        # Since we are supposed to have a running session, it should
+        # appear in the list.
+        output, exit_code = self.emulator.run("screen -ls")
+        self.assertEqual(exit_code, 0)
+        self.assertIn(session_name, "\n".join(output))
+
+        # We send an exec command to print a message in the "screen"
+        # display running in background.
+        cmd = f"screen -S {session_name} -X exec printf {message}"
+        self.assertRunOk(cmd)
+
+        # We request a hardcopy of this "screen" display.
+        cmd = f"screen -S {session_name} -X hardcopy {screen_dump}"
+        self.assertRunOk(cmd)
+
+        # The dump file is supposed to contain our message.
+        self.assertRunOk(f"grep -Fo '{message}' {screen_dump}")
+
+        # We request "screen" to quit...
+        cmd = f"screen -S {session_name} -X quit"
+        self.assertRunOk(cmd)
+
+        # Since the session is supposed to be terminated, listing
+        # sessions is expected to fail (again).
+        _, exit_code = self.emulator.run("screen -ls")
+        self.assertNotEqual(exit_code, 0)
-- 
2.41.0

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

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

* Re: [Buildroot] [PATCH 1/1] support/testing/tests/package/test_screen.py: new runtime test
  2023-09-08 20:55 [Buildroot] [PATCH 1/1] support/testing/tests/package/test_screen.py: new runtime test Julien Olivain
@ 2023-09-10 16:36 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-09-10 16:36 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Fri,  8 Sep 2023 22:55:38 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                   |  1 +
>  support/testing/tests/package/test_screen.py | 61 ++++++++++++++++++++
>  2 files changed, 62 insertions(+)
>  create mode 100644 support/testing/tests/package/test_screen.py

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-09-10 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-08 20:55 [Buildroot] [PATCH 1/1] support/testing/tests/package/test_screen.py: new runtime test Julien Olivain
2023-09-10 16:36 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox