Merge lp:~aacid/qtmir/fix_leaks_application_manager_test into lp:qtmir

Proposed by Albert Astals Cid
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 502
Merged at revision: 516
Proposed branch: lp:~aacid/qtmir/fix_leaks_application_manager_test
Merge into: lp:qtmir
Prerequisite: lp:~aacid/qtmir/fix_qteventfeeder_test_leak
Diff against target: 223 lines (+64/-0)
1 file modified
tests/modules/ApplicationManager/application_manager_test.cpp (+64/-0)
To merge this branch: bzr merge lp:~aacid/qtmir/fix_leaks_application_manager_test
Reviewer Review Type Date Requested Status
Unity8 CI Bot (community) continuous-integration Approve
Daniel d'Andrada (community) Approve
Review via email: mp+296047@code.launchpad.net

Commit message

Fix leaks in application_manager_test

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
Prereq

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

In some tests you could simulate the surface getting zombie (right before qtmir::Session stops) as that's the usual way things happen. It's an impossible situation having a surface outlive its session (ie, session.live == false but surface.live is still true).

But since you want to just plug the leaks and not improve the tests, that's fine.

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:502
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/240/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1741
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1767
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1707/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1707
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1707/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/240/rebuild

review: Approve (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:502
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/257/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/1812
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1838
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1779
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1779
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1779
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1770/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1770
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1770/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/257/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/modules/ApplicationManager/application_manager_test.cpp'
2--- tests/modules/ApplicationManager/application_manager_test.cpp 2016-05-03 15:27:26 +0000
3+++ tests/modules/ApplicationManager/application_manager_test.cpp 2016-05-30 14:52:58 +0000
4@@ -118,6 +118,8 @@
5
6 EXPECT_FALSE(authed);
7 EXPECT_EQ(application, applicationManager.findApplication(dialer_app_id));
8+
9+ delete surface;
10 }
11
12 TEST_F(ApplicationManagerTests,application_dies_while_starting)
13@@ -271,6 +273,10 @@
14
15 TEST_F(ApplicationManagerTests,two_session_on_one_application)
16 {
17+ int argc = 0;
18+ char* argv[0];
19+ QCoreApplication qtApp(argc, argv); // app for deleteLater event
20+
21 using namespace ::testing;
22 const pid_t a_procId = 5921;
23 const char an_app_id[] = "some_app";
24@@ -293,10 +299,18 @@
25
26 EXPECT_EQ(true, authed);
27 EXPECT_EQ(second_session, the_app->session()->session());
28+
29+ onSessionStopping(first_session);
30+ onSessionStopping(second_session);
31+ qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete);
32 }
33
34 TEST_F(ApplicationManagerTests,two_session_on_one_application_after_starting)
35 {
36+ int argc = 0;
37+ char* argv[0];
38+ QCoreApplication qtApp(argc, argv); // app for deleteLater event
39+
40 using namespace ::testing;
41 const pid_t a_procId = 5921;
42 const char an_app_id[] = "some_app";
43@@ -323,6 +337,11 @@
44 EXPECT_EQ(true, authed);
45 EXPECT_EQ(Application::Running, the_app->state());
46 EXPECT_EQ(first_session, the_app->session()->session());
47+
48+ onSessionStopping(first_session);
49+ onSessionStopping(second_session);
50+ delete aSurface;
51+ qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete);
52 }
53
54 TEST_F(ApplicationManagerTests,starting_app_is_suspended_when_it_gets_ready_if_requested)
55@@ -357,6 +376,8 @@
56
57 // now that its ready, suspend process should have begun
58 EXPECT_EQ(Application::InternalState::SuspendingWaitSession, app->internalState());
59+
60+ delete aSurface;
61 }
62
63 TEST_F(ApplicationManagerTests,requestFocusApplication)
64@@ -746,6 +767,8 @@
65 // Check application state is correctly set
66 Application *theApp = applicationManager.findApplication(appId);
67 EXPECT_EQ(theApp->state(), Application::Running);
68+
69+ delete surface;
70 }
71
72 /*
73@@ -879,6 +902,8 @@
74
75 EXPECT_EQ(2, countSpy.count()); //FIXME(greyback)
76 EXPECT_EQ(0, applicationManager.count());
77+
78+ delete surface;
79 }
80
81 /*
82@@ -921,6 +946,8 @@
83
84 EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback)
85 EXPECT_EQ(applicationManager.count(), 0);
86+
87+ delete surface;
88 }
89
90 /*
91@@ -971,6 +998,8 @@
92
93 EXPECT_EQ(0, countSpy.count());
94 EXPECT_EQ(1, applicationManager.count());
95+
96+ delete surface;
97 }
98
99 /*
100@@ -1023,6 +1052,8 @@
101
102 EXPECT_EQ(countSpy.count(), 0);
103 EXPECT_EQ(applicationManager.count(), 1);
104+
105+ delete surface;
106 }
107
108 /*
109@@ -1092,6 +1123,8 @@
110
111 EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback)
112 EXPECT_EQ(applicationManager.count(), 0);
113+
114+ delete surface;
115 }
116
117 /*
118@@ -1133,6 +1166,8 @@
119
120 Application *app = applicationManager.findApplication(appId);
121 EXPECT_EQ(nullptr, app);
122+
123+ delete surface;
124 }
125
126 /*
127@@ -1187,6 +1222,8 @@
128 EXPECT_EQ(1, applicationManager.count());
129
130 EXPECT_EQ(Application::Stopped, app->state());
131+
132+ delete surface;
133 }
134
135 /*
136@@ -1236,6 +1273,10 @@
137 */
138 TEST_F(ApplicationManagerTests,unexpectedStopOfForegroundWebapp)
139 {
140+ int argc = 0;
141+ char* argv[0];
142+ QCoreApplication qtApp(argc, argv); // app for deleteLater event
143+
144 using namespace ::testing;
145 const QString appId("webapp");
146 const pid_t procId1 = 5551;
147@@ -1279,6 +1320,10 @@
148
149 EXPECT_EQ(countSpy.count(), 2); //FIXME(greyback)
150 EXPECT_EQ(applicationManager.count(), 0);
151+
152+ delete surface;
153+
154+ qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete);
155 }
156
157 /*
158@@ -1287,6 +1332,10 @@
159 */
160 TEST_F(ApplicationManagerTests,unexpectedStopOfBackgroundWebapp)
161 {
162+ int argc = 0;
163+ char* argv[0];
164+ QCoreApplication qtApp(argc, argv); // app for deleteLater event
165+
166 using namespace ::testing;
167 const QString appId("webapp");
168 const pid_t procId1 = 5551;
169@@ -1336,6 +1385,11 @@
170 onSessionStopping(session1);
171
172 EXPECT_EQ(0, countSpy.count());
173+
174+ delete surface1;
175+ delete surface2;
176+
177+ qtApp.sendPostedEvents(nullptr, QEvent::DeferredDelete);
178 }
179
180 /*
181@@ -1460,6 +1514,8 @@
182
183 EXPECT_EQ(Application::Running, the_app->state());
184 ASSERT_EQ(Application::InternalState::Running, the_app->internalState());
185+
186+ delete surface;
187 }
188
189 /*
190@@ -1499,6 +1555,8 @@
191 EXPECT_FALSE(sharedWakelock.enabled());
192 ASSERT_EQ(Application::InternalState::RunningInBackground, application->internalState());
193 EXPECT_EQ(Application::Running, application->state());
194+
195+ delete surface;
196 }
197
198 /*
199@@ -1628,6 +1686,8 @@
200
201 EXPECT_EQ(0, applicationManager.count());
202 EXPECT_TRUE(dir.exists());
203+
204+ delete aSurface;
205 }
206
207 /*
208@@ -1652,6 +1712,8 @@
209 applicationManager.stopApplication(appId);
210
211 EXPECT_EQ(1, spy.count());
212+
213+ delete surface;
214 }
215
216
217@@ -1899,4 +1961,6 @@
218 surface->requestFocus();
219
220 EXPECT_EQ(1, focusRequestedSpy.count());
221+
222+ delete surface;
223 }

Subscribers

People subscribed via source and target branches