[gnome-settings-daemon/benzea/brightness-update-ci-issue] tests: Update brightness atomically and wait longer




commit 912c9c2bab42ea8f83ca8b4da8c24a5cd0552024
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Jul 26 18:10:08 2021 +0200

    tests: Update brightness atomically and wait longer
    
    Sometimes the test_legacy_brightness_rounding seems to fail, in rare
    cases with the brightness file being empty. This is possible in busy CI
    environments due to the short time window (<= 200ms) and because the
    script first truncates the file.
    
    First update the file atomically, to avoid weird errors. Second, delay
    the check a bit more in order to ensure we do not fail in busy CI
    environments.

 plugins/power/test-backlight-helper |  3 ++-
 plugins/power/test.py               | 18 +++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/plugins/power/test-backlight-helper b/plugins/power/test-backlight-helper
index 2dceacd8..e32153b0 100755
--- a/plugins/power/test-backlight-helper
+++ b/plugins/power/test-backlight-helper
@@ -2,4 +2,5 @@
 
 # Simulate a slow call and just write the given brightness value to the device
 sleep 0.2
-echo "$2" >"$1/brightness"
+echo "$2" >"$1/brightness-new"
+mv "$1/brightness-new" "$1/brightness"
diff --git a/plugins/power/test.py b/plugins/power/test.py
index e1d7d5e6..530ab698 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -1187,31 +1187,31 @@ class PowerPluginTest8(PowerPluginBase):
         obj_gsd_power_prop_iface = dbus.Interface(obj_gsd_power, dbus.PROPERTIES_IFACE)
 
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 0)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 0)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 10)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 2)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 20)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 3)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 25)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 4)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 49)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 7)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 50)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 8)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 56)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 8)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 57)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 9)
         obj_gsd_power_prop_iface.Set('org.gnome.SettingsDaemon.Power.Screen', 'Brightness', 98)
-        time.sleep(0.4)
+        time.sleep(0.6)
         self.assertEqual(self.get_brightness(), 15)
 
     def test_no_backlight(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]