Merge lp:~renatofilho/qtorganizer5-eds/fix-unit-test into lp:qtorganizer5-eds

Proposed by Renato Araujo Oliveira Filho on 2015-07-24
Status: Needs review
Proposed branch: lp:~renatofilho/qtorganizer5-eds/fix-unit-test
Merge into: lp:qtorganizer5-eds
Diff against target: 174 lines (+55/-4)
8 files modified
CMakeLists.txt (+3/-0)
tests/unittest/CMakeLists.txt (+1/-1)
tests/unittest/eds-base-test.cpp (+37/-1)
tests/unittest/eds-base-test.h (+2/-0)
tests/unittest/event-test.cpp (+4/-1)
tests/unittest/fetchitem-test.cpp (+1/-1)
tests/unittest/recurrence-test.cpp (+5/-0)
tests/unittest/run-eds-test.sh (+2/-0)
To merge this branch: bzr merge lp:~renatofilho/qtorganizer5-eds/fix-unit-test
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing on 2016-06-21
PS Jenkins bot continuous-integration Approve on 2015-07-24
Ubuntu Phablet Team 2015-07-24 Pending
Review via email: mp+265752@code.launchpad.net

Commit message

Make sure that all views disappear from dbus before exit test case.

To post a comment you must log in.

FAILED: Continuous integration, rev:84
https://jenkins.canonical.com/system-apps/job/lp-qtorganizer5-eds-ci/3/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/689/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/689
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/646
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/646
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/646
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/638/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/638/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-qtorganizer5-eds-ci/3/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

84. By Renato Araujo Oliveira Filho on 2015-07-24

Make sure that all views disappear from dbus before exit test case.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-03-30 17:59:13 +0000
3+++ CMakeLists.txt 2015-07-24 01:20:29 +0000
4@@ -8,6 +8,9 @@
5
6
7 find_package(Qt5Core REQUIRED)
8+find_package(Qt5DBus REQUIRED)
9+find_package(Qt5Xml REQUIRED)
10+
11 add_definitions(-DQT_NO_KEYWORDS)
12 add_definitions(-std=c++11)
13
14
15=== modified file 'tests/unittest/CMakeLists.txt'
16--- tests/unittest/CMakeLists.txt 2015-05-08 20:01:32 +0000
17+++ tests/unittest/CMakeLists.txt 2015-07-24 01:20:29 +0000
18@@ -4,7 +4,7 @@
19 eds-base-test.cpp
20 eds-base-test.h
21 )
22- qt5_use_modules(${TESTNAME} Core Organizer Test)
23+ qt5_use_modules(${TESTNAME} Core Organizer DBus Xml Test)
24
25 if(TEST_XML_OUTPUT)
26 set(TEST_ARGS -p -xunitxml -p -o -p test_${testname}.xml)
27
28=== modified file 'tests/unittest/eds-base-test.cpp'
29--- tests/unittest/eds-base-test.cpp 2015-04-09 14:00:57 +0000
30+++ tests/unittest/eds-base-test.cpp 2015-07-24 01:20:29 +0000
31@@ -22,6 +22,8 @@
32
33 #include <QtCore>
34 #include <QtTest>
35+#include <QtDBus>
36+#include <QtXml>
37
38 #include <libecal/libecal.h>
39
40@@ -60,7 +62,8 @@
41
42 void EDSBaseTest::initTestCase()
43 {
44- QTest::qWait(1000);
45+ // wait for the interface to appear on dbus
46+ QTRY_COMPARE_WITH_TIMEOUT(listObjects().size(), 5, 30000);
47 }
48
49
50@@ -72,6 +75,39 @@
51 {
52 }
53
54+void EDSBaseTest::cleanupTestCase()
55+{
56+ // wait for all views dissapear from dbus
57+ QTRY_COMPARE_WITH_TIMEOUT(listObjects().size(), 5, 30000);
58+}
59+
60+QStringList EDSBaseTest::listObjects(const QString &path)
61+{
62+ QStringList result;
63+ // make a low-level call, to avoid introspecting the Introspectable interface
64+ QDBusMessage call = QDBusMessage::createMethodCall(EVOLUTION_CALENDAR_SERVICE,
65+ path.isEmpty() ? QLatin1String("/") : path,
66+ QLatin1String("org.freedesktop.DBus.Introspectable"),
67+ QLatin1String("Introspect"));
68+ QDBusReply<QString> xml = QDBusConnection::sessionBus().call(call);
69+
70+ QDomDocument doc;
71+ doc.setContent(xml);
72+ QDomElement node = doc.documentElement();
73+ QDomElement child = node.firstChildElement();
74+ while (!child.isNull()) {
75+ if (child.tagName() == QLatin1String("node")) {
76+ QString sub = path + QLatin1Char('/') + child.attribute(QLatin1String("name"));
77+ result += sub;
78+ result += listObjects(sub);
79+ }
80+ child = child.nextSiblingElement();
81+ }
82+
83+ return result;
84+}
85+
86+
87 QString EDSBaseTest::getEventFromEvolution(const QOrganizerItemId &id,
88 const QOrganizerCollectionId &collectionId)
89 {
90
91=== modified file 'tests/unittest/eds-base-test.h'
92--- tests/unittest/eds-base-test.h 2015-04-09 00:03:01 +0000
93+++ tests/unittest/eds-base-test.h 2015-07-24 01:20:29 +0000
94@@ -33,6 +33,7 @@
95
96 protected:
97 virtual void initTestCase();
98+ virtual void cleanupTestCase();
99 virtual void init();
100 virtual void cleanup();
101
102@@ -40,6 +41,7 @@
103 QString getEventFromEvolution(const QtOrganizer::QOrganizerItemId &id,
104 const QtOrganizer::QOrganizerCollectionId &collectionId = QtOrganizer::QOrganizerCollectionId());
105 QString uniqueCollectionName() const;
106+ QStringList listObjects(const QString &path = QString());
107 };
108
109 #endif
110
111=== modified file 'tests/unittest/event-test.cpp'
112--- tests/unittest/event-test.cpp 2015-04-13 21:30:00 +0000
113+++ tests/unittest/event-test.cpp 2015-07-24 01:20:29 +0000
114@@ -23,6 +23,9 @@
115
116 #include <QtOrganizer>
117
118+#include <libecal/libecal.h>
119+
120+
121 #include "qorganizer-eds-engine.h"
122 #include "eds-base-test.h"
123
124@@ -65,7 +68,7 @@
125 void cleanupTestCase()
126 {
127 delete m_engine;
128- EDSBaseTest::cleanup();
129+ EDSBaseTest::cleanupTestCase();
130 }
131
132 void init()
133
134=== modified file 'tests/unittest/fetchitem-test.cpp'
135--- tests/unittest/fetchitem-test.cpp 2014-10-06 14:46:49 +0000
136+++ tests/unittest/fetchitem-test.cpp 2015-07-24 01:20:29 +0000
137@@ -89,7 +89,7 @@
138 delete m_engine;
139 m_engine = 0;
140
141- EDSBaseTest::cleanup();
142+ EDSBaseTest::cleanupTestCase();
143 }
144
145 void testFetchById()
146
147=== modified file 'tests/unittest/recurrence-test.cpp'
148--- tests/unittest/recurrence-test.cpp 2015-02-26 17:30:35 +0000
149+++ tests/unittest/recurrence-test.cpp 2015-07-24 01:20:29 +0000
150@@ -103,6 +103,11 @@
151 EDSBaseTest::cleanup();
152 }
153
154+ void cleanupTestCase()
155+ {
156+ EDSBaseTest::cleanupTestCase();
157+ }
158+
159 void testCreateDailyEvent()
160 {
161 static QString displayLabelValue = QStringLiteral("Daily test");
162
163=== modified file 'tests/unittest/run-eds-test.sh'
164--- tests/unittest/run-eds-test.sh 2015-04-09 19:05:11 +0000
165+++ tests/unittest/run-eds-test.sh 2015-07-24 01:20:29 +0000
166@@ -32,6 +32,8 @@
167 export EDS_TESTING=1
168 export QORGANIZER_EDS_DEBUG=On
169 export GIO_USE_VFS=local # needed to ensure GVFS shuts down cleanly after the test is over
170+export GSETTINGS_BACKEND=memory
171+export GSETTINGS_SCHEMA_DIR=${TEST_TMP_DIR}
172
173 echo HOMEDIR=${HOME}
174 rm -rf ${XDG_DATA_HOME}

Subscribers

People subscribed via source and target branches