diff options
author | Benjamin Berg <bberg@redhat.com> | 2021-07-20 17:33:29 +0200 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2021-07-22 14:23:50 +0200 |
commit | 468fab7461431b5c4d45c1778d8db40040bf1427 (patch) | |
tree | 1907db254abceb4ae07106b0822ba19245f8ad37 /tests | |
parent | 6dc24e0c410b50d8f9ceeda48d10b3fa16e1c715 (diff) | |
download | gnome-settings-daemon-468fab7461431b5c4d45c1778d8db40040bf1427.tar.gz |
tests: Kill processes instead of just terminating them
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gsdtestcase.py | 19 | ||||
-rw-r--r-- | tests/x11session.py | 6 |
2 files changed, 18 insertions, 7 deletions
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py index bdbe0874..e0704128 100644 --- a/tests/gsdtestcase.py +++ b/tests/gsdtestcase.py @@ -160,8 +160,7 @@ class GSDTestCase(X11SessionTestCase): '''Stop dbus-monitor''' assert klass.monitor - klass.monitor.terminate() - klass.monitor.wait() + klass.stop_process(klass.monitor) klass.monitor_log.flush() klass.monitor_log.close() @@ -187,8 +186,7 @@ class GSDTestCase(X11SessionTestCase): def stop_logind(self): '''stop mock logind''' - self.logind.terminate() - self.logind.wait() + self.stop_process(self.logind) self.logind_log.assert_closed() def start_mutter(klass): @@ -205,8 +203,17 @@ class GSDTestCase(X11SessionTestCase): '''stop mutter''' assert klass.monitor - klass.mutter.terminate() - klass.mutter.wait() + klass.stop_process(klass.mutter, timeout=2) + + @classmethod + def stop_process(cls, proc, timeout=1): + proc.terminate() + try: + proc.wait(timeout) + except: + print("Killing %d (%s) after timeout of %f seconds" % (proc.pid, proc.args[0], timeout)) + proc.kill() + proc.wait() @classmethod def reset_idle_timer(klass): diff --git a/tests/x11session.py b/tests/x11session.py index faa22483..56780730 100644 --- a/tests/x11session.py +++ b/tests/x11session.py @@ -111,6 +111,10 @@ class X11SessionTestCase(DBusTestCase): if hasattr(klass, 'xorg'): klass.X_display = -1 klass.xorg.terminate() - klass.xorg.wait() + try: + klass.xorg.wait(1) + except: + klass.xorg.kill() + klass.xorg.wait() del klass.xorg |