diff mbox series

[4/4] support/testing: add luvi test

Message ID 20190929125520.16957-4-francois.perrad@gadz.org
State Accepted
Headers show
Series [1/4] support/testing: add lzlib test | expand

Commit Message

Francois Perrad Sept. 29, 2019, 12:55 p.m. UTC
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 .gitlab-ci.yml                             |  1 +
 support/testing/tests/package/test_luvi.py | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 support/testing/tests/package/test_luvi.py

Comments

Ricardo Martincoski Oct. 7, 2019, 11:38 p.m. UTC | #1
Hello,

I did not find anything really wrong with this patch, but I think we can reuse
more code.

Did you find any issue using the armv5 kernel?
For me it seems to work fine:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/313198399

In the case we can use the armv5 kernel, we can also use TestLuaBase, by doing
3 changes I propose below.
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/314234461

On Sun, Sep 29, 2019 at 09:55 AM, Francois Perrad wrote:

[snip]
> diff --git a/support/testing/tests/package/test_luvi.py b/support/testing/tests/package/test_luvi.py
> new file mode 100644
> index 000000000..a85a6f4d2
> --- /dev/null
> +++ b/support/testing/tests/package/test_luvi.py
> @@ -0,0 +1,36 @@

> +import os
> +
> +import infra.basetest

These would become:
from tests.package.test_lua import TestLuaBase

> +
> +

> +class TestLuvi(infra.basetest.BRTest):
> +    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
> +        """
> +        BR2_TARGET_ROOTFS_CPIO=y
> +        # BR2_TARGET_ROOTFS_TAR is not set

These would become:
class TestLuvi(TestLuaBase):
    config = TestLuaBase.config + \
        """

> +        BR2_PACKAGE_LUAJIT=y
> +        BR2_PACKAGE_LUVI=y
> +        BR2_PACKAGE_OPENSSL=y
> +        BR2_PACKAGE_PCRE=y
> +        BR2_PACKAGE_ZLIB=y
> +        """
> +

> +    def login(self):
> +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
> +        self.emulator.boot(arch="armv7",
> +                           kernel="builtin",
> +                           options=["-initrd", cpio_file])
> +        self.emulator.login()
> +

And login() would not be defined, reusing the implementation from the parent
class.

> +    def version_test(self):
> +        cmd = "luvi -v"
> +        output, exit_code = self.emulator.run(cmd)
> +        self.assertIn('luvi', output[0])
> +        self.assertIn('zlib', output[1])
> +        self.assertIn('rex', output[2])
> +        self.assertIn('libuv', output[3])
> +        self.assertIn('ssl', output[4])
> +
> +    def test_run(self):
> +        self.login()
> +        self.version_test()
> -- 

Regards,
Ricardo
Francois Perrad Oct. 8, 2019, 7:12 p.m. UTC | #2
Le mar. 8 oct. 2019 à 01:38, Ricardo Martincoski <
ricardo.martincoski@gmail.com> a écrit :

> Hello,
>
> I did not find anything really wrong with this patch, but I think we can
> reuse
> more code.
>
>
I disagree.
luvi is related to lua, but it is not a Lua module (like NodeJS which is an
JavaScript interpreter, is not a JavaScript library/module).
so, it is a choice to not use TestLuaBase.

In my todo list, I want remove luvi from the Lua modules section in
package/Config.in, and find its real location.

François


> Did you find any issue using the armv5 kernel?
> For me it seems to work fine:
> https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/313198399
>
> In the case we can use the armv5 kernel, we can also use TestLuaBase, by
> doing
> 3 changes I propose below.
> https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/314234461
>
> On Sun, Sep 29, 2019 at 09:55 AM, Francois Perrad wrote:
>
> [snip]
> > diff --git a/support/testing/tests/package/test_luvi.py
> b/support/testing/tests/package/test_luvi.py
> > new file mode 100644
> > index 000000000..a85a6f4d2
> > --- /dev/null
> > +++ b/support/testing/tests/package/test_luvi.py
> > @@ -0,0 +1,36 @@
>
> > +import os
> > +
> > +import infra.basetest
>
> These would become:
> from tests.package.test_lua import TestLuaBase
>
> > +
> > +
>
> > +class TestLuvi(infra.basetest.BRTest):
> > +    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
> > +        """
> > +        BR2_TARGET_ROOTFS_CPIO=y
> > +        # BR2_TARGET_ROOTFS_TAR is not set
>
> These would become:
> class TestLuvi(TestLuaBase):
>     config = TestLuaBase.config + \
>         """
>
> > +        BR2_PACKAGE_LUAJIT=y
> > +        BR2_PACKAGE_LUVI=y
> > +        BR2_PACKAGE_OPENSSL=y
> > +        BR2_PACKAGE_PCRE=y
> > +        BR2_PACKAGE_ZLIB=y
> > +        """
> > +
>
> > +    def login(self):
> > +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
> > +        self.emulator.boot(arch="armv7",
> > +                           kernel="builtin",
> > +                           options=["-initrd", cpio_file])
> > +        self.emulator.login()
> > +
>
> And login() would not be defined, reusing the implementation from the
> parent
> class.
>
> > +    def version_test(self):
> > +        cmd = "luvi -v"
> > +        output, exit_code = self.emulator.run(cmd)
> > +        self.assertIn('luvi', output[0])
> > +        self.assertIn('zlib', output[1])
> > +        self.assertIn('rex', output[2])
> > +        self.assertIn('libuv', output[3])
> > +        self.assertIn('ssl', output[4])
> > +
> > +    def test_run(self):
> > +        self.login()
> > +        self.version_test()
> > --
>
> Regards,
> Ricardo_______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Ricardo Martincoski Oct. 8, 2019, 11:27 p.m. UTC | #3
Hello,

