Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends
@ 2018-11-24  9:07 Francois Perrad
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 1/3] support/testing: add lua test Francois Perrad
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Francois Perrad @ 2018-11-24  9:07 UTC (permalink / raw)
  To: buildroot

test_lua.py allows to test the Lua interpreters,
and it is used as base class for testing Lua modules.

note1: Prosody is not a Lua module, but an application using Lua and some Lua modules.

note2: the patch 3/3 is a fix, and must be applied also in master


Francois Perrad (3):
  support/testing: add lua test
  support/testing; add prosody test
  prosody: fix runtime dependencies

 .gitlab-ci.yml                                |  4 ++
 package/prosody/Config.in                     |  5 ++
 support/testing/tests/package/test_lua.py     | 59 +++++++++++++++++++
 support/testing/tests/package/test_prosody.py | 48 +++++++++++++++
 4 files changed, 116 insertions(+)
 create mode 100644 support/testing/tests/package/test_lua.py
 create mode 100644 support/testing/tests/package/test_prosody.py

-- 
2.17.1

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

* [Buildroot] [PATCH/next 1/3] support/testing: add lua test
  2018-11-24  9:07 [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Francois Perrad
@ 2018-11-24  9:07 ` Francois Perrad
  2018-12-04  4:13   ` Ricardo Martincoski
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 2/3] support/testing; add prosody test Francois Perrad
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Francois Perrad @ 2018-11-24  9:07 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 .gitlab-ci.yml                            |  2 +
 support/testing/tests/package/test_lua.py | 59 +++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 support/testing/tests/package/test_lua.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b7114f5dc..bc5970f1d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -312,6 +312,8 @@ tests.init.test_systemd.TestInitSystemSystemdRwNetworkd: *runtime_test
 tests.package.test_dropbear.TestDropbear: *runtime_test
 tests.package.test_ipython.TestIPythonPy2: *runtime_test
 tests.package.test_ipython.TestIPythonPy3: *runtime_test
+tests.package.test_lua.TestLua: *runtime_test
+tests.package.test_lua.TestLuajit: *runtime_test
 tests.package.test_perl.TestPerl: *runtime_test
 tests.package.test_perl_class_load.TestPerlClassLoad: *runtime_test
 tests.package.test_perl_gdgraph.TestPerlGDGraph: *runtime_test
diff --git a/support/testing/tests/package/test_lua.py b/support/testing/tests/package/test_lua.py
new file mode 100644
index 000000000..77358ba13
--- /dev/null
+++ b/support/testing/tests/package/test_lua.py
@@ -0,0 +1,59 @@
+import os
+
+import infra.basetest
+
+
+class TestLuaBase(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    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, version):
+        cmd = "lua -v"
+        output, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+        self.assertIn(version, output[0])
+
+    def g_version_test(self, expected):
+        cmd = "lua -e 'print(_G._VERSION)'"
+        output, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], expected)
+
+    def module_test(self, module, script="a=1"):
+        cmd = "lua -l {} -e '{}'".format(module, script)
+        _, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+
+
+class TestLua(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUA=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.version_test('Lua 5.3')
+        self.g_version_test('Lua 5.3')
+
+
+class TestLuajit(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUAJIT=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.version_test('LuaJIT 2')
+        self.g_version_test('Lua 5.1')
-- 
2.17.1

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

* [Buildroot] [PATCH/next 2/3] support/testing; add prosody test
  2018-11-24  9:07 [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Francois Perrad
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 1/3] support/testing: add lua test Francois Perrad
@ 2018-11-24  9:07 ` Francois Perrad
  2018-11-27  2:42   ` Ricardo Martincoski
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies Francois Perrad
  2018-12-06 22:11 ` [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Thomas Petazzoni
  3 siblings, 1 reply; 10+ messages in thread
From: Francois Perrad @ 2018-11-24  9:07 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 .gitlab-ci.yml                                |  2 +
 support/testing/tests/package/test_prosody.py | 48 +++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 support/testing/tests/package/test_prosody.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bc5970f1d..944f4b226 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -321,6 +321,8 @@ tests.package.test_perl_libwww_perl.TestPerllibwwwperl: *runtime_test
 tests.package.test_perl_mail_dkim.TestPerlMailDKIM: *runtime_test
 tests.package.test_perl_x10.TestPerlX10: *runtime_test
 tests.package.test_perl_xml_libxml.TestPerlXMLLibXML: *runtime_test
+tests.package.test_prosody.TestLua51Prosody: *runtime_test
+tests.package.test_prosody.TestLuajitProsody: *runtime_test
 tests.package.test_python.TestPython2: *runtime_test
 tests.package.test_python.TestPython3: *runtime_test
 tests.package.test_python_argh.TestPythonPy2Argh: *runtime_test
diff --git a/support/testing/tests/package/test_prosody.py b/support/testing/tests/package/test_prosody.py
new file mode 100644
index 000000000..8ef8ff95f
--- /dev/null
+++ b/support/testing/tests/package/test_prosody.py
@@ -0,0 +1,48 @@
+from tests.package.test_lua import TestLuaBase
+
+
+class TestProsody(TestLuaBase):
+    def lua_dependencies_test(self):
+        self.module_test('bit')     # luabitop
+        self.module_test('lfs')     # luafilesystem
+        self.module_test('lxp')     # luaexpat
+        self.module_test('socket')  # luasocket
+        self.module_test('ssl')     # luasec
+
+    def prosody_test(self):
+        # prosody was launched as service
+        cmd = "prosodyctl status"
+        output, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+        self.assertIn("Prosody is running", output[0])
+
+
+class TestProsodyLua51(TestProsody):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUA=y
+        BR2_PACKAGE_LUA_5_1=y
+        BR2_PACKAGE_PROSODY=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.version_test('Lua 5.1')
+        self.g_version_test('Lua 5.1')
+        self.lua_dependencies_test()
+        self.prosody_test()
+
+
+class TestProsodyLuajit(TestProsody):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUAJIT=y
+        BR2_PACKAGE_PROSODY=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.version_test('LuaJIT 2')
+        self.g_version_test('Lua 5.1')
+        self.lua_dependencies_test()
+        self.prosody_test()
-- 
2.17.1

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

* [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies
  2018-11-24  9:07 [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Francois Perrad
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 1/3] support/testing: add lua test Francois Perrad
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 2/3] support/testing; add prosody test Francois Perrad
@ 2018-11-24  9:07 ` Francois Perrad
  2018-11-27  2:29   ` Ricardo Martincoski
  2018-12-06 22:11 ` [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Thomas Petazzoni
  3 siblings, 1 reply; 10+ messages in thread
From: Francois Perrad @ 2018-11-24  9:07 UTC (permalink / raw)
  To: buildroot

prosody is not available for Lua 5.3, but only 5.1 & 5.2.

prosody needs the module BitOp which is included in LuaJIT

note: the actual config is working only LuaJIT
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/prosody/Config.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/prosody/Config.in b/package/prosody/Config.in
index 133b0b134..c32ca20e2 100644
--- a/package/prosody/Config.in
+++ b/package/prosody/Config.in
@@ -2,7 +2,9 @@ config BR2_PACKAGE_PROSODY
 	bool "prosody"
 	depends on BR2_USE_MMU # fork
 	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
+	depends on !BR2_PACKAGE_LUA_5_3
 	depends on !BR2_STATIC_LIBS # luaexpat, luasec, luasocket, luafilesystem
+	select BR2_PACKAGE_LUABITOP if !BR2_PACKAGE_LUAJIT # runtime
 	select BR2_PACKAGE_LUAEXPAT # runtime
 	select BR2_PACKAGE_LUASEC # runtime
 	select BR2_PACKAGE_LUASOCKET # runtime
@@ -19,3 +21,6 @@ config BR2_PACKAGE_PROSODY
 comment "prosody needs the lua interpreter, dynamic library"
 	depends on !BR2_PACKAGE_HAS_LUAINTERPRETER || BR2_STATIC_LIBS
 	depends on BR2_USE_MMU
+
+comment "prosody needs a Lua 5.1/5.2 interpreter"
+	depends on BR2_PACKAGE_LUA_5_3
-- 
2.17.1

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

* [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies Francois Perrad
@ 2018-11-27  2:29   ` Ricardo Martincoski
  0 siblings, 0 replies; 10+ messages in thread
From: Ricardo Martincoski @ 2018-11-27  2:29 UTC (permalink / raw)
  To: buildroot

Hello,

I was reviewing/testing your test cases and I noticed in the cover letter [1]:
"note2: the patch 3/3 is a fix, and must be applied also in master"

+ Dushara (from 'utils/get-developers -f package/prosody/Config.in')
+ maintainers, to better decide whether it goes to master or it waits the
  release and later gets backported

I kept the full patch below.

[1] http://patchwork.ozlabs.org/cover/1002643/

On Sat, Nov 24, 2018 at 07:07 AM, Francois Perrad wrote:

> prosody is not available for Lua 5.3, but only 5.1 & 5.2.
> 
> prosody needs the module BitOp which is included in LuaJIT
> 
> note: the actual config is working only LuaJIT
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
>  package/prosody/Config.in | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/package/prosody/Config.in b/package/prosody/Config.in
> index 133b0b134..c32ca20e2 100644
> --- a/package/prosody/Config.in
> +++ b/package/prosody/Config.in
> @@ -2,7 +2,9 @@ config BR2_PACKAGE_PROSODY
>  	bool "prosody"
>  	depends on BR2_USE_MMU # fork
>  	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
> +	depends on !BR2_PACKAGE_LUA_5_3
>  	depends on !BR2_STATIC_LIBS # luaexpat, luasec, luasocket, luafilesystem
> +	select BR2_PACKAGE_LUABITOP if !BR2_PACKAGE_LUAJIT # runtime
>  	select BR2_PACKAGE_LUAEXPAT # runtime
>  	select BR2_PACKAGE_LUASEC # runtime
>  	select BR2_PACKAGE_LUASOCKET # runtime
> @@ -19,3 +21,6 @@ config BR2_PACKAGE_PROSODY
>  comment "prosody needs the lua interpreter, dynamic library"
>  	depends on !BR2_PACKAGE_HAS_LUAINTERPRETER || BR2_STATIC_LIBS
>  	depends on BR2_USE_MMU
> +
> +comment "prosody needs a Lua 5.1/5.2 interpreter"
> +	depends on BR2_PACKAGE_LUA_5_3
> -- 


Regards,
Ricardo

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

* [Buildroot] [PATCH/next 2/3] support/testing; add prosody test
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 2/3] support/testing; add prosody test Francois Perrad
@ 2018-11-27  2:42   ` Ricardo Martincoski
  2018-11-27  4:52     ` François Perrad
  0 siblings, 1 reply; 10+ messages in thread
From: Ricardo Martincoski @ 2018-11-27  2:42 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, Nov 24, 2018 at 07:07 AM, Francois Perrad wrote:

> +    def prosody_test(self):
> +        # prosody was launched as service
> +        cmd = "prosodyctl status"
> +        output, exit_code = self.emulator.run(cmd)
> +        self.assertEqual(exit_code, 0)
> +        self.assertIn("Prosody is running", output[0])

I get an error message before the expected string:

# prosodyctl status
certmanager         error       SSL/TLS: Error initialising for client_https port 0: unknown elliptic curve in "X25519:P-384:P-256:P-521"
Prosody is running with PID 727
#

https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/125808115

I don't know if this message is expected in this minimal config or not.
If it is expected, we could add a comment and run something like this:
        self.assertIn("Prosody is running", output[1])

Any ideas?


Regards,
Ricardo

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

* [Buildroot] [PATCH/next 2/3] support/testing; add prosody test
  2018-11-27  2:42   ` Ricardo Martincoski
@ 2018-11-27  4:52     ` François Perrad
  2018-11-28  2:13       ` Ricardo Martincoski
  0 siblings, 1 reply; 10+ messages in thread
From: François Perrad @ 2018-11-27  4:52 UTC (permalink / raw)
  To: buildroot

Le mar. 27 nov. 2018 ? 03:43, Ricardo Martincoski <
ricardo.martincoski@gmail.com> a ?crit :

> Hello,
>
> On Sat, Nov 24, 2018 at 07:07 AM, Francois Perrad wrote:
>
> > +    def prosody_test(self):
> > +        # prosody was launched as service
> > +        cmd = "prosodyctl status"
> > +        output, exit_code = self.emulator.run(cmd)
> > +        self.assertEqual(exit_code, 0)
> > +        self.assertIn("Prosody is running", output[0])
>
> I get an error message before the expected string:
>
> # prosodyctl status
> certmanager         error       SSL/TLS: Error initialising for
> client_https port 0: unknown elliptic curve in "X25519:P-384:P-256:P-521"
> Prosody is running with PID 727
> #
>
> https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/125808115
>
> I don't know if this message is expected in this minimal config or not.
> If it is expected, we could add a comment and run something like this:
>         self.assertIn("Prosody is running", output[1])
>
> Any ideas?
>
>
We use the same "minimal" config.
We have a reproductibility issue.
I run test_prosody on my local box : "Prosody is running" is in output[0]
You run the same test in Gitlab CI : "Prosody is running" is in output[1]

Could you try to run the test locally ?

Fran?ois


>
> Regards,
> Ricardo_______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181127/b999f5fb/attachment.html>

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

* [Buildroot] [PATCH/next 2/3] support/testing; add prosody test
  2018-11-27  4:52     ` François Perrad
@ 2018-11-28  2:13       ` Ricardo Martincoski
  0 siblings, 0 replies; 10+ messages in thread
From: Ricardo Martincoski @ 2018-11-28  2:13 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, Nov 27, 2018 at 02:52 AM, Fran?ois Perrad wrote:

> Le mar. 27 nov. 2018 ? 03:43, Ricardo Martincoski <
> ricardo.martincoski at gmail.com> a ?crit :
>>
>> On Sat, Nov 24, 2018 at 07:07 AM, Francois Perrad wrote:
>>
>> > +    def prosody_test(self):
>> > +        # prosody was launched as service
>> > +        cmd = "prosodyctl status"
>> > +        output, exit_code = self.emulator.run(cmd)
>> > +        self.assertEqual(exit_code, 0)
>> > +        self.assertIn("Prosody is running", output[0])
>>
>> I get an error message before the expected string:
>>
>> # prosodyctl status
>> certmanager         error       SSL/TLS: Error initialising for
>> client_https port 0: unknown elliptic curve in "X25519:P-384:P-256:P-521"
>> Prosody is running with PID 727
>> #
>>
>> https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/125808115
>>
>> I don't know if this message is expected in this minimal config or not.
>> If it is expected, we could add a comment and run something like this:
>>         self.assertIn("Prosody is running", output[1])
>>
>> Any ideas?
>>
>>
> We use the same "minimal" config.
> We have a reproductibility issue.
> I run test_prosody on my local box : "Prosody is running" is in output[0]
> You run the same test in Gitlab CI : "Prosody is running" is in output[1]
> 
> Could you try to run the test locally ?

Sure.

Calling run-tests locally (based on next branch 06a2d67c) also generates the
same error message and displays "Prosody is running" is in output[1]

But then I rebased the tests to the master branch (1209eb2d) and called
run-tests locally.
No error message and "Prosody is running" is in output[0]
And the same good result (based on master) on the GitLab CI
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/126437379

So it looks something related to the next branch.

Finally I merged master to next+tests and the test case passes.
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/126443939

So it looks something already fixed on master branch.

And I can add my tags to your patches (not today due to the lack of time).
Sorry for the noise.


Regards,
Ricardo

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

* [Buildroot] [PATCH/next 1/3] support/testing: add lua test
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 1/3] support/testing: add lua test Francois Perrad
@ 2018-12-04  4:13   ` Ricardo Martincoski
  0 siblings, 0 replies; 10+ messages in thread
From: Ricardo Martincoski @ 2018-12-04  4:13 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, Nov 24, 2018 at 07:07 AM, Francois Perrad wrote:

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

Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
[with the entire series applied:
 https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/129168829
 https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/129168830]
Tested-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>


Regards,
Ricardo

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

* [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends
  2018-11-24  9:07 [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Francois Perrad
                   ` (2 preceding siblings ...)
  2018-11-24  9:07 ` [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies Francois Perrad
@ 2018-12-06 22:11 ` Thomas Petazzoni
  3 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2018-12-06 22:11 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, 24 Nov 2018 10:07:51 +0100, Francois Perrad wrote:

> Francois Perrad (3):
>   support/testing: add lua test
>   support/testing; add prosody test
>   prosody: fix runtime dependencies

Series applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2018-12-06 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-24  9:07 [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Francois Perrad
2018-11-24  9:07 ` [Buildroot] [PATCH/next 1/3] support/testing: add lua test Francois Perrad
2018-12-04  4:13   ` Ricardo Martincoski
2018-11-24  9:07 ` [Buildroot] [PATCH/next 2/3] support/testing; add prosody test Francois Perrad
2018-11-27  2:42   ` Ricardo Martincoski
2018-11-27  4:52     ` François Perrad
2018-11-28  2:13       ` Ricardo Martincoski
2018-11-24  9:07 ` [Buildroot] [PATCH/next 3/3] prosody: fix runtime dependencies Francois Perrad
2018-11-27  2:29   ` Ricardo Martincoski
2018-12-06 22:11 ` [Buildroot] [PATCH/next 0/3] suppport/testing: Lua and friends Thomas Petazzoni

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