iio-sensor-proxy: update to 3.5.

This commit is contained in:
fanyx 2024-04-20 22:21:39 +02:00 committed by oreo639
parent 9bc34e1fd6
commit 0916f8924e
2 changed files with 104 additions and 7 deletions

View file

@ -0,0 +1,101 @@
From fe56bdba1243cc5f6a652eb75d11ae1d1957ff7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Mon, 4 Mar 2024 08:18:54 +0100
Subject: [PATCH] tests: Skip some test when fr_FR locale isn't available
Some test require that locale so skip those when it is unavailable.
Closes: #392
---
src/test-mount-matrix.c | 8 ++++++--
tests/integration-test.py | 20 +++++++++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/test-mount-matrix.c b/src/test-mount-matrix.c
index 0cf6c34..d0b608c 100644
--- a/src/test-mount-matrix.c
+++ b/src/test-mount-matrix.c
@@ -66,12 +66,16 @@ test_mount_matrix (void)
static void
test_comma_decimal_separator (void)
{
+ const char *fr_locale = "fr_FR.UTF-8";
char *old_locale;
AccelVec3 *vecs;
- old_locale = setlocale (LC_ALL, "fr_FR.UTF-8");
+ old_locale = setlocale (LC_ALL, fr_locale);
/* French locale not available? */
- g_assert_nonnull (old_locale);
+ if (!old_locale) {
+ g_test_skip_printf ("Local %s not available", fr_locale);
+ return;
+ }
/* Default matrix */
g_assert_true (parse_mount_matrix (DEFAULT_MATRIX, &vecs));
diff --git a/tests/integration-test.py b/tests/integration-test.py
index 20c0e92..4ccabb3 100755
--- a/tests/integration-test.py
+++ b/tests/integration-test.py
@@ -27,6 +27,7 @@ import tempfile
import psutil
import subprocess
import unittest
+import locale
import time
try:
@@ -50,6 +51,7 @@ SP_COMPASS = 'net.hadess.SensorProxy.Compass'
SP_COMPASS_PATH = '/net/hadess/SensorProxy/Compass'
class Tests(dbusmock.DBusTestCase):
+
@classmethod
def setUpClass(cls):
# run from local build tree if we are in one, otherwise use system instance
@@ -92,6 +94,15 @@ class Tests(dbusmock.DBusTestCase):
cls.dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
cls.dbus_con = cls.get_dbus(True)
+ # Some test outputs require the daemon to run under the fr locale:
+ # so check if that's available
+ try:
+ old_loc = locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
+ cls.has_fr = True
+ locale.setlocale(locale.LC_ALL, old_loc)
+ except:
+ cls.has_fr = False
+
@classmethod
def tearDownClass(cls):
cls.test_bus.down()
@@ -612,10 +623,9 @@ class Tests(dbusmock.DBusTestCase):
mock_file.write(data)
self.proxy.ClaimAccelerometer()
self.assertEventually(lambda: self.have_text_in_log('Accel sent by driver'))
- # If the 2nd test fails, it's likely that fr_FR.UTF-8 locale isn't supported
self.assertEqual(self.have_text_in_log('scale: 0,000000,0,000000,0,000000'), False)
- self.assertEqual(self.have_text_in_log('scale: 0,000010,0,000010,0,000010'), True)
-
+ if self.has_fr:
+ self.assertEqual(self.have_text_in_log('scale: 0,000010,0,000010,0,000010'), True)
self.stop_daemon()
def test_iio_scale_decimal_separator_offset(self):
@@ -715,9 +725,9 @@ class Tests(dbusmock.DBusTestCase):
self.proxy.ClaimAccelerometer()
self.assertEventually(lambda: self.have_text_in_log('Accel read from IIO on'))
- # If the 2nd test fails, it's likely that fr_FR.UTF-8 locale isn't supported
self.assertEqual(self.have_text_in_log('scale 1,000000,1,000000,1,000000'), False)
- self.assertEqual(self.have_text_in_log('scale 0,000001,0,000001,0,000001'), True)
+ if self.has_fr:
+ self.assertEqual(self.have_text_in_log('scale 0,000001,0,000001,0,000001'), True)
self.assertEventually(lambda: self.get_dbus_property('AccelerometerOrientation') == 'normal')
--
GitLab

View file

@ -1,6 +1,6 @@
# Template file for 'iio-sensor-proxy'
pkgname=iio-sensor-proxy
version=3.4
version=3.5
revision=1
build_style=meson
configure_args="-Dsystemdsystemunitdir=/usr/lib/systemd/system/
@ -14,18 +14,14 @@ license="GPL-3.0-or-later"
homepage="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy"
changelog="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/raw/master/NEWS"
distfiles="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/archive/${version}/${pkgname}-${version}.tar.gz"
checksum=9339af3bc83994a43ab25231a8ffe9ada6d9afbc16edc44d575dd9f2a69ede3c
checksum=8689425f2287626a95d95b1e1e5b62e497d09dd08cf411084ed22166d4a49da5
if [ "$XBPS_CHECK_PKGS" ]; then
configure_args+=" -Dtests=true -Dgtk-tests=true"
fi
post_patch() {
# Tests expect a fr_FR.UTF-8 locale
vsed -i -e "/env\['LC_NUMERIC'\]/d" tests/integration-test.py
vsed -i -e 's/scale: 0,000010,0,000010,0,000010/scale: 0.000010,0.000010,0.000010/g' \
-e 's/scale 0,000001,0,000001,0,000001/scale 0.000001,0.000001,0.000001/g' \
tests/integration-test.py
vsed -i -e 's/cls.has_fr = True/cls.has_fr = False/' tests/integration-test.py
}
post_install() {