buildroot.buildroot.org archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing: test_erlang: new runtime test
@ 2026-09-05 14:45 Julien Olivain via buildroot
  2026-09-16 21:28 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain via buildroot @ 2026-09-05 14:45 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested in:
https://gitlab.com/jolivain/buildroot/-/jobs/16325100707
---
 DEVELOPERS                                   |  1 +
 support/testing/tests/package/test_erlang.py | 48 ++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 support/testing/tests/package/test_erlang.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 1fd93b1de5..4b8d8155b8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1903,6 +1903,7 @@ F:	support/testing/tests/package/test_dosfstools.py
 F:	support/testing/tests/package/test_dosfstools/
 F:	support/testing/tests/package/test_dpdk.py
 F:	support/testing/tests/package/test_ed.py
+F:	support/testing/tests/package/test_erlang.py
 F:	support/testing/tests/package/test_ethtool.py
 F:	support/testing/tests/package/test_ethtool/
 F:	support/testing/tests/package/test_exfatprogs.py
diff --git a/support/testing/tests/package/test_erlang.py b/support/testing/tests/package/test_erlang.py
new file mode 100644
index 0000000000..a765cec843
--- /dev/null
+++ b/support/testing/tests/package/test_erlang.py
@@ -0,0 +1,48 @@
+import os
+
+import infra.basetest
+
+
+class TestErlang(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_ERLANG=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="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        # We check the program can execute.
+        self.assertRunOk("erl -version")
+
+        # We check can print a message from the command line.
+        msg = "Hello Buildroot!"
+        erl_expr = f"io:format(\"{msg}~n\"), halt()."
+        cmd = f"erl -noshell -eval '{erl_expr}'"
+        out, ret = self.emulator.run(cmd)
+        self.assertEqual(ret, 0)
+        self.assertEqual(out[0], msg)
+
+        # We check we can exit with a specific code.
+        exit_code = 123
+        erl_expr = f"halt({exit_code})."
+        cmd = f"erl -noshell -eval '{erl_expr}'"
+        out, ret = self.emulator.run(cmd)
+        self.assertEqual(ret, exit_code)
+        self.assertEqual(len(out), 0)
+
+        # We check we can do basic arithmetic.
+        val1 = 1234
+        val2 = 5678
+        erl_expr = f"X = {val1} * {val2}, io:format(\"~p~n\", [X]), halt()."
+        cmd = f"erl -noshell -eval '{erl_expr}'"
+        out, ret = self.emulator.run(cmd)
+        self.assertEqual(ret, 0)
+        expected_result = val1 * val2
+        self.assertEqual(int(out[0]), expected_result)
-- 
2.55.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: test_erlang: new runtime test
  2026-09-05 14:45 [Buildroot] [PATCH 1/1] support/testing: test_erlang: new runtime test Julien Olivain via buildroot
@ 2026-09-16 21:28 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-09-16 21:28 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Sat, Sep 05, 2026 at 04:45:48PM +0200, Julien Olivain via buildroot wrote:
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Applied to master, thanks!

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
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:[~2026-09-16 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-05 14:45 [Buildroot] [PATCH 1/1] support/testing: test_erlang: new runtime test Julien Olivain via buildroot
2026-09-16 21:28 ` 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;
as well as URLs for NNTP newsgroup(s).