Skip to contentSkip to conversation

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

PATCH In review Waldemar Brodkorb 2 participants 2 messages Sep 18, 2023 – Nov 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/testing/tests/package/test_ruby.py: new runtime test

---
 support/testing/tests/package/test_ruby.py | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 support/testing/tests/package/test_ruby.py
support/testing/tests/package/test_ruby.py new file +42 -0
new file mode 100644
index 0000000000..bedd9afb1c
@@ -0,0 +1,42 @@
+import os
+
+import infra.basetest
+
+
+class TestRubyBase(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+    interpreter = "ruby"
+
+    def login(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()
+
+class TestRuby(TestRubyBase):
+    config = TestRubyBase.config + \
+        """
+        BR2_PACKAGE_RUBY=y
+        BR2_PACKAGE_ZLIB=y
+        """
+
+    def version_test(self):
+        cmd = self.interpreter + " -v"
+        output, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+
+    def zlib_test(self, timeout=-1):
+        cmd = self.interpreter + " -e 'require \"zlib\"'"
+        _, exit_code = self.emulator.run(cmd, timeout)
+        self.assertEqual(exit_code, 0)
+
+    def test_run(self):
+        self.login()
+        self.version_test()
+        self.zlib_test()
+
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Waldmar,

Quoted 5 lines · On Mon, 18 Sep 2023 10:25:11 +0200 Waldemar Brodkorb <[email protected]> wrote:
---
 support/testing/tests/package/test_ruby.py | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 support/testing/tests/package/test_ruby.py

The entry in the DEVELOPERS file was missing.

Quoted 17 lines
support/testing/tests/package/test_ruby.py new file +11 -0
new file mode 100644
index 0000000000..bedd9afb1c
@@ -0,0 +1,42 @@
+import os
+
+import infra.basetest
+
+
+class TestRubyBase(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """

support/testing/tests/package/test_ruby.py line 21

Quoted 10 lines
support/testing/tests/package/test_ruby.py new file +10 -0
+    interpreter = "ruby"
+
+    def login(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()
+
+class TestRuby(TestRubyBase):

With just one test, there really wasn't a good reason to split into two classes. So I've re-grouped the whole thing into just one class. We can always split things later if we get more tests, and we need to factorize some parts.

Applied with those changes, thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot