Merge lp:~kdub/mir/unit-test-cleanup into lp:mir
- unit-test-cleanup
- Merge into development-branch
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Kevin DuBois | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 1255 | ||||||||
Proposed branch: | lp:~kdub/mir/unit-test-cleanup | ||||||||
Merge into: | lp:mir | ||||||||
Diff against target: |
473 lines (+45/-85) 26 files modified
include/test/mir_test_doubles/mock_egl.h (+0/-1) include/test/mir_test_doubles/mock_hwc_composer_device_1.h (+1/-1) src/server/graphics/android/hwc_layerlist.cpp (+2/-0) tests/mir_test_doubles/mock_egl.cpp (+0/-39) tests/unit-tests/client/android/test_android_native_window.cpp (+2/-2) tests/unit-tests/client/android/test_client_android_registrar.cpp (+1/-1) tests/unit-tests/client/test_client_mir_surface.cpp (+1/-1) tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_fb.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_platform.cpp (+1/-1) tests/unit-tests/graphics/android/test_buffer.cpp (+1/-1) tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp (+2/-9) tests/unit-tests/graphics/android/test_fb_device.cpp (+1/-1) tests/unit-tests/graphics/android/test_hwc10_device.cpp (+8/-6) tests/unit-tests/graphics/android/test_hwc11_device.cpp (+2/-0) tests/unit-tests/graphics/android/test_hwc_display.cpp (+1/-1) tests/unit-tests/graphics/android/test_hwc_layerlist.cpp (+2/-1) tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp (+4/-4) tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp (+1/-1) tests/unit-tests/graphics/android/test_output_builder.cpp (+1/-1) tests/unit-tests/graphics/android/test_server_interpreter.cpp (+1/-1) tests/unit-tests/graphics/android/test_sync_fence.cpp (+1/-1) tests/unit-tests/scene/test_default_focus_mechanism.cpp (+7/-7) tests/unit-tests/scene/test_surface.cpp (+1/-1) tests/unit-tests/scene/test_surface_data.cpp (+1/-1) |
||||||||
To merge this branch: | bzr merge lp:~kdub/mir/unit-test-cleanup | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alan Griffiths | Approve | ||
Daniel van Vugt | Approve | ||
Review via email: mp+196192@code.launchpad.net |
Commit message
clean up unit tests (ran under android) so there's no uninitialized value
errors for the unit-tests/
without gmock warning, unexpected call errors. (LP: #1172184)
Description of the change
partial (but not complete) fix of https:/
Daniel van Vugt (vanvugt) wrote : | # |
Daniel van Vugt (vanvugt) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1249
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
I still don't like creating stubs using NiceMock<>
Kevin DuBois (kdub) wrote : | # |
> Confirmed bug 1253486 is not completely fixed by this. But bug 1172184 looks
> fixed :)
>
> Also, this branch seems to cause a more serious failure that doesn't happen
> with the dev branch:
> [ RUN ] FBDevice.render
> ==7115== Invalid write of size 4
> ==7115== at 0x12E3F3C:
> testing:
> /home/phablet/
> ==7115== Address 0x8c is not stack'd, malloc'd or (recently) free'd
> ==7115==
> ==7115==
> ==7115== Process terminating with default action of signal 11 (SIGSEGV)
> ==7115== Access not within mapped region at address 0x8C
> ==7115== at 0x12E3F3C:
> testing:
> /home/phablet/
ah, didn't re-run after the merge. will take a look
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1250
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) : | # |
Alan Griffiths (alan-griffiths) wrote : | # |
255 + EGLDisplay dpy = reinterpret_
256 + EGLSurface sur = reinterpret_
Do we really need to do anything as non-portable as a reinterpret_cast here? I've used architectures that would fault on putting an unaligned (e.g. odd value) into a pointer register.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1251
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1252
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
255 + int fake_dpy = 0;
256 + int fake_sur = 0;
257 + EGLDisplay dpy = reinterpret_
258 + EGLSurface sur = reinterpret_
Do we really need to do anything as non-portable as a reinterpret_cast here? An implicit cast works just as well.
Kevin DuBois (kdub) wrote : | # |
fixed
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1253
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'include/test/mir_test_doubles/mock_egl.h' |
2 | --- include/test/mir_test_doubles/mock_egl.h 2013-11-21 03:16:21 +0000 |
3 | +++ include/test/mir_test_doubles/mock_egl.h 2013-11-26 17:04:28 +0000 |
4 | @@ -58,7 +58,6 @@ |
5 | public: |
6 | MockEGL(); |
7 | ~MockEGL(); |
8 | - void silence_uninteresting(); |
9 | |
10 | typedef void (*generic_function_pointer_t)(void); |
11 | |
12 | |
13 | === modified file 'include/test/mir_test_doubles/mock_hwc_composer_device_1.h' |
14 | --- include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-22 13:53:36 +0000 |
15 | +++ include/test/mir_test_doubles/mock_hwc_composer_device_1.h 2013-11-26 17:04:28 +0000 |
16 | @@ -87,7 +87,7 @@ |
17 | set_layerlist.back().visibleRegionScreen = {0, nullptr}; |
18 | } |
19 | |
20 | - if (primary_display->hwLayers) |
21 | + if (primary_display->numHwLayers >= 2) |
22 | { |
23 | primary_display->hwLayers[1].releaseFenceFd = fb_fence; |
24 | } |
25 | |
26 | === modified file 'src/server/graphics/android/hwc_layerlist.cpp' |
27 | --- src/server/graphics/android/hwc_layerlist.cpp 2013-11-22 13:53:36 +0000 |
28 | +++ src/server/graphics/android/hwc_layerlist.cpp 2013-11-26 17:04:28 +0000 |
29 | @@ -59,6 +59,8 @@ |
30 | visibleRegionScreen.numRects=1; |
31 | visibleRegionScreen.rects= &visible_rect; |
32 | handle = buffer_handle; |
33 | + |
34 | + memset(&reserved, 0, sizeof(reserved)); |
35 | } |
36 | |
37 | mga::FramebufferLayer::FramebufferLayer() |
38 | |
39 | === modified file 'tests/mir_test_doubles/mock_egl.cpp' |
40 | --- tests/mir_test_doubles/mock_egl.cpp 2013-11-21 03:16:21 +0000 |
41 | +++ tests/mir_test_doubles/mock_egl.cpp 2013-11-26 17:04:28 +0000 |
42 | @@ -122,45 +122,6 @@ |
43 | global_mock_egl = NULL; |
44 | } |
45 | |
46 | -void mtd::MockEGL::silence_uninteresting() |
47 | -{ |
48 | - using namespace testing; |
49 | - EXPECT_CALL(*this, eglGetCurrentDisplay()) |
50 | - .Times(AtLeast(0)); |
51 | - EXPECT_CALL(*this, eglGetDisplay(_)) |
52 | - .Times(AtLeast(0)); |
53 | - EXPECT_CALL(*this, eglGetDisplay(_)) |
54 | - .Times(AtLeast(0)); |
55 | - EXPECT_CALL(*this, eglInitialize(_,_,_)) |
56 | - .Times(AtLeast(0)); |
57 | - EXPECT_CALL(*this, eglGetConfigs(_,_,_, _)) |
58 | - .Times(AtLeast(0)); |
59 | - EXPECT_CALL(*this, eglGetConfigAttrib(_,_,_,_)) |
60 | - .Times(AtLeast(0)); |
61 | - EXPECT_CALL(*this, eglChooseConfig(_,_,_,_,_)) |
62 | - .Times(AtLeast(0)); |
63 | - EXPECT_CALL(*this, eglCreateWindowSurface(_,_,_,_)) |
64 | - .Times(AtLeast(0)); |
65 | - EXPECT_CALL(*this, eglCreatePbufferSurface(_,_,_)) |
66 | - .Times(AtLeast(0)); |
67 | - EXPECT_CALL(*this, eglCreateContext(_,_,_,_)) |
68 | - .Times(AtLeast(0)); |
69 | - EXPECT_CALL(*this, eglMakeCurrent(_,_,_,_)) |
70 | - .Times(AtLeast(0)); |
71 | - EXPECT_CALL(*this, eglDestroyContext(_,_)) |
72 | - .Times(AtLeast(0)); |
73 | - EXPECT_CALL(*this, eglDestroySurface(_,_)) |
74 | - .Times(AtLeast(0)); |
75 | - EXPECT_CALL(*this, eglTerminate(_)) |
76 | - .Times(AtLeast(0)); |
77 | - EXPECT_CALL(*this, eglSwapBuffers(_,_)) |
78 | - .Times(AtLeast(0)); |
79 | - EXPECT_CALL(*this, eglCreateImageKHR(_,_,_,_,_)) |
80 | - .Times(AtLeast(0)); |
81 | - EXPECT_CALL(*this, eglDestroyImageKHR(_,_)) |
82 | - .Times(AtLeast(0)); |
83 | -} |
84 | - |
85 | #define CHECK_GLOBAL_MOCK(rettype) \ |
86 | if (!global_mock_egl) \ |
87 | { \ |
88 | |
89 | === modified file 'tests/unit-tests/client/android/test_android_native_window.cpp' |
90 | --- tests/unit-tests/client/android/test_android_native_window.cpp 2013-11-21 03:16:21 +0000 |
91 | +++ tests/unit-tests/client/android/test_android_native_window.cpp 2013-11-26 17:04:28 +0000 |
92 | @@ -144,7 +144,7 @@ |
93 | using namespace testing; |
94 | |
95 | int fake_fd = 4948; |
96 | - auto mock_buffer = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
97 | + auto mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>(); |
98 | EXPECT_CALL(*mock_buffer, copy_fence()) |
99 | .Times(1) |
100 | .WillOnce(Return(fake_fd)); |
101 | @@ -176,7 +176,7 @@ |
102 | using namespace testing; |
103 | |
104 | ANativeWindowBuffer* returned_buffer; |
105 | - auto mock_buffer = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
106 | + auto mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>(); |
107 | std::shared_ptr<ANativeWindow> window = std::make_shared<mga::MirNativeWindow>(mock_driver_interpreter); |
108 | |
109 | EXPECT_CALL(*mock_driver_interpreter, driver_requests_buffer()) |
110 | |
111 | === modified file 'tests/unit-tests/client/android/test_client_android_registrar.cpp' |
112 | --- tests/unit-tests/client/android/test_client_android_registrar.cpp 2013-11-22 13:53:36 +0000 |
113 | +++ tests/unit-tests/client/android/test_client_android_registrar.cpp 2013-11-26 17:04:28 +0000 |
114 | @@ -205,7 +205,7 @@ |
115 | { |
116 | using namespace testing; |
117 | |
118 | - mock_module = std::make_shared<MockRegistrarDevice>(); |
119 | + mock_module = std::make_shared<NiceMock<MockRegistrarDevice>>(); |
120 | |
121 | width = 41; |
122 | height = 43; |
123 | |
124 | === modified file 'tests/unit-tests/client/test_client_mir_surface.cpp' |
125 | --- tests/unit-tests/client/test_client_mir_surface.cpp 2013-11-22 13:53:36 +0000 |
126 | +++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-11-26 17:04:28 +0000 |
127 | @@ -310,7 +310,7 @@ |
128 | |
129 | test_server->comm->start(); |
130 | |
131 | - mock_buffer_factory = std::make_shared<mt::MockClientBufferFactory>(); |
132 | + mock_buffer_factory = std::make_shared<testing::NiceMock<mt::MockClientBufferFactory>>(); |
133 | |
134 | input_platform = std::make_shared<mt::StubClientInputPlatform>(); |
135 | |
136 | |
137 | === modified file 'tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp' |
138 | --- tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp 2013-11-23 00:40:49 +0000 |
139 | +++ tests/unit-tests/compositor/test_default_display_buffer_compositor.cpp 2013-11-26 17:04:28 +0000 |
140 | @@ -136,7 +136,7 @@ |
141 | |
142 | StubRendererFactory renderer_factory; |
143 | MockScene scene; |
144 | - mtd::MockDisplayBuffer display_buffer; |
145 | + NiceMock<mtd::MockDisplayBuffer> display_buffer; |
146 | |
147 | EXPECT_CALL(renderer_factory.mock_renderer, render(_,_,_)).Times(0); |
148 | |
149 | |
150 | === modified file 'tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp' |
151 | --- tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2013-08-28 03:41:48 +0000 |
152 | +++ tests/unit-tests/graphics/android/test_android_buffer_allocator.cpp 2013-11-26 17:04:28 +0000 |
153 | @@ -42,7 +42,7 @@ |
154 | |
155 | std::shared_ptr<mg::BufferInitializer> const null_buffer_initializer; |
156 | testing::NiceMock<mtd::HardwareAccessMock> hw_access_mock; |
157 | - mtd::MockEGL mock_egl; |
158 | + testing::NiceMock<mtd::MockEGL> mock_egl; |
159 | }; |
160 | |
161 | TEST_F(AndroidGraphicBufferAllocatorTest, allocator_accesses_gralloc_module) |
162 | |
163 | === modified file 'tests/unit-tests/graphics/android/test_android_fb.cpp' |
164 | --- tests/unit-tests/graphics/android/test_android_fb.cpp 2013-11-22 13:53:36 +0000 |
165 | +++ tests/unit-tests/graphics/android/test_android_fb.cpp 2013-11-26 17:04:28 +0000 |
166 | @@ -238,7 +238,7 @@ |
167 | TEST_F(AndroidDisplayTest, test_dpms_configuration_changes_reach_device) |
168 | { |
169 | using namespace testing; |
170 | - auto mock_display_device = std::make_shared<mtd::MockDisplayDevice>(); |
171 | + auto mock_display_device = std::make_shared<NiceMock<mtd::MockDisplayDevice>>(); |
172 | Sequence seq; |
173 | EXPECT_CALL(*mock_display_device, mode(mir_power_mode_on)) |
174 | .InSequence(seq); |
175 | |
176 | === modified file 'tests/unit-tests/graphics/android/test_android_platform.cpp' |
177 | --- tests/unit-tests/graphics/android/test_android_platform.cpp 2013-11-22 13:53:36 +0000 |
178 | +++ tests/unit-tests/graphics/android/test_android_platform.cpp 2013-11-26 17:04:28 +0000 |
179 | @@ -61,7 +61,7 @@ |
180 | } |
181 | |
182 | native_buffer = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
183 | - mock_buffer = std::make_shared<mtd::MockBuffer>(); |
184 | + mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
185 | |
186 | ON_CALL(*native_buffer, handle()) |
187 | .WillByDefault(Return(native_buffer_handle.get())); |
188 | |
189 | === modified file 'tests/unit-tests/graphics/android/test_buffer.cpp' |
190 | --- tests/unit-tests/graphics/android/test_buffer.cpp 2013-10-15 08:53:10 +0000 |
191 | +++ tests/unit-tests/graphics/android/test_buffer.cpp 2013-11-26 17:04:28 +0000 |
192 | @@ -42,7 +42,7 @@ |
193 | virtual void SetUp() |
194 | { |
195 | using namespace testing; |
196 | - mock_native_buffer = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
197 | + mock_native_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>(); |
198 | |
199 | anwb = mock_native_buffer->anwb(); |
200 | anwb->width = 44; |
201 | |
202 | === modified file 'tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp' |
203 | --- tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2013-10-15 08:53:10 +0000 |
204 | +++ tests/unit-tests/graphics/android/test_buffer_tex_bind.cpp 2013-11-26 17:04:28 +0000 |
205 | @@ -38,24 +38,17 @@ |
206 | { |
207 | using namespace testing; |
208 | |
209 | - mock_native_buffer = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
210 | + mock_native_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>(); |
211 | size = geom::Size{300, 220}; |
212 | pf = geom::PixelFormat::abgr_8888; |
213 | extensions = std::make_shared<mg::EGLExtensions>(); |
214 | - |
215 | - mock_egl.silence_uninteresting(); |
216 | }; |
217 | - virtual void TearDown() |
218 | - { |
219 | - buffer.reset(); |
220 | - } |
221 | |
222 | geom::Size size; |
223 | geom::PixelFormat pf; |
224 | |
225 | - mtd::MockEGL mock_egl; |
226 | + testing::NiceMock<mtd::MockEGL> mock_egl; |
227 | std::shared_ptr<mg::EGLExtensions> extensions; |
228 | - std::shared_ptr<mga::Buffer> buffer; |
229 | std::shared_ptr<mtd::MockAndroidNativeBuffer> mock_native_buffer; |
230 | }; |
231 | |
232 | |
233 | === modified file 'tests/unit-tests/graphics/android/test_fb_device.cpp' |
234 | --- tests/unit-tests/graphics/android/test_fb_device.cpp 2013-11-22 13:53:36 +0000 |
235 | +++ tests/unit-tests/graphics/android/test_fb_device.cpp 2013-11-26 17:04:28 +0000 |
236 | @@ -45,7 +45,7 @@ |
237 | fbnum = 4; |
238 | format = HAL_PIXEL_FORMAT_RGBA_8888; |
239 | |
240 | - fb_hal_mock = std::make_shared<mtd::MockFBHalDevice>(width, height, format, fbnum); |
241 | + fb_hal_mock = std::make_shared<NiceMock<mtd::MockFBHalDevice>>(width, height, format, fbnum); |
242 | mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
243 | native_buffer = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
244 | ON_CALL(*mock_buffer, native_buffer_handle()) |
245 | |
246 | === modified file 'tests/unit-tests/graphics/android/test_hwc10_device.cpp' |
247 | --- tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-11-22 13:53:36 +0000 |
248 | +++ tests/unit-tests/graphics/android/test_hwc10_device.cpp 2013-11-26 17:04:28 +0000 |
249 | @@ -61,8 +61,10 @@ |
250 | { |
251 | using namespace testing; |
252 | |
253 | - EGLDisplay dpy; |
254 | - EGLSurface sur; |
255 | + int fake_dpy = 0; |
256 | + int fake_sur = 0; |
257 | + EGLDisplay dpy = &fake_dpy; |
258 | + EGLSurface sur = &fake_sur; |
259 | |
260 | EXPECT_CALL(*mock_hwc_device, set_interface(mock_hwc_device.get(), 1, _)) |
261 | .Times(1); |
262 | @@ -71,8 +73,6 @@ |
263 | |
264 | device.gpu_render(dpy, sur); |
265 | |
266 | - Mock::VerifyAndClearExpectations(mock_hwc_device.get()); |
267 | - |
268 | EXPECT_EQ(dpy, mock_hwc_device->display0_set_content.dpy); |
269 | EXPECT_EQ(sur, mock_hwc_device->display0_set_content.sur); |
270 | EXPECT_EQ(-1, mock_hwc_device->display0_set_content.retireFenceFd); |
271 | @@ -102,8 +102,10 @@ |
272 | { |
273 | using namespace testing; |
274 | |
275 | - EGLDisplay dpy = reinterpret_cast<EGLDisplay>(0x1234); |
276 | - EGLSurface sur = reinterpret_cast<EGLSurface>(0x4455); |
277 | + int fake_dpy = 0; |
278 | + int fake_sur = 0; |
279 | + EGLDisplay dpy = &fake_dpy; |
280 | + EGLSurface sur = &fake_sur; |
281 | EXPECT_CALL(*mock_hwc_device, set_interface(mock_hwc_device.get(), _, _)) |
282 | .Times(1) |
283 | .WillOnce(Return(-1)); |
284 | |
285 | === modified file 'tests/unit-tests/graphics/android/test_hwc11_device.cpp' |
286 | --- tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-11-21 17:20:14 +0000 |
287 | +++ tests/unit-tests/graphics/android/test_hwc11_device.cpp 2013-11-26 17:04:28 +0000 |
288 | @@ -42,6 +42,8 @@ |
289 | { |
290 | using namespace testing; |
291 | |
292 | + dpy = mock_egl.fake_egl_display; |
293 | + surf = mock_egl.fake_egl_surface; |
294 | mock_native_buffer = std::make_shared<testing::NiceMock<mtd::MockAndroidNativeBuffer>>(); |
295 | mock_buffer = std::make_shared<testing::NiceMock<mtd::MockBuffer>>(); |
296 | mock_device = std::make_shared<testing::NiceMock<mtd::MockHWCComposerDevice1>>(); |
297 | |
298 | === modified file 'tests/unit-tests/graphics/android/test_hwc_display.cpp' |
299 | --- tests/unit-tests/graphics/android/test_hwc_display.cpp 2013-11-22 13:53:36 +0000 |
300 | +++ tests/unit-tests/graphics/android/test_hwc_display.cpp 2013-11-26 17:04:28 +0000 |
301 | @@ -49,7 +49,7 @@ |
302 | dummy_display = mock_egl.fake_egl_display; |
303 | dummy_config = mock_egl.fake_configs[0]; |
304 | dummy_context = mock_egl.fake_egl_context; |
305 | - mtd::MockDisplayReport report; |
306 | + testing::NiceMock<mtd::MockDisplayReport> report; |
307 | gl_context = std::make_shared<mga::GLContext>(mga::to_mir_format(mock_egl.fake_visual_id),report); |
308 | mock_fb_bundle = std::make_shared<mtd::MockFBBundle>(); |
309 | } |
310 | |
311 | === modified file 'tests/unit-tests/graphics/android/test_hwc_layerlist.cpp' |
312 | --- tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-11-22 13:53:36 +0000 |
313 | +++ tests/unit-tests/graphics/android/test_hwc_layerlist.cpp 2013-11-26 17:04:28 +0000 |
314 | @@ -39,7 +39,7 @@ |
315 | native_handle_1 = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
316 | native_handle_1->anwb()->width = width; |
317 | native_handle_1->anwb()->height = height; |
318 | - native_handle_2 = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
319 | + native_handle_2 = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>(); |
320 | } |
321 | |
322 | int width; |
323 | @@ -55,6 +55,7 @@ |
324 | hwc_rect_t region = {0,0,width, height}; |
325 | hwc_region_t visible_region {1, ®ion}; |
326 | hwc_layer_1 expected_layer; |
327 | + memset(&expected_layer, 0, sizeof(expected_layer)); |
328 | expected_layer.compositionType = HWC_FRAMEBUFFER_TARGET; |
329 | expected_layer.hints = 0; |
330 | expected_layer.flags = 0; |
331 | |
332 | === modified file 'tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp' |
333 | --- tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp 2013-11-25 11:21:54 +0000 |
334 | +++ tests/unit-tests/graphics/android/test_internal_client_interpreter.cpp 2013-11-26 17:04:28 +0000 |
335 | @@ -48,10 +48,10 @@ |
336 | { |
337 | using namespace testing; |
338 | sz = geom::Size{4, 23}; |
339 | - mock_cache = std::make_shared<mtd::MockInterpreterResourceCache>(); |
340 | - mock_surface = std::make_shared<MockInternalSurface>(); |
341 | - mock_buffer = std::make_shared<mtd::MockBuffer>(); |
342 | - stub_native_buffer = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
343 | + mock_cache = std::make_shared<NiceMock<mtd::MockInterpreterResourceCache>>(); |
344 | + mock_surface = std::make_shared<NiceMock<MockInternalSurface>>(); |
345 | + mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
346 | + stub_native_buffer = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
347 | |
348 | ON_CALL(*mock_surface, swap_buffers(_)) |
349 | .WillByDefault(SetArg<0>(mock_buffer)); |
350 | |
351 | === modified file 'tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp' |
352 | --- tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp 2013-10-15 08:53:10 +0000 |
353 | +++ tests/unit-tests/graphics/android/test_interpreter_buffer_cache.cpp 2013-11-26 17:04:28 +0000 |
354 | @@ -34,7 +34,7 @@ |
355 | stub_buffer1 = std::make_shared<mtd::StubBuffer>(); |
356 | stub_buffer2 = std::make_shared<mtd::StubBuffer>(); |
357 | stub_buffer3 = std::make_shared<mtd::StubBuffer>(); |
358 | - native_buffer1 = std::make_shared<mtd::MockAndroidNativeBuffer>(); |
359 | + native_buffer1 = std::make_shared<testing::NiceMock<mtd::MockAndroidNativeBuffer>>(); |
360 | native_buffer2 = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
361 | native_buffer3 = std::make_shared<mtd::StubAndroidNativeBuffer>(); |
362 | } |
363 | |
364 | === modified file 'tests/unit-tests/graphics/android/test_output_builder.cpp' |
365 | --- tests/unit-tests/graphics/android/test_output_builder.cpp 2013-11-22 13:53:36 +0000 |
366 | +++ tests/unit-tests/graphics/android/test_output_builder.cpp 2013-11-26 17:04:28 +0000 |
367 | @@ -94,7 +94,7 @@ |
368 | .WillByDefault(Return(hw_access_mock.mock_hwc_device)); |
369 | ON_CALL(*mock_resource_factory, create_fb_native_device()) |
370 | .WillByDefault(Return(mt::fake_shared(fb_hal_mock))); |
371 | - mock_display_report = std::make_shared<testing::NiceMock<mtd::MockDisplayReport>>(); |
372 | + mock_display_report = std::make_shared<NiceMock<mtd::MockDisplayReport>>(); |
373 | } |
374 | |
375 | testing::NiceMock<mtd::MockEGL> mock_egl; |
376 | |
377 | === modified file 'tests/unit-tests/graphics/android/test_server_interpreter.cpp' |
378 | --- tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-11-22 13:53:36 +0000 |
379 | +++ tests/unit-tests/graphics/android/test_server_interpreter.cpp 2013-11-26 17:04:28 +0000 |
380 | @@ -46,7 +46,7 @@ |
381 | mock_buffer2 = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
382 | mock_buffer3 = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
383 | mock_fb_bundle = std::make_shared<NiceMock<mtd::MockFBBundle>>(); |
384 | - mock_cache = std::make_shared<mtd::MockInterpreterResourceCache>(); |
385 | + mock_cache = std::make_shared<NiceMock<mtd::MockInterpreterResourceCache>>(); |
386 | ON_CALL(*mock_fb_bundle, fb_format()) |
387 | .WillByDefault(Return(geom::PixelFormat::abgr_8888)); |
388 | } |
389 | |
390 | === modified file 'tests/unit-tests/graphics/android/test_sync_fence.cpp' |
391 | --- tests/unit-tests/graphics/android/test_sync_fence.cpp 2013-10-11 23:41:22 +0000 |
392 | +++ tests/unit-tests/graphics/android/test_sync_fence.cpp 2013-11-26 17:04:28 +0000 |
393 | @@ -43,7 +43,7 @@ |
394 | protected: |
395 | virtual void SetUp() |
396 | { |
397 | - mock_fops = std::make_shared<MockFileOps>(); |
398 | + mock_fops = std::make_shared<testing::NiceMock<MockFileOps>>(); |
399 | } |
400 | |
401 | int dummy_fd = 3; |
402 | |
403 | === modified file 'tests/unit-tests/scene/test_default_focus_mechanism.cpp' |
404 | --- tests/unit-tests/scene/test_default_focus_mechanism.cpp 2013-11-25 11:21:54 +0000 |
405 | +++ tests/unit-tests/scene/test_default_focus_mechanism.cpp 2013-11-26 17:04:28 +0000 |
406 | @@ -50,7 +50,7 @@ |
407 | using namespace ::testing; |
408 | |
409 | NiceMock<mtd::MockShellSession> app1; |
410 | - mtd::MockSurface mock_surface(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
411 | + NiceMock<mtd::MockSurface> mock_surface(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
412 | { |
413 | InSequence seq; |
414 | EXPECT_CALL(app1, default_surface()).Times(1) |
415 | @@ -70,9 +70,9 @@ |
416 | using namespace ::testing; |
417 | |
418 | NiceMock<mtd::MockShellSession> app1, app2; |
419 | - mtd::MockSurface mock_surface1(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
420 | - mtd::MockSurface mock_surface2(&app2, std::make_shared<mtd::StubSurfaceBuilder>()); |
421 | - |
422 | + NiceMock<mtd::MockSurface> mock_surface1(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
423 | + NiceMock<mtd::MockSurface> mock_surface2(&app2, std::make_shared<mtd::StubSurfaceBuilder>()); |
424 | + |
425 | ON_CALL(app1, default_surface()).WillByDefault(Return(mt::fake_shared(mock_surface1))); |
426 | ON_CALL(app2, default_surface()).WillByDefault(Return(mt::fake_shared(mock_surface2))); |
427 | |
428 | @@ -96,7 +96,7 @@ |
429 | using namespace ::testing; |
430 | |
431 | NiceMock<mtd::MockShellSession> app1; |
432 | - mtd::MockSurface mock_surface(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
433 | + NiceMock<mtd::MockSurface> mock_surface(&app1, std::make_shared<mtd::StubSurfaceBuilder>()); |
434 | { |
435 | InSequence seq; |
436 | EXPECT_CALL(app1, default_surface()).Times(1) |
437 | @@ -105,8 +105,8 @@ |
438 | .WillOnce(Return(std::shared_ptr<msh::Surface>())); |
439 | } |
440 | |
441 | - mtd::MockInputTargeter targeter; |
442 | - |
443 | + NiceMock<mtd::MockInputTargeter> targeter; |
444 | + |
445 | msh::DefaultFocusMechanism focus_mechanism(mt::fake_shared(targeter), std::make_shared<mtd::StubSurfaceController>()); |
446 | |
447 | { |
448 | |
449 | === modified file 'tests/unit-tests/scene/test_surface.cpp' |
450 | --- tests/unit-tests/scene/test_surface.cpp 2013-11-25 14:35:33 +0000 |
451 | +++ tests/unit-tests/scene/test_surface.cpp 2013-11-26 17:04:28 +0000 |
452 | @@ -166,7 +166,7 @@ |
453 | rect = geom::Rectangle{geom::Point{geom::X{0}, geom::Y{0}}, size}; |
454 | stride = geom::Stride{4 * size.width.as_uint32_t()}; |
455 | mock_buffer_stream = std::make_shared<testing::NiceMock<mtd::MockBufferStream>>(); |
456 | - mock_basic_state = std::make_shared<mtd::MockSurfaceState>(); |
457 | + mock_basic_state = std::make_shared<testing::NiceMock<mtd::MockSurfaceState>>(); |
458 | |
459 | ON_CALL(*mock_buffer_stream, swap_client_buffers(_)) |
460 | .WillByDefault(SetArg<0>(std::make_shared<mtd::StubBuffer>())); |
461 | |
462 | === modified file 'tests/unit-tests/scene/test_surface_data.cpp' |
463 | --- tests/unit-tests/scene/test_surface_data.cpp 2013-11-22 13:53:36 +0000 |
464 | +++ tests/unit-tests/scene/test_surface_data.cpp 2013-11-26 17:04:28 +0000 |
465 | @@ -58,7 +58,7 @@ |
466 | geom::Size size; |
467 | geom::Rectangle rect; |
468 | |
469 | - MockCallback mock_callback; |
470 | + testing::NiceMock<MockCallback> mock_callback; |
471 | std::function<void()> null_change_cb; |
472 | std::function<void()> mock_change_cb; |
473 | }; |
Confirmed bug 1253486 is not completely fixed by this. But bug 1172184 looks fixed :)
Also, this branch seems to cause a more serious failure that doesn't happen with the dev branch: :internal: :UntypedFunctio nMockerBase: :RegisterOwner( void const*) (in /home/phablet/ mir/kdub/ bin/unit- tests) :internal: :UntypedFunctio nMockerBase: :RegisterOwner( void const*) (in /home/phablet/ mir/kdub/ bin/unit- tests)
[ RUN ] FBDevice.render
==7115== Invalid write of size 4
==7115== at 0x12E3F3C: testing:
==7115== Address 0x8c is not stack'd, malloc'd or (recently) free'd
==7115==
==7115==
==7115== Process terminating with default action of signal 11 (SIGSEGV)
==7115== Access not within mapped region at address 0x8C
==7115== at 0x12E3F3C: testing: