Message ID | ZQgJZxHHCj8iLCdW@waldemar-brodkorb.de |
---|---|
State | Accepted |
Headers | show |
Series | support/testing/tests/package/test_ruby.py: new runtime test | expand |
Hello Waldmar, On Mon, 18 Sep 2023 10:25:11 +0200 Waldemar Brodkorb <wbx@openadk.org> wrote: > Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> > --- > 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. > diff --git a/support/testing/tests/package/test_ruby.py b/support/testing/tests/package/test_ruby.py > new file mode 100644 > index 0000000000..bedd9afb1c > --- /dev/null > +++ b/support/testing/tests/package/test_ruby.py > @@ -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): 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
diff --git a/support/testing/tests/package/test_ruby.py b/support/testing/tests/package/test_ruby.py new file mode 100644 index 0000000000..bedd9afb1c --- /dev/null +++ b/support/testing/tests/package/test_ruby.py @@ -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() +
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org> --- support/testing/tests/package/test_ruby.py | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 support/testing/tests/package/test_ruby.py