On Tue, Oct 08, 2019 at 04:12 PM, François Perrad wrote:

> Le mar. 8 oct. 2019 à 01:38, Ricardo Martincoski <
> ricardo.martincoski@gmail.com> a écrit :
> 
>> Hello,
>>
>> I did not find anything really wrong with this patch, but I think we can
>> reuse
>> more code.
>>
>>
> I disagree.
> luvi is related to lua, but it is not a Lua module (like NodeJS which is an
> JavaScript interpreter, is not a JavaScript library/module).
> so, it is a choice to not use TestLuaBase.

You are right. Thank you for your explanation.


Regards,
Ricardo
Ricardo Martincoski Oct. 8, 2019, 11:28 p.m. UTC | #4
Hello,

On Sun, Sep 29, 2019 at 09:55 AM, Francois Perrad wrote:

Perhaps when applying this patch the commit message could be extended,
something like this:

Do not import TestLuaBase since luvi is related to lua, but it is not a
Lua module.

> 
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>

Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>


Regards,
Ricardo
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ecbcbcb78..2f73644e3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -403,6 +403,7 @@  tests.package.test_luasocket.TestLuaLuaSocket: { extends: .runtime_test }
 tests.package.test_luasocket.TestLuajitLuaSocket: { extends: .runtime_test }
 tests.package.test_luasyslog.TestLuaLuasyslog: { extends: .runtime_test }
 tests.package.test_luasyslog.TestLuajitLuasyslog: { extends: .runtime_test }
+tests.package.test_luvi.TestLuvi: { extends: .runtime_test }
 tests.package.test_lzlib.TestLuaLzlib: { extends: .runtime_test }
 tests.package.test_openjdk.TestOpenJdk: { extends: .runtime_test }
 tests.package.test_perl.TestPerl: { extends: .runtime_test }
diff --git a/support/testing/tests/package/test_luvi.py b/support/testing/tests/package/test_luvi.py
new file mode 100644
index 000000000..a85a6f4d2
--- /dev/null
+++ b/support/testing/tests/package/test_luvi.py
@@ -0,0 +1,36 @@ 
+import os
+
+import infra.basetest
+
+
+class TestLuvi(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_PACKAGE_LUAJIT=y
+        BR2_PACKAGE_LUVI=y
+        BR2_PACKAGE_OPENSSL=y
+        BR2_PACKAGE_PCRE=y
+        BR2_PACKAGE_ZLIB=y
+        """
+
+    def login(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+    def version_test(self):
+        cmd = "luvi -v"
+        output, exit_code = self.emulator.run(cmd)
+        self.assertIn('luvi', output[0])
+        self.assertIn('zlib', output[1])
+        self.assertIn('rex', output[2])
+        self.assertIn('libuv', output[3])
+        self.assertIn('ssl', output[4])
+
+    def test_run(self):
+        self.login()
+        self.version_test()