Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nemo-filemanager] Fix unit test structure. Contributes to JB#46991
  • Loading branch information
rainemak committed Sep 11, 2019
1 parent 05fc6a1 commit f302a68
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 48 deletions.
8 changes: 4 additions & 4 deletions filemanager.pro
Expand Up @@ -2,14 +2,14 @@ TEMPLATE = subdirs

src_plugins.subdir = src/plugin
src_plugins.target = sub-plugins
src_plugins.depends += src tests
src_plugins.depends += src

src_daemon.subdir = src/daemon
src_daemon.target = sub-daemon
src_plugins.depends += src

unit_tests.subdir = tests/unit
unit_tests.target = sub-unit
tests.depends = src src_plugins

SUBDIRS = src src_plugins src_daemon unit_tests tests
SUBDIRS = src src_plugins src_daemon tests

OTHER_FILES = rpm/*.spec
17 changes: 3 additions & 14 deletions rpm/nemo-qml-plugin-filemanager.spec
Expand Up @@ -34,13 +34,6 @@ Requires: %{name} = %{version}-%{release}
%description tests
%{summary}.

%package unit-tests
Summary: File manager C++ library (unit tests)
Group: System/Libraries

%description unit-tests
%{summary}.

%prep
%setup -q -n %{name}-%{version}

Expand All @@ -51,8 +44,8 @@ make %{?_smp_mflags}
%install
rm -rf %{buildroot}
%qmake5_install
chmod o+w -R %{buildroot}/opt/tests/nemo-qml-plugins/filemanager/auto/folder
chmod o-r -R %{buildroot}/opt/tests/nemo-qml-plugins/filemanager/auto/hiddenfolder
chmod o+w -R %{buildroot}/%{_libdir}/%{name}-tests/auto/folder
chmod o-r -R %{buildroot}/%{_libdir}/%{name}-tests/auto/hiddenfolder

%files
%defattr(-,root,root,-)
Expand All @@ -72,10 +65,6 @@ chmod o-r -R %{buildroot}/opt/tests/nemo-qml-plugins/filemanager/auto/hiddenfold

%files tests
%defattr(-,root,root,-)
/opt/tests/nemo-qml-plugins/filemanager/

%files unit-tests
%defattr(-,root,root,-)
%{_libdir}/%{name}-tests/ut_diskusage
%{_libdir}/%{name}-tests
%{_datadir}/%{name}-tests/tests.xml

11 changes: 11 additions & 0 deletions tests/auto/auto.pro
@@ -0,0 +1,11 @@
include (../common.pri)

TEMPLATE = aux

QML_FILES = tst_*.qml
OTHER_FILES += $${QML_FILES}

target.files = $${QML_FILES} folder hiddenfolder protectedfolder
target.path = /usr/lib/$${PACKAGENAME}-tests/auto

INSTALLS += target
1 change: 1 addition & 0 deletions tests/common.pri
@@ -0,0 +1 @@
PACKAGENAME = nemo-qml-plugin-filemanager
18 changes: 10 additions & 8 deletions tests/tests.pro
@@ -1,12 +1,14 @@
TEMPLATE = aux
include(common.pri)

QML_FILES = auto/tst_*.qml
OTHER_FILES += $${QML_FILES}
TEMPLATE = subdirs
SUBDIRS = auto \
ut_diskusage

target.files = $${QML_FILES} auto/folder auto/hiddenfolder auto/protectedfolder
target.path = /opt/tests/nemo-qml-plugins/filemanager/auto
OTHER_FILES += tests.xml.template

definition.files = tests.xml
definition.path = /opt/tests/nemo-qml-plugins/filemanager/test-definition
system(sed -e s/@PACKAGENAME@/$${PACKAGENAME}/g tests.xml.template > tests.xml)

INSTALLS += target definition
xml.path = /usr/share/$${PACKAGENAME}-tests
xml.files = tests.xml

INSTALLS += xml
13 changes: 0 additions & 13 deletions tests/tests.xml

This file was deleted.

8 changes: 8 additions & 0 deletions tests/unit/tests.xml.template → tests/tests.xml.template
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<testdefinition version="1.0">
<suite name="@PACKAGENAME@-tests" domain="Middleware">
<set name="@PACKAGENAME@-qml" feature="@PACKAGENAME@">
<case name="FileModel">
<step>cd /usr/lib/@PACKAGENAME@-tests/auto &amp;&amp; /usr/lib/qt5/bin/qmltestrunner -input tst_filemodel.qml</step>
</case>
<case name="FileEngine">
<step>cd /usr/lib/@PACKAGENAME@-tests/auto &amp;&amp; /usr/lib/qt5/bin/qmltestrunner -input tst_fileengine.qml</step>
</case>
</set>
<set name="@PACKAGENAME@-diskusage" description="ut_diskusage" feature="@PACKAGENAME@">
<case name="testSimple" description="Test basic functionality"
type="Functional" level="Component" timeout="600">
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 2 additions & 9 deletions tests/unit/unit.pro → tests/ut_diskusage/ut_diskusage.pro
@@ -1,20 +1,13 @@
# based on tests.pro from libprofile-qt

PACKAGENAME = nemo-qml-plugin-filemanager
include (../common.pri)

QT += testlib qml dbus
QT -= gui

system(sed -e s/@PACKAGENAME@/$${PACKAGENAME}/g tests.xml.template > tests.xml)

TEMPLATE = app
TARGET = ut_diskusage

target.path = /usr/lib/$${PACKAGENAME}-tests

xml.path = /usr/share/$${PACKAGENAME}-tests
xml.files = tests.xml

contains(cov, true) {
message("Coverage options enabled")
QMAKE_CXXFLAGS += --coverage
Expand All @@ -37,4 +30,4 @@ SOURCES += ../../src/plugin/diskusage.cpp
HEADERS += ../../src/plugin/diskusage.h
HEADERS += ../../src/plugin/diskusage_p.h

INSTALLS += target xml
INSTALLS += target

0 comments on commit f302a68

Please sign in to comment.