Public bug reported:

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)

** Affects: unity8 (Ubuntu)
     Importance: High
     Assignee: Lukáš Tinkl (lukas-kde)
         Status: Triaged


** Tags: amd64 apport-bug wily

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1498825

Title:
  SessionBackend tests unreliable, talk to real system services

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1498825/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to