[gnome-settings-daemon/benzea/power-test-speedup: 39/39] power: Speed up power test by splitting it into chunks



commit 05e286ab158dcce5643116e9fddd5fb4dda3b175
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 | 16 +++++++++-------
 plugins/power/test.py     | 10 +++++++++-
 2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/plugins/power/meson.build b/plugins/power/meson.build
index 7b0e0ade..ea07ae9a 100644
--- a/plugins/power/meson.build
+++ b/plugins/power/meson.build
@@ -132,11 +132,13 @@ envs = [
   'LD_PRELOAD=libumockdev-preload.so.0',
 ]
 
-test(
-  'test-power',
-  test_py,
-#  args: 'PowerPluginTest.test_sleep_inactive_blank',
-  env: envs,
-  timeout: 500
-)
+foreach i : [ 1, 2, 3, 4, 5, 6, 7, 8 ]
+  test(
+    'test-power @0@/8'.format(i),
+    test_py,
+    args: [ 'PowerPluginTest@0@'.format(i) ],
+    env: envs,
+    timeout: 100
+  )
+endforeach
 
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 5f7977ec..57be628e 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(self):
         '''sleep-inactive-battery-timeout'''
 
@@ -682,6 +685,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'''
 
@@ -762,6 +766,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'''
 
@@ -835,6 +840,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'''
 
@@ -959,6 +965,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 '''
 
@@ -1032,6 +1039,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]