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

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                    |  2 +
 support/testing/tests/package/test_gpsd.py    | 56 +++++++++++++++++++
 .../rootfs-overlay/root/udp-nmea.log          |  6 ++
 3 files changed, 64 insertions(+)
 create mode 100644 support/testing/tests/package/test_gpsd.py
 create mode 100644 support/testing/tests/package/test_gpsd/rootfs-overlay/root/udp-nmea.log

diff --git a/DEVELOPERS b/DEVELOPERS
index c4f1565edd..5495f7a3f2 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1870,6 +1870,8 @@ F:	support/testing/tests/package/test_gnuplot.py
 F:	support/testing/tests/package/test_gnuplot/
 F:	support/testing/tests/package/test_gnuradio.py
 F:	support/testing/tests/package/test_gnuradio/
+F:	support/testing/tests/package/test_gpsd.py
+F:	support/testing/tests/package/test_gpsd/
 F:	support/testing/tests/package/test_gzip.py
 F:	support/testing/tests/package/test_highway.py
 F:	support/testing/tests/package/test_hwloc.py
diff --git a/support/testing/tests/package/test_gpsd.py b/support/testing/tests/package/test_gpsd.py
new file mode 100644
index 0000000000..deed586c17
--- /dev/null
+++ b/support/testing/tests/package/test_gpsd.py
@@ -0,0 +1,56 @@
+import os
+import time
+
+import infra.basetest
+
+
+class TestGpsd(infra.basetest.BRTest):
+    rootfs_overlay = \
+        infra.filepath("tests/package/test_gpsd/rootfs-overlay")
+    # This test is using the gpsfake Python script.
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        f"""
+        BR2_PACKAGE_GPSD=y
+        BR2_PACKAGE_PYTHON3=y
+        BR2_ROOTFS_OVERLAY="{rootfs_overlay}"
+        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 check the program can execute.
+        self.assertRunOk("gpsd --version")
+
+        # Since gpsd needs a real GPS device, we stop the service.
+        self.assertRunOk("/etc/init.d/S50gpsd stop")
+
+        # We start the "gpsfake" GPS emulator instead.
+        cmd = "gpsfake"
+        cmd += " --slow --cycle 0.1 --quiet"
+        cmd += "/root/udp-nmea.log &> /dev/null &"
+        self.assertRunOk(cmd)
+
+        # Wait a bit, to let the gpsfake and gpsd to settle...
+        time.sleep(3 * self.timeout_multiplier)
+
+        # List the GPS devices. We should see our local UDP test GPS.
+        out, ret = self.emulator.run("gpsctl")
+        self.assertEqual(ret, 0)
+        self.assertTrue(out[0].startswith("udp://127.0.0.1"))
+        self.assertIn("NMEA0183", out[0])
+
+        # Collect some of our fake GPS data, and check we got the
+        # coordinates from our test data file.
+        # Our expected coordinates are:
+        # https://www.openstreetmap.org/#map=19/43.60439/1.44336
+        out, ret = self.emulator.run("gpscsv --header 0 --count 3")
+        self.assertEqual(ret, 0)
+        _, gps_lat, gps_long, _ = out[0].split(",")
+        self.assertAlmostEqual(float(gps_lat), 43.60439)
+        self.assertAlmostEqual(float(gps_long), 1.44336)
diff --git a/support/testing/tests/package/test_gpsd/rootfs-overlay/root/udp-nmea.log b/support/testing/tests/package/test_gpsd/rootfs-overlay/root/udp-nmea.log
new file mode 100644
index 0000000000..f3730da7c5
--- /dev/null
+++ b/support/testing/tests/package/test_gpsd/rootfs-overlay/root/udp-nmea.log
@@ -0,0 +1,6 @@
+# Name: NMEA 0183 messages for gpsd Buildroot test
+# Transport: UDP
+# For packet format, see:
+# https://gpsd.gitlab.io/gpsd/NMEA.html
+$GPGGA,123456.789,4336.2634,N,0126.6016,E,1,04,1.7,143.5,M,,,,*3A
+$GPZDA,123456.789,20,07,2024,2,00*64
-- 
2.45.2

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

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

* Re: [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing
  2024-07-20 17:38 [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing Julien Olivain
@ 2024-07-20 21:22 ` Thomas Petazzoni via buildroot
  2024-07-22 13:12 ` Thomas Petazzoni via buildroot
  2024-08-29 13:37 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-20 21:22 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Sat, 20 Jul 2024 19:38:34 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                    |  2 +
>  support/testing/tests/package/test_gpsd.py    | 56 +++++++++++++++++++
>  .../rootfs-overlay/root/udp-nmea.log          |  6 ++
>  3 files changed, 64 insertions(+)

Thanks, applied!

> +        # Collect some of our fake GPS data, and check we got the
> +        # coordinates from our test data file.
> +        # Our expected coordinates are:
> +        # https://www.openstreetmap.org/#map=19/43.60439/1.44336

Nice choice of location :-)

Thomas
-- 
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] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing
  2024-07-20 17:38 [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing Julien Olivain
  2024-07-20 21:22 ` Thomas Petazzoni via buildroot
@ 2024-07-22 13:12 ` Thomas Petazzoni via buildroot
  2024-08-29 13:37 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-22 13:12 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot

On Sat, 20 Jul 2024 19:38:34 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                    |  2 +
>  support/testing/tests/package/test_gpsd.py    | 56 +++++++++++++++++++
>  .../rootfs-overlay/root/udp-nmea.log          |  6 ++
>  3 files changed, 64 insertions(+)
>  create mode 100644 support/testing/tests/package/test_gpsd.py
>  create mode 100644 support/testing/tests/package/test_gpsd/rootfs-overlay/root/udp-nmea.log

Our CI is apparently not happy with this new test:

  https://gitlab.com/buildroot.org/buildroot/-/jobs/7391792948

Could you perhaps have a look?

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] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing
  2024-07-20 17:38 [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing Julien Olivain
  2024-07-20 21:22 ` Thomas Petazzoni via buildroot
  2024-07-22 13:12 ` Thomas Petazzoni via buildroot
@ 2024-08-29 13:37 ` Peter Korsgaard
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2024-08-29 13:37 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] 4+ messages in thread

end of thread, other threads:[~2024-08-29 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-20 17:38 [Buildroot] [PATCH 1/1] support/testing: add gpsd runtime testing Julien Olivain
2024-07-20 21:22 ` Thomas Petazzoni via buildroot
2024-07-22 13:12 ` Thomas Petazzoni via buildroot
2024-08-29 13:37 ` Peter Korsgaard

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