Skip to content

Commit

Permalink
Merge branch 'jb50555' into 'master'
Browse files Browse the repository at this point in the history
[qtcontacts-sqlite] Update the testrunner definition. Contributes to JB#50555

See merge request mer-core/qtcontacts-sqlite!47
  • Loading branch information
chriadam committed Oct 6, 2020
2 parents 016c788 + 5636c53 commit f357a68
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
1 change: 1 addition & 0 deletions rpm/qtcontacts-sqlite-qt5.spec
Expand Up @@ -22,6 +22,7 @@ Requires: qt5-plugin-sqldriver-sqlite
%package tests
Summary: Unit tests for qtcontacts-sqlite-qt5
BuildRequires: pkgconfig(Qt5Test)
Requires: blts-tools
Requires: %{name} = %{version}-%{release}

%description tests
Expand Down
8 changes: 5 additions & 3 deletions src/engine/contactsdatabase.cpp
Expand Up @@ -3189,6 +3189,7 @@ ContactsDatabase::ContactsDatabase(ContactsEngine *engine)
: m_engine(engine)
, m_mutex(QMutex::Recursive)
, m_nonprivileged(false)
, m_autoTest(false)
, m_localeName(QLocale().name())
, m_defaultGenerator(new DefaultDlgGenerator)
#ifdef HAS_MLITE
Expand Down Expand Up @@ -3249,9 +3250,10 @@ bool ContactsDatabase::open(const QString &connectionName, bool nonprivileged, b
{
QMutexLocker locker(accessMutex());

m_autoTest = autoTest;
if (m_dlgGenerators.isEmpty()) {
for (auto generator : s_dlgGenerators) {
if (generator && (generator->name().contains(QStringLiteral("test")) == autoTest)) {
if (generator && (generator->name().contains(QStringLiteral("test")) == m_autoTest)) {
m_dlgGenerators.append(generator);
}
}
Expand Down Expand Up @@ -3302,7 +3304,7 @@ bool ContactsDatabase::open(const QString &connectionName, bool nonprivileged, b
const QString privilegedDataDirPath(systemDataDirPath + QTCONTACTS_SQLITE_PRIVILEGED_DIR + "/");

QString databaseSubdir(QStringLiteral(QTCONTACTS_SQLITE_DATABASE_DIR));
if (autoTest) {
if (m_autoTest) {
databaseSubdir.append(QStringLiteral("-test"));
}

Expand Down Expand Up @@ -3832,7 +3834,7 @@ QString ContactsDatabase::displayLabelGroupPreferredProperty() const
}
}
#endif
return retn;
return m_autoTest ? QStringLiteral("QContactName::FieldLastName") : retn;
}

QString ContactsDatabase::determineDisplayLabelGroup(const QContact &c, bool *emitDisplayLabelGroupChange)
Expand Down
1 change: 1 addition & 0 deletions src/engine/contactsdatabase.h
Expand Up @@ -199,6 +199,7 @@ class ContactsDatabase
QMutex m_mutex;
mutable QScopedPointer<ProcessMutex> m_processMutex;
bool m_nonprivileged;
bool m_autoTest;
QString m_localeName;
QHash<QString, QSqlQuery> m_preparedQueries;
QVector<QtContactsSqliteExtensions::DisplayLabelGroupGenerator*> m_dlgGenerators;
Expand Down
30 changes: 21 additions & 9 deletions tests/tests.xml
Expand Up @@ -5,25 +5,37 @@
<set name="unit-tests" feature="qtcontacts-sqlite-qt5">
<description>Backend correctness automatic tests</description>
<case manual="false" name="aggregation">
<step>/usr/sbin/run-blts-root /bin/su -g privileged -c 'rm -rf /home/nemo/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test' nemo</step>
<step>/usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/qtcontacts-sqlite-qt5/tst_aggregation' nemo</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_aggregation" $DEVICEUSER'</step>
</case>
<case manual="false" name="synctransactions">
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_synctransactions" $DEVICEUSER'</step>
</case>
<case manual="false" name="displaylabelgroups">
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_displaylabelgroups" $DEVICEUSER'</step>
</case>
<case manual="false" name="detailfetchrequest">
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_detailfetchrequest" $DEVICEUSER'</step>
</case>
<case manual="false" name="contactmanager">
<step>/usr/sbin/run-blts-root /bin/su -g privileged -c 'rm -rf /home/nemo/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test' nemo</step>
<step>/usr/sbin/run-blts-root /bin/su -g privileged -c '/opt/tests/qtcontacts-sqlite-qt5/tst_qcontactmanager' nemo</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/privileged/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_qcontactmanager" $DEVICEUSER'</step>
</case>
<case manual="false" name="contactmanagerfiltering">
<step>rm -rf /home/nemo/.local/share/system/Contacts/qtcontacts-sqlite-test</step>
<step>/opt/tests/qtcontacts-sqlite-qt5/tst_qcontactmanagerfiltering</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "rm -rf /home/$DEVICEUSER/.local/share/system/Contacts/qtcontacts-sqlite-test" $DEVICEUSER'</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_qcontactmanagerfiltering" $DEVICEUSER'</step>
</case>
<case manual="false" name="database">
<step>/opt/tests/qtcontacts-sqlite-qt5/tst_database -perfcounter tickcounter</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_database -perfcounter tickcounter" $DEVICEUSER'</step>
</case>
<case manual="false" name="memorytable">
<step>/opt/tests/qtcontacts-sqlite-qt5/tst_memorytable</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_memorytable" $DEVICEUSER'</step>
</case>
<case manual="false" name="phonenumber">
<step>/opt/tests/qtcontacts-sqlite-qt5/tst_phonenumber</step>
<step>DEVICEUSER=$(getent passwd $(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2) | sed 's/:.*//') bash -c '/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/qtcontacts-sqlite-qt5/tst_phonenumber" $DEVICEUSER'</step>
</case>
</set>
</suite>
Expand Down

0 comments on commit f357a68

Please sign in to comment.