Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
[libcontacts] Run tests with privileges
Browse files Browse the repository at this point in the history
The contact cache provided by libcontacts is intended for use by
privileged applications only.  Its functionality does not make sense
for non-privileged clients, and cannot be tested correctly when
run in non-privileged mode.
  • Loading branch information
Chris Adams committed Apr 8, 2015
1 parent 74283e9 commit 9673285
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions libcontacts.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = src tests
OTHER_FILES += rpm/libcontacts-qt5.spec

tests.depends = src
1 change: 1 addition & 0 deletions rpm/libcontacts-qt5.spec
Expand Up @@ -22,6 +22,7 @@ BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) >= 0.2.1
%package tests
Summary: Nemo contact cache library tests
Group: System/Libraries
Requires: blts-tools
Requires: %{name} = %{version}-%{release}

%description tests
Expand Down
3 changes: 3 additions & 0 deletions src/seasidecache.cpp
Expand Up @@ -170,6 +170,9 @@ QMap<QString, QString> managerParameters()
QMap<QString, QString> rv;
// Report presence changes independently from other contact changes
rv.insert(QString::fromLatin1("mergePresenceChanges"), QString::fromLatin1("false"));
if (!qgetenv("LIBCONTACTS_TEST_MODE").isEmpty()) {
rv.insert(QString::fromLatin1("autoTest"), QString::fromLatin1("true"));
}
return rv;
}

Expand Down
1 change: 1 addition & 0 deletions tests/tests.pro
Expand Up @@ -2,6 +2,7 @@ include(../package.pri)

TEMPLATE = subdirs
SUBDIRS = tst_synchronizelists tst_seasideimport tst_resolve
OTHER_FILES += tests.xml.in

tests_xml.target = tests.xml
tests_xml.depends = $$PWD/tests.xml.in
Expand Down
6 changes: 3 additions & 3 deletions tests/tests.xml.in
Expand Up @@ -5,13 +5,13 @@
<set name="contactcache-test0" feature="Contacts">
<description>Contact cache automatic tests</description>
<case manual="false" name="synchronizelists">
<step>/opt/tests/@PACKAGENAME@/tst_synchronizelists</step>
<step>LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_synchronizelists' nemo</step>
</case>
<case manual="false" name="seasideimport">
<step>/opt/tests/@PACKAGENAME@/tst_seasideimport</step>
<step>LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_seasideimport' nemo</step>
</case>
<case manual="false" name="resolve">
<step>/opt/tests/@PACKAGENAME@/tst_resolve</step>
<step>LIBCONTACTS_TEST_MODE=1 /usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/@PACKAGENAME@/tst_resolve' nemo</step>
</case>
</set>
</suite>
Expand Down

0 comments on commit 9673285

Please sign in to comment.