Merge lp:~larryprice/libertine/dbus-session-hack into lp:libertine

Proposed by Larry Price
Status: Merged
Approved by: Christopher Townsend
Approved revision: 394
Merged at revision: 396
Proposed branch: lp:~larryprice/libertine/dbus-session-hack
Merge into: lp:libertine
Diff against target: 63 lines (+15/-5)
3 files modified
debian/control (+1/-0)
tests/integration/CMakeLists.txt (+1/-1)
tests/integration/test_libertine_service.py (+13/-4)
To merge this branch: bzr merge lp:~larryprice/libertine/dbus-session-hack
Reviewer Review Type Date Requested Status
Libertine CI Bot continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+316730@code.launchpad.net

Commit message

Politely wait for libertined to start during integration test to avoid activating system dbus service.

Description of the change

Update the libertined integration test to politely wait for the process to start to avoid activation of system dbus service.

To post a comment you must log in.
Revision history for this message
Christopher Townsend (townsend) wrote :

Looks good. The dbus activated libertined service no longer starts:)

review: Approve
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
394. By Larry Price

add pexpect

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:394
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/377/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/721
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/591
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=zesty,testname=default/591
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/591
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=zesty,testname=default/591
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/731
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/712
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/712/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/712
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=zesty/712/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/712
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/712/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/712
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=zesty/712/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/377/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2017-02-07 16:32:02 +0000
3+++ debian/control 2017-02-08 17:08:42 +0000
4@@ -23,6 +23,7 @@
5 python3-distro-info,
6 python3-gi,
7 python3-lxc,
8+ python3-pexpect,
9 python3-psutil,
10 python3-pytest,
11 python3-testtools,
12
13=== modified file 'tests/integration/CMakeLists.txt'
14--- tests/integration/CMakeLists.txt 2017-02-07 12:58:34 +0000
15+++ tests/integration/CMakeLists.txt 2017-02-08 17:08:42 +0000
16@@ -1,4 +1,4 @@
17-add_test(test_libertine_service dbus-run-session /usr/bin/python3 -m testtools.run test_libertine_service)
18+add_test(test_libertine_service dbus-run-session -- /usr/bin/python3 -m testtools.run test_libertine_service)
19 set_tests_properties(test_libertine_service
20 PROPERTIES ENVIRONMENT
21 "GI_TYPELIB_PATH=${CMAKE_BINARY_DIR}/liblibertine;LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/liblibertine:${LD_LIBRARY_PATH};PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_SOURCE_DIR}/python;LIBERTINE_DATA_DIR=${CMAKE_CURRENT_SOURCE_DIR};PATH=${CMAKE_SOURCE_DIR}/tools:$ENV{PATH};")
22
23=== modified file 'tests/integration/test_libertine_service.py'
24--- tests/integration/test_libertine_service.py 2017-02-07 13:30:36 +0000
25+++ tests/integration/test_libertine_service.py 2017-02-08 17:08:42 +0000
26@@ -17,6 +17,8 @@
27 import dbus
28 import dbus.mainloop.glib
29 import os
30+import pexpect
31+import sys
32 import tempfile
33 import threading
34 import time
35@@ -44,7 +46,16 @@
36 environ = os.environ.copy()
37 environ['XDG_DATA_HOME'] = cls._tempdir.name
38
39- cls._process = Popen(['libertined', '--debug'], stdout=PIPE, stderr=PIPE, env=environ)
40+ cls._process = pexpect.spawnu('libertined --debug', env=environ)
41+ cls._process.logfile = sys.stdout
42+
43+ # give libertined enough time to start the whole process
44+ verbosity = environ.get('LIBERTINE_DEBUG', '1')
45+ if verbosity == '1':
46+ cls._process.expect(['.+\n', pexpect.TIMEOUT], timeout=1)
47+ elif environ['LIBERTINE_DEBUG'] == '2':
48+ cls._process.expect(['.+\n.+\n.+\n', pexpect.TIMEOUT], timeout=1)
49+
50 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
51 cls._loop = GObject.MainLoop()
52
53@@ -54,9 +65,7 @@
54 @classmethod
55 def tearDownClass(cls):
56 cls._loop.quit()
57- cls._process.kill()
58- out, err = cls._process.communicate()
59- print(err)
60+ cls._process.close()
61 cls._tempdir.cleanup()
62
63 def setUp(self):

Subscribers

People subscribed via source and target branches