SessionBackend tests unreliable, talk to real system services

Bug #1498825 reported by Michał Sawicz
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
unity8 (Ubuntu)
Triaged
High
Lukáš Tinkl

Bug Description

The new SessionBackend tests talk to the real system services (like logind), which means the result depends on where the test is ran. They pass on CI because the tests are effectively skipped if the service isn't available. On the other hand it fails for me (see below), because my laptop does not hibernate and the answer from logind is "na", not "no":

$> qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanHibernate
na

The tests need to talk to a mock service (on the session bus) that's launched along the test using dbus-test-runner. Use QDBusConnection::SM_BUSNAME() to switch the implementation between system and session buses (see e.g. AccountsService tests for examples).

$> ninja -C builddir testSessionBackend
ninja: Entering directory `builddir'
[1/1] Re-running CMake...
-- Could NOT find Lcov (missing: LCOV_EXECUTABLE GENHTML_EXECUTABLE)
-- Could NOT find gcovr (missing: GCOVR_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/michal/dev/canonical/unity8/repo/builddir
[3/3] cd /home/michal/dev/canonical/unity8/repo/builddir/tests/plugins/Unity/Session && env QML2_IMPORT_PATH=/home/michal/dev/canonica...michal/dev/canonical/unity8/repo/builddir/tests/plugins/Unity/Session/testSessionBackend.xml,xunitxml --parameter -o --parameter -,txt
FAILED: cd /home/michal/dev/canonical/unity8/repo/builddir/tests/plugins/Unity/Session && env QML2_IMPORT_PATH=/home/michal/dev/canonical/unity8/repo/builddir/tests/mocks:/home/michal/dev/canonical/unity8/repo/builddir/tests/utils/modules:/home/michal/dev/canonical/unity8/repo/builddir/plugins UNITY_TESTING=1 LANGUAGE=C LC_ALL=C.UTF-8 QT_QPA_PLATFORM=minimal /usr/bin/dbus-test-runner --task /home/michal/dev/canonical/unity8/repo/builddir/tests/plugins/Unity/Session/sessionbackendtestExec --parameter -o --parameter /home/michal/dev/canonical/unity8/repo/builddir/tests/plugins/Unity/Session/testSessionBackend.xml,xunitxml --parameter -o --parameter -,txt
DBus daemon: unix:abstract=/tmp/dbus-SUPywz2RlD,guid=c082954870d6b539cdebaf6e56026aca
task-0: Started with PID: 1331
task-0: ********* Start testing of SessionBackendTest *********
task-0: Config: Using QtTest library 5.4.2, Qt 5.4.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.2.1 20150729)
task-0: PASS : SessionBackendTest::initTestCase()
task-0: PASS : SessionBackendTest::testUnitySessionLogoutRequested(Logout)
task-0: PASS : SessionBackendTest::testUnitySessionLogoutRequested(Reboot)
task-0: PASS : SessionBackendTest::testUnitySessionLogoutRequested(Shutdown)
task-0: PASS : SessionBackendTest::testUnitySessionLogoutRequested(PromptLock)
task-0: PASS : SessionBackendTest::testGnomeSessionWrapper(Logout)
task-0: PASS : SessionBackendTest::testGnomeSessionWrapper(Shutdown)
task-0: PASS : SessionBackendTest::testGnomeSessionWrapper(Reboot)
task-0: PASS : SessionBackendTest::testUserName()
task-0: PASS : SessionBackendTest::testRealName()
task-0: FAIL! : SessionBackendTest::testLogin1Capabilities() Compared values are not the same
task-0: Actual (dbusUnitySessionService.CanHibernate()) : 0
task-0: Expected ((login1face.call("CanHibernate").arguments().first().toString() != "no")): 1
task-0: Loc: [../tests/plugins/Unity/Session/sessionbackendtest.cpp(157)]
task-0: PASS : SessionBackendTest::cleanupTestCase()
task-0: Totals: 11 passed, 1 failed, 0 skipped, 0 blacklisted
task-0: ********* Finished testing of SessionBackendTest *********
task-0: Exited with status 256
task-0: Shutting down
DBus daemon: Shutdown
ninja: build stopped: subcommand failed.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: unity8 8.11+15.10.20150922.1-0ubuntu1
ProcVersionSignature: Ubuntu 4.2.0-10.12-generic 4.2.0
Uname: Linux 4.2.0-10-generic x86_64
ApportVersion: 2.18.1-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Sep 23 11:02:45 2015
SourcePackage: unity8
UpgradeStatus: Upgraded to wily on 2015-09-18 (5 days ago)

Revision history for this message
Michał Sawicz (saviq) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.