Skip to content

Commit

Permalink
[libcommhistory] Combine tests into one package and clean up test fil…
Browse files Browse the repository at this point in the history
…es. JB#52802

Combine unit-tests and performance-tests subpackages into a single
libcommhistory-qt5-tests package.

Instead of generating the tests.xml from individual xml files,
generate it from a test.xml.in file that already contains all
individual test entries. Also, combine the unit and performance tests
into the same tests.xml file.
  • Loading branch information
blammit committed Mar 3, 2021
1 parent 26b4280 commit 1aaadeb
Show file tree
Hide file tree
Showing 38 changed files with 120 additions and 277 deletions.
28 changes: 6 additions & 22 deletions rpm/libcommhistory-qt5.spec
Expand Up @@ -21,18 +21,12 @@ BuildRequires: libphonenumber-devel
%description
Library for accessing the communications (IM, SMS and call) history database.

%package unit-tests
Summary: Unit Test files for libcommhistory
%package tests
Summary: Test files for libcommhistory
Requires: blts-tools

%description unit-tests
Unit Test files for libcommhistory

%package performance-tests
Summary: Performance Test files for libcommhistory

%description performance-tests
Performance Test files for libcommhistory
%description tests
Test files for libcommhistory

%package tools
Summary: Command line tools for libcommhistory
Expand Down Expand Up @@ -84,12 +78,6 @@ install -m 644 -p %{SOURCE1} %{buildroot}%{_datadir}/mapplauncherd/privileges.d
%postun
/sbin/ldconfig

%post unit-tests
for n in ut_recentcontactsmodel ut_callmodel; do
pathname=/opt/tests/libcommhistory-qt5-unit-tests/$n
chgrp privileged $pathname && chmod g+s $pathname
done

%files
%defattr(-,root,root,-)
%{_libdir}/libcommhistory-qt5.so*
Expand All @@ -104,13 +92,9 @@ done
%defattr(-,root,root,-)
%{_libdir}/qt5/qml/org/nemomobile/commhistory

%files unit-tests
%defattr(-,root,root,-)
/opt/tests/libcommhistory-qt5-unit-tests

%files performance-tests
%files tests
%defattr(-,root,root,-)
/opt/tests/libcommhistory-qt5-performance-tests
/opt/tests/libcommhistory-qt5

%files devel
%defattr(-,root,root,-)
Expand Down
2 changes: 0 additions & 2 deletions tests/common.cpp
Expand Up @@ -230,7 +230,6 @@ int addTestContact(const QString &name, const QString &remoteUid, const QString

foreach (const QContactRelationship &relationship, manager()->relationships(QContactRelationship::Aggregates(), contact.id(), QContactRelationship::Second)) {
const QContactId &aggId = relationship.first();
qDebug() << "********** contact id" << aggId;
addedContactIds.insert(aggId);
return internalContactId(aggId);
}
Expand Down Expand Up @@ -265,7 +264,6 @@ QList<int> addTestContacts(const QList<QPair<QString, QPair<QString, QString> >
foreach (const QContactRelationship &relationship, manager()->relationships(QContactRelationship::Aggregates())) {
if (constituentIds.contains(relationship.second())) {
const QContactId &aggId = relationship.first();
qDebug() << "********** contact id" << aggId;
addedContactIds.insert(aggId);
ids.append(internalContactId(aggId));
}
Expand Down
66 changes: 0 additions & 66 deletions tests/do_tests_xml.sh

This file was deleted.

1 change: 0 additions & 1 deletion tests/mem_eventmodel/mem_eventmodel.pro
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../tests.pri )

TARGET = mem_eventmodel
DESTDIR = ../bin
QT -= gui

SOURCES += mem_eventmodel.cpp
Expand Down
1 change: 0 additions & 1 deletion tests/perf_callmodel/perf_callmodel.pro
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = perf_callmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += callmodelperftest.cpp
HEADERS += callmodelperftest.h
Expand Down
5 changes: 0 additions & 5 deletions tests/perf_callmodel/test_set.xml

This file was deleted.

1 change: 0 additions & 1 deletion tests/perf_conversationmodel/perf_conversationmodel.pro
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = perf_conversationmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += conversationmodelperftest.cpp
HEADERS += conversationmodelperftest.h
5 changes: 0 additions & 5 deletions tests/perf_conversationmodel/test_set.xml

This file was deleted.

1 change: 0 additions & 1 deletion tests/perf_groupmodel/perf_groupmodel.pro
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = perf_groupmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += groupmodelperftest.cpp
HEADERS += groupmodelperftest.h
5 changes: 0 additions & 5 deletions tests/perf_groupmodel/test_set.xml

This file was deleted.

Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = perf_recentcontactsmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += recentcontactsmodelperftest.cpp
HEADERS += recentcontactsmodelperftest.h
Expand Down
2 changes: 1 addition & 1 deletion tests/performance_tests.pri
Expand Up @@ -38,6 +38,6 @@ DEFINES += PERF_BATCH_SIZE=25
!include( ../common-installs-config.pri ) : \
error( "Unable to include common-installs-config.pri!" )
# override default path for tests
target.path = /opt/tests/$${PROJECT_NAME}-performance-tests
target.path = /opt/tests/$${PROJECT_NAME}/performance
# End of File

39 changes: 9 additions & 30 deletions tests/performance_tests.pro
Expand Up @@ -23,35 +23,14 @@
!include( ../common-vars.pri ):error( "Unable to install common-vars.pri" )

TEMPLATE = subdirs
SUBDIRS = perf_callmodel \
perf_conversationmodel \
perf_groupmodel \
perf_recentcontactsmodel \
profile_callmodel \
profile_conversationmodel \
profile_groupmodel \
profile_recentcontactsmodel

# make sure the destination path exists
!system( mkdir -p $${OUT_PWD}/perf_bin ) : \
error( "Unable to create perf_bin dir for tests." )
SUBDIRS = \
perf_callmodel \
perf_conversationmodel \
perf_groupmodel \
perf_recentcontactsmodel \
profile_callmodel \
profile_conversationmodel \
profile_groupmodel \
profile_recentcontactsmodel

#-----------------------------------------------------------------------------
# generate test xml
#-----------------------------------------------------------------------------
!system( ./do_tests_xml.sh $${OUT_PWD}/perf_bin \
$${PROJECT_NAME} \
performance \
\"$${SUBDIRS}\" ) : \
error("Error running do_tests_xml.sh")
QMAKE_CLEAN += $${OUT_PWD}/perf_bin/tests.xml

#-----------------------------------------------------------------------------
# installation setup
#-----------------------------------------------------------------------------
!include( ../common-installs-config.pri ) : \
error( "Unable to include common-installs-config.pri!" )
perftests.files = $${OUT_PWD}/perf_bin/* \
run_all_performance_tests.sh
perftests.path = /opt/tests/$${PROJECT_NAME}-performance-tests
INSTALLS += perftests
1 change: 0 additions & 1 deletion tests/profile_callmodel/profile_callmodel.pro
Expand Up @@ -3,7 +3,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = profile_callmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += callmodelprofiletest.cpp
HEADERS += callmodelprofiletest.h
Expand Down
Expand Up @@ -3,7 +3,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = profile_conversationmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += conversationmodelprofiletest.cpp
HEADERS += conversationmodelprofiletest.h
Expand Down
1 change: 0 additions & 1 deletion tests/profile_groupmodel/profile_groupmodel.pro
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = profile_groupmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += groupmodelprofiletest.cpp
HEADERS += groupmodelprofiletest.h
Expand Up @@ -25,7 +25,6 @@ include( ../../common-vars.pri )
include( ../performance_tests.pri )

TARGET = profile_recentcontactsmodel
DESTDIR = ../perf_bin
QT -= gui
SOURCES += recentcontactsmodelprofiletest.cpp
HEADERS += recentcontactsmodelprofiletest.h
Expand Down
36 changes: 0 additions & 36 deletions tests/run_all_performance_tests.sh

This file was deleted.

29 changes: 0 additions & 29 deletions tests/run_all_tests.sh

This file was deleted.

7 changes: 7 additions & 0 deletions tests/run_test.sh
@@ -0,0 +1,7 @@
#!/bin/sh

export TESTDIR=$1
export TESTCASE=$2
export DEVICEUSER=$(getent passwd $(grep '^UID_MIN' /etc/login.defs | tr -s ' ' | cut -d ' ' -f2) | sed 's/:.*//')
export LIBCONTACTS_TEST_MODE=1
/usr/sbin/run-blts-root /bin/su -g privileged -c "/opt/tests/libcommhistory-qt5/$TESTDIR/$TESTCASE" "$DEVICEUSER"
2 changes: 1 addition & 1 deletion tests/tests.pri
Expand Up @@ -35,6 +35,6 @@ HEADERS += ../common.h ../modelwatcher.h
!include( ../common-installs-config.pri ) : \
error( "Unable to include common-installs-config.pri!" )
# override default path for tests
target.path = /opt/tests/$${PROJECT_NAME}-unit-tests
target.path = /opt/tests/$${PROJECT_NAME}/auto
# End of File

3 changes: 2 additions & 1 deletion tests/tests.pro
Expand Up @@ -21,4 +21,5 @@
###############################################################################

TEMPLATE = subdirs
SUBDIRS = unit_tests.pro performance_tests.pro mem_eventmodel
SUBDIRS = unit_tests.pro performance_tests.pro tests_xml.pro

0 comments on commit 1aaadeb

Please sign in to comment.