systemd/upower: upgrade to 1.90.6 (MR 5917) (MR 5563)

308623fbd6

28a8750c5e

40b203a22d

c9c25690f4
This commit is contained in:
fossdd 2024-12-17 22:19:00 +01:00 committed by Oliver Smith
parent ed17e7224f
commit cd221c7092
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 303 additions and 3 deletions

View file

@ -0,0 +1,157 @@
# https://gitlab.freedesktop.org/upower/upower/-/issues/289
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index 6b1514a..885df07 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -1072,68 +1072,6 @@ class Tests(dbusmock.DBusTestCase):
with open(f'/sys/class/power_supply/{battery_name}/charge_control_end_threshold') as fp:
self.assertEqual(fp.read(), '80')
- def test_battery_charge_limit_multiple_batteries_polkit_not_allowed(self):
- '''Battery with charge limits with multiple batteries, but polkit isn't allowed'''
-
- if not self.polkit:
- self.start_polkitd({})
-
- self.testbed.add_device('power_supply', 'BAT0', None,
- ['type', 'Battery',
- 'present', '1',
- 'status', 'unknown',
- 'energy_full', '60000000',
- 'energy_full_design', '80000000',
- 'energy_now', '48000000',
- 'voltage_now', '12000000',
- 'charge_control_start_threshold', '0',
- 'charge_control_end_threshold', '100',
- ], [])
- self.testbed.set_property("/sys/class/power_supply/BAT0", 'CHARGE_LIMIT', '70,80')
-
- self.testbed.add_device('power_supply', 'BAT1', None,
- ['type', 'Battery',
- 'present', '1',
- 'status', 'unknown',
- 'energy_full', '60000000',
- 'energy_full_design', '80000000',
- 'energy_now', '48000000',
- 'voltage_now', '12000000',
- 'charge_control_start_threshold', '0',
- 'charge_control_end_threshold', '100',
- ], [])
- self.testbed.set_property("/sys/class/power_supply/BAT1", 'CHARGE_LIMIT', '70,80')
-
- self.start_daemon()
- devs = self.proxy.EnumerateDevices()
- self.assertEqual(len(devs), 2)
- bat0_up = devs[0]
- bat1_up = devs[0]
-
- for bat in [bat0_up, bat1_up]:
- self.assertEqual(self.get_dbus_dev_property(bat, 'ChargeThresholdSupported'), True)
- self.assertEqual(self.get_dbus_dev_property(bat, 'ChargeThresholdEnabled'), False)
- self.assertEqual(self.get_dbus_dev_property(bat, 'ChargeStartThreshold'), 70)
- self.assertEqual(self.get_dbus_dev_property(bat, 'ChargeEndThreshold'), 80)
-
- with self.assertRaises(Exception) as cm:
- self.enable_charge_limits(bat0_up, True)
- ex = cm.exception
- self.assertIn("Operation is not allowed", str(ex))
-
- with self.assertRaises(Exception) as cm:
- self.enable_charge_limits(bat1_up, True)
- ex = cm.exception
- self.assertIn("Operation is not allowed", str(ex))
-
- for bat in [bat0_up, bat1_up]:
- self.assertEqual(self.get_dbus_dev_property(bat, 'ChargeThresholdEnabled'), False)
- battery_name = bat.split('_')[-1]
- with open(f'/sys/class/power_supply/{battery_name}/charge_control_start_threshold') as fp:
- self.assertEqual(fp.read(), '0')
- with open(f'/sys/class/power_supply/{battery_name}/charge_control_end_threshold') as fp:
- self.assertEqual(fp.read(), '100')
-
def test_battery_charge_limit_supported(self):
'''Battery with charge_control_start/end_threshold supported'''
@@ -1211,82 +1149,6 @@ class Tests(dbusmock.DBusTestCase):
with open('/sys/class/power_supply/BAT0/charge_control_end_threshold') as fp:
self.assertEqual(fp.read(), '100')
- def test_battery_charge_limit_supported_polkit_not_allowed(self):
- '''Battery with charge_control_start/end_threshold supported'''
-
- if not self.polkit:
- self.start_polkitd({})
-
- self.testbed.add_device('power_supply', 'BAT0', None,
- ['type', 'Battery',
- 'present', '1',
- 'model_name', 'test',
- 'serial_number', '12',
- 'status', 'unknown',
- 'energy_full', '60000000',
- 'energy_full_design', '80000000',
- 'energy_now', '48000000',
- 'voltage_now', '12000000',
- 'charge_control_start_threshold', '0',
- 'charge_control_end_threshold', '100',
- ], [])
- self.testbed.set_property("/sys/class/power_supply/BAT0", 'CHARGE_LIMIT', '70,80')
-
- def start_daemon(charge_threshold_value=None):
- upower_history_dir_override = tempfile.mkdtemp(prefix='upower-history-')
- if charge_threshold_value is not None:
- with open(os.path.join(upower_history_dir_override, "charging-threshold-status") , 'w') as fp:
- fp.write(charge_threshold_value)
-
- self.start_daemon(history_dir_override=upower_history_dir_override)
- devs = self.proxy.EnumerateDevices()
- self.assertEqual(len(devs), 1)
- return devs[0]
-
- bat0_up = start_daemon()
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdSupported'), True)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdEnabled'), False)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeStartThreshold'), 70)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeEndThreshold'), 80)
-
- with self.assertRaises(Exception) as cm:
- self.enable_charge_limits(bat0_up, True)
- ex = cm.exception
- self.assertIn("Operation is not allowed", str(ex))
-
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdEnabled'), False)
- # charge limits enabled?
- with open('/sys/class/power_supply/BAT0/charge_control_start_threshold') as fp:
- self.assertEqual(fp.read(), '0')
- with open('/sys/class/power_supply/BAT0/charge_control_end_threshold') as fp:
- self.assertEqual(fp.read(), '100')
-
- with self.assertRaises(Exception) as cm:
- self.enable_charge_limits(bat0_up, False)
- ex = cm.exception
- self.assertIn("Operation is not allowed", str(ex))
-
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdEnabled'), False)
- with open('/sys/class/power_supply/BAT0/charge_control_start_threshold') as fp:
- self.assertEqual(fp.read(), '0')
- with open('/sys/class/power_supply/BAT0/charge_control_end_threshold') as fp:
- self.assertEqual(fp.read(), '100')
-
- self.stop_daemon()
-
- # On startup with threshold set
- self.testbed.set_property("/sys/class/power_supply/BAT0", 'CHARGE_LIMIT', '90,100')
- bat0_up = start_daemon(charge_threshold_value='1')
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdSupported'), True)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeThresholdEnabled'), True)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeStartThreshold'), 90)
- self.assertEqual(self.get_dbus_dev_property(bat0_up, 'ChargeEndThreshold'), 100)
-
- with open('/sys/class/power_supply/BAT0/charge_control_start_threshold') as fp:
- self.assertEqual(fp.read(), '90')
- with open('/sys/class/power_supply/BAT0/charge_control_end_threshold') as fp:
- self.assertEqual(fp.read(), '100')
-
def test_battery_charge_threshold_unsupported(self):
'''Battery with only start_threshold supported'''

View file

@ -0,0 +1,26 @@
From 9ee76826bd41a5d3a377dfd6f5835f42ec50be9a Mon Sep 17 00:00:00 2001
From: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>
Date: Wed, 25 Sep 2024 16:56:11 +0100
Subject: [PATCH] Fix race condition in test_sibling_priority_no_overwrite
---
src/linux/integration-test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index 6b1514a9..f6c804a4 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -3148,8 +3148,8 @@ class Tests(dbusmock.DBusTestCase):
def test_sibling_priority_no_overwrite(self):
'Test siblings using the fallback device do not overwrite previous guesses'
- self.start_daemon()
self.testbed.add_from_file(os.path.join(edir, 'tests/wacom-pen-digitiser.device'))
+ self.start_daemon()
self.assertDevs({
'battery_wacom_battery_0': {
--
GitLab

View file

@ -0,0 +1,13 @@
# https://gitlab.freedesktop.org/upower/upower/-/issues/228
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index e23b87c..4cdefa8 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -2715,6 +2715,7 @@ class Tests(dbusmock.DBusTestCase):
bat0_up = devs[0]
# Check we have the Bluetooth name
+ self.assertEventually(lambda: self.get_dbus_dev_property(bat0_up, 'Model'), value=alias)
self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Model'), alias)
# Check we have the kernel percentage
self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Percentage'), 30)

View file

@ -0,0 +1,79 @@
# longaarch64 only - related issue: https://gitlab.freedesktop.org/upower/upower/-/issues/195
diff --git a/src/up-self-test.c b/src/up-self-test.c
index f60618f..3f39c12 100644
--- a/src/up-self-test.c
+++ b/src/up-self-test.c
@@ -172,20 +172,20 @@ up_test_history_func (void)
up_history_set_time_empty_data (history, 12346);
up_history_set_time_full_data (history, 54322);
- g_usleep (2 * G_USEC_PER_SEC);
+ g_usleep (5 * G_USEC_PER_SEC);
up_history_set_charge_data (history, 90);
up_history_set_rate_data (history, 1.00f);
up_history_set_time_empty_data (history, 12345);
up_history_set_time_full_data (history, 54321);
- g_usleep (2 * G_USEC_PER_SEC);
+ g_usleep (5 * G_USEC_PER_SEC);
up_history_set_charge_data (history, 95);
up_history_set_rate_data (history, 1.01f);
up_history_set_time_empty_data (history, 12344);
up_history_set_time_full_data (history, 54320);
- /* get data for last 10 seconds */
- array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 10, 100);
+ /* get data for last 20 seconds */
+ array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 20, 100);
g_assert (array != NULL);
g_assert_cmpint (array->len, ==, 3);
@@ -212,7 +212,7 @@ up_test_history_func (void)
/* request fewer items than we have in our history; should have the
* same order: first one is the most recent, and the data gets
* interpolated */
- array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 10, 2);
+ array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 20, 2);
g_assert (array != NULL);
g_assert_cmpint (array->len, ==, 2);
@@ -242,8 +242,8 @@ up_test_history_func (void)
up_history_set_directory (history, history_dir);
up_history_set_id (history, "test");
- /* get data for last 10 seconds */
- array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 10, 100);
+ /* get data for last 20 seconds */
+ array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 20, 100);
g_assert (array != NULL);
g_assert_cmpint (array->len, ==, 4); /* we have inserted an unknown as the first entry */
item = g_ptr_array_index (array, 1);
@@ -253,17 +253,23 @@ up_test_history_func (void)
g_ptr_array_unref (array);
/* ensure old entries are purged */
- up_history_set_max_data_age (history, 2);
- g_usleep (1100 * G_USEC_PER_SEC / 1000);
+ up_history_set_max_data_age (history, 5);
+ g_usleep (G_USEC_PER_SEC);
g_object_unref (history);
- /* ensure only 2 points are returned */
+ /* ensure only 2 points are returned (the two inserted UNKNOWN state points are compressed) */
history = up_history_new ();
up_history_set_directory (history, history_dir);
up_history_set_id (history, "test");
- array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 10, 100);
+ array = up_history_get_data (history, UP_HISTORY_TYPE_CHARGE, 20, 100);
g_assert (array != NULL);
g_assert_cmpint (array->len, ==, 2);
+
+ item = g_ptr_array_index (array, 0);
+ g_assert_cmpint (up_history_item_get_value (item), ==, 0);
+ item = g_ptr_array_index (array, 1);
+ g_assert_cmpint (up_history_item_get_value (item), ==, 0);
+
g_ptr_array_unref (array);
/* unref */

View file

@ -0,0 +1,14 @@
# longaarch64 only - https://gitlab.freedesktop.org/upower/upower/-/issues/290
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index 4cdefa8..70fbad6 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -243,7 +243,7 @@ class Tests(dbusmock.DBusTestCase):
except OSError:
pass
try:
- self.assertEqual(self.daemon.wait(timeout=5.0), 0)
+ self.assertEqual(self.daemon.wait(timeout=10.0), 0)
except subprocess.TimeoutExpired:
try:
self.daemon.kill()

View file

@ -2,8 +2,8 @@
pkgname=upower
pkgver=9999
_pkgver=1.90.2
pkgrel=3
_pkgver=1.90.6
pkgrel=4
pkgdesc="Power Management Services"
url="https://upower.freedesktop.org"
arch="all"
@ -28,6 +28,11 @@ checkdepends="
"
subpackages="$pkgname-dev $pkgname-lang $pkgname-doc $pkgname-systemd"
source="https://gitlab.freedesktop.org/upower/upower/-/archive/v$_pkgver/upower-v$_pkgver.tar.bz2
0001-disable-test-charge-control-polkit.patch
0002-fix-test-sibling-priority-no-overwrite.patch
0003-fix-race-test-bluetooth-mouse.patch
0004-fix-self-test-sleep-duration.patch
0005-fix-test-charge-cycles.patch
"
builddir="$srcdir/$pkgname-v$_pkgver"
@ -46,6 +51,7 @@ build() {
-Dudevhwdbdir=/usr/lib/udev/hwdb.d/ \
-Dudevrulesdir=/usr/lib/udev/rules.d \
-Dsystemdsystemunitdir=/usr/lib/systemd/system \
-Dman=true \
. output
meson compile -C output
}
@ -59,5 +65,10 @@ package() {
}
sha512sums="
9cdaea76d604e79bb385c2d7d8df26ab74d8fbbd5ddd271d7dc3323ae4f98ce9504ce807638e008869fdec0e1fcaf8d4be53e486714913616b8df73d8e4ac396 upower-v1.90.2.tar.bz2
8ac1c0685b73efece0ecfbee7a37cb7c47601d252210cf3ecc32d1e44cabdde4c8b59b9a93d8bf21e25b3ecbbb95fb952958b37a53f878128747231d4334e5a6 upower-v1.90.6.tar.bz2
01afab0fefc2fbcf6b49cec2ab07ce1b37fe7c35c3fc23e983b7206d2b37e4f9d564f4dd46dce8cb32ddd1f36d534adea8703fb8bbe8c80c7c8fd0fcd716ca7a 0001-disable-test-charge-control-polkit.patch
6c7df958e6841a0799f31c8bb8d6dffa431c336ac13dab3141e3a90d4f11a6d5c6e10ab653f039aae0029552ba05417b6d2d4b4829b1444880f58e1b74446fa1 0002-fix-test-sibling-priority-no-overwrite.patch
d8403210f1f5bb87d3a77498fd1d6684327aed8a624d4c2606dc07882450552ab14fbd5fec3f0b7c409bb09a248d563a140a18cb1c8f91b8a55c2f6d72d01adb 0003-fix-race-test-bluetooth-mouse.patch
1b582f31660b82444682b6786913a6eb4e8e13c8370205b31da1bf9328e0d2e62c2596bfb4e82faf25e658f379ddb92d7f3f97ec8ddfdb512339d4d3d663f708 0004-fix-self-test-sleep-duration.patch
860c8592a11ea760e01842986e3d83dfd547ec09411c61201500e773af1abba28e9e8ac04be2c9d0940097da4cbdfda7e3b6dce8df19ee88ade67ad6a9a8aa72 0005-fix-test-charge-cycles.patch
"