[gnome-settings-daemon/benzea/power-test-speedup: 2/2] power: Speed up power test by splitting it into chunks
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/power-test-speedup: 2/2] power: Speed up power test by splitting it into chunks
- Date: Fri, 28 Sep 2018 15:00:52 +0000 (UTC)
commit 638b7931d359b4b811cd4146e2f7f8a2c4887582
Author: Benjamin Berg <bberg redhat com>
Date: Fri Sep 28 16:57:44 2018 +0200
power: Speed up power test by splitting it into chunks
Use a common class and put tests into separate classes. Then create a
meson test for each of these classes so that the multiple jobs can run
in parallel. This significantly speeds up the test run.
plugins/power/meson.build | 25 ++++++++++++++++++-------
plugins/power/test.py | 10 +++++++++-
2 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/plugins/power/meson.build b/plugins/power/meson.build
index 0158a466..7e16f240 100644
--- a/plugins/power/meson.build
+++ b/plugins/power/meson.build
@@ -124,11 +124,22 @@ envs = [
'LD_PRELOAD=libumockdev-preload.so.0',
]
-test(
- 'test-power',
- test_py,
-# args: 'PowerPluginTest.test_sleep_inactive_blank',
- env: envs,
- timeout: 500
-)
+foreach cls : [
+ 'PowerPluginTest1',
+ 'PowerPluginTest2',
+ 'PowerPluginTest3',
+ 'PowerPluginTest4',
+ 'PowerPluginTest5',
+ 'PowerPluginTest6',
+ 'PowerPluginTest7',
+ 'PowerPluginTest8',
+ ]
+ test(
+ 'test-power ' + cls,
+ test_py,
+ args: cls,
+ env: envs,
+ timeout: 100
+ )
+endforeach
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 8c085618..6fa368a7 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -37,7 +37,7 @@ from gi.repository import GLib
from gi.repository import UPowerGlib
from gi.repository import UMockdev
-class PowerPluginTest(gsdtestcase.GSDTestCase):
+class PowerPluginBase(gsdtestcase.GSDTestCase):
'''Test the power plugin'''
COMMON_SUSPEND_METHODS=['Suspend', 'Hibernate', 'SuspendThenHibernate']
@@ -480,6 +480,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
log = self.plugin_log.read()
self.assertFalse(b'TESTSUITE: Unblanked screen' in log, 'unexpected unblank request')
+class PowerPluginTest1(PowerPluginBase):
def test_screensaver(self):
# Note that the screensaver mock object
# doesn't know how to get out of being active,
@@ -550,6 +551,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
dbus_interface='org.gnome.SessionManager')
+class PowerPluginTest2(PowerPluginBase):
def test_screensaver_no_unblank(self):
'''Ensure the screensaver is not unblanked for new inhibitors.'''
@@ -629,6 +631,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# And check we're not idle
self.assertEqual(self.get_status(), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+class PowerPluginTest3(PowerPluginBase):
def test_sleep_inactive_battery_hibernate_then_suspend(self):
'''Verify we SuspendThenHibernate on sleep-inactive-battery-timeout when SuspendThenHibernate is
available'''
# Hibernate then suspend is the default
@@ -700,6 +703,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
dbus_interface='org.gnome.SessionManager')
+class PowerPluginTest4(PowerPluginBase):
def test_lock_on_lid_close(self):
'''Check that we do lock on lid closing, if the machine will not suspend'''
@@ -780,6 +784,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
dbus_interface='org.gnome.SessionManager')
+class PowerPluginTest5(PowerPluginBase):
def test_dim(self):
'''Check that we do go to dim'''
@@ -853,6 +858,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# Check that we're uninhibited after the safety time
self.check_for_lid_uninhibited(4)
+class PowerPluginTest6(PowerPluginBase):
def test_notify_critical_battery(self):
'''action on critical battery'''
@@ -977,6 +983,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
dbus_interface='org.gnome.SessionManager')
+class PowerPluginTest7(PowerPluginBase):
def test_check_missing_kbd_brightness(self):
''' https://bugzilla.gnome.org/show_bug.cgi?id=793512 '''
@@ -1050,6 +1057,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# And wait a little more to see us dim again
self.check_dim(idle_delay + 2)
+class PowerPluginTest8(PowerPluginBase):
def test_brightness_stepping(self):
'''Check that stepping the backlight works as expected'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]