Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test
@ 2024-04-21 11:31 Julien Olivain
  2024-07-22 20:21 ` Thomas Petazzoni via buildroot
  2024-08-31 14:20 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-04-21 11:31 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                |  1 +
 support/testing/tests/package/test_4th.py | 55 +++++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 support/testing/tests/package/test_4th.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..cabb181d758 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1768,6 +1768,7 @@ F:	support/testing/tests/package/sample_python_midiutil.py
 F:	support/testing/tests/package/sample_python_ml_dtypes.py
 F:	support/testing/tests/package/sample_python_pyalsa.py
 F:	support/testing/tests/package/sample_python_spake2.py
+F:	support/testing/tests/package/test_4th.py
 F:	support/testing/tests/package/test_acl.py
 F:	support/testing/tests/package/test_acpica.py
 F:	support/testing/tests/package/test_acpica/
diff --git a/support/testing/tests/package/test_4th.py b/support/testing/tests/package/test_4th.py
new file mode 100644
index 00000000000..c020c825b31
--- /dev/null
+++ b/support/testing/tests/package/test_4th.py
@@ -0,0 +1,55 @@
+import os
+from math import sqrt
+
+import infra.basetest
+
+
+class Test4th(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_4TH=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="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        # We set the DIR4TH variable where 4th demos and libraries are
+        # installed.
+        self.assertRunOk("export DIR4TH=/usr/share/4th/")
+
+        # We run a simple "hello world" demo.
+        out, ret = self.emulator.run("4th cxq demo/hello.4th")
+        self.assertEqual(ret, 0)
+        self.assertEqual(out[0], "Hello world!")
+
+        # We run a demo doing some square root maths.
+        out, ret = self.emulator.run("4th cxq demo/squares.4th")
+        self.assertEqual(ret, 0)
+        self.assertTrue(len(out) > 1)
+        for line in out[1:]:
+            columns = line.split()
+            value = float(columns[0])
+            value_sqrt = float(columns[1])
+            result_check = sqrt(value)
+            self.assertAlmostEqual(value_sqrt, result_check, delta=0.1)
+
+        # We run a word count demo and the 4th source file. We save
+        # the word count for a later check.
+        out, ret = self.emulator.run("4th cxq wc.4th /usr/share/4th/wc.4th")
+        self.assertEqual(ret, 0)
+        wc_out = out[0].split()
+
+        # We run the same command using system "wc" command. We expect
+        # the same numbers.
+        out, ret = self.emulator.run("wc /usr/share/4th/wc.4th")
+        self.assertEqual(ret, 0)
+        self.assertEqual(out[0].split(), wc_out)
+
+        # We run a slightly more complex computation example.
+        self.assertRunOk("4th cxq fractals.4th")
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test
  2024-04-21 11:31 [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test Julien Olivain
@ 2024-07-22 20:21 ` Thomas Petazzoni via buildroot
  2024-08-31 14:20 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-22 20:21 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Sun, 21 Apr 2024 13:31:20 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                |  1 +
>  support/testing/tests/package/test_4th.py | 55 +++++++++++++++++++++++
>  2 files changed, 56 insertions(+)
>  create mode 100644 support/testing/tests/package/test_4th.py

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test
  2024-04-21 11:31 [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test Julien Olivain
  2024-07-22 20:21 ` Thomas Petazzoni via buildroot
@ 2024-08-31 14:20 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-08-31 14:20 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

>>>>> "Julien" == Julien Olivain <ju.o@free.fr> writes:

 > Signed-off-by: Julien Olivain <ju.o@free.fr>

Committed to 2024.02.x and 2024.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-08-31 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-21 11:31 [Buildroot] [PATCH 1/1] support/testing: add 4th runtime test Julien Olivain
2024-07-22 20:21 ` Thomas Petazzoni via buildroot
2024-08-31 14:20 ` Peter Korsgaard

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