Mir

Merge lp:~alan-griffiths/mir/spike-nested-server-test-fixture into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1739
Proposed branch: lp:~alan-griffiths/mir/spike-nested-server-test-fixture
Merge into: lp:mir
Diff against target: 447 lines (+128/-146)
6 files modified
include/server/mir/default_server_configuration.h (+5/-1)
src/server/default_server_configuration.cpp (+2/-0)
src/server/graphics/default_configuration.cpp (+14/-5)
src/server/graphics/nested/nested_display.cpp (+0/-4)
src/server/run_mir.cpp (+5/-2)
tests/acceptance-tests/test_nested_mir.cpp (+102/-134)
To merge this branch: bzr merge lp:~alan-griffiths/mir/spike-nested-server-test-fixture
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Abstain
Review via email: mp+224637@code.launchpad.net

Commit message

tests: rework the "nested" tests so that they can actually be run

Description of the change

tests: rework the "nested" tests so that they can actually be run

We need a *lot* more testing around the nested use cases, but restoring the tests we have is a valid first step.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

commented out code:
232 +// EXPECT_CALL(*this, eglInitialize(_, _, _)).Times(1).WillRepeatedly(
233 +// DoAll(WithArgs<1, 2>(Invoke(this, &NestedMockEGL::egl_initialize)), Return(EGL_TRUE)));

looks good otherwise!

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

@https://jenkins.qa.ubuntu.com/job/mir-mediumtests-runner-mako/1884/console
> [ FAILED ] ServerShutdown/OnSignal.removes_endpoint_on_signal/0, where GetParam() = 3
> [ FAILED ] ServerShutdown/OnSignal.removes_endpoint_on_signal/1, where GetParam() = 6
> [ FAILED ] ServerShutdown/OnSignal.removes_endpoint_on_signal/2, where GetParam() = 8
> [ FAILED ] ServerShutdown/OnSignal.removes_endpoint_on_signal/3, where GetParam() = 11
> [ FAILED ] ServerShutdown/OnSignal.removes_endpoint_on_signal/4, where GetParam() = 7

More mako instability?

@https://jenkins.qa.ubuntu.com/job/mir-team-mir-development-branch-utopic-amd64-ci/530/console
> Start 4: mir_acceptance_tests
> Build timed out (after 240 minutes). Marking the build as failed.

Weird, but we see this intermittently and it isn't obvious that the time went anywhere related.

We'll see what happens after I delete the comment Kevin spotted.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

If running all the acceptance tests (not just the groups that ctests runs) there's an interaction with ServerShutdown/OnSignal.removes_endpoint_on_signal/* (which now hangs/times out)

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> If running all the acceptance tests (not just the groups that ctests runs)
> there's an interaction with
> ServerShutdown/OnSignal.removes_endpoint_on_signal/* (which now hangs/times
> out)

Fixed the immediate problem, but there's still a potential issue with "emergency cleanup" of multiple in-process servers. Will tease out a test case for a future MP.

review: Abstain
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

"Build timed out (after 60 minutes). Marking the build as failed."

rebuilding

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

okay, lgtm

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

221 struct NestedServerConfiguration : FakeCommandLine, public mir::DefaultServerConfiguration
332 +struct NestedServer : mtf::InProcessServer, HostServerConfiguration

Not a blocker, but inheriting from FakeCommandLine (pre-existing) or from HostServerConfiguration is a convenience that makes little conceptual sense (vs composition), and may create some confusion.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/server/mir/default_server_configuration.h'
--- include/server/mir/default_server_configuration.h 2014-06-23 17:40:57 +0000
+++ include/server/mir/default_server_configuration.h 2014-06-27 14:49:35 +0000
@@ -98,6 +98,7 @@
98}98}
99namespace graphics99namespace graphics
100{100{
101class NativePlatform;
101class Platform;102class Platform;
102class Display;103class Display;
103class BufferInitializer;104class BufferInitializer;
@@ -164,6 +165,7 @@
164 virtual std::shared_ptr<ServerStatusListener> the_server_status_listener();165 virtual std::shared_ptr<ServerStatusListener> the_server_status_listener();
165 virtual std::shared_ptr<DisplayChanger> the_display_changer();166 virtual std::shared_ptr<DisplayChanger> the_display_changer();
166 virtual std::shared_ptr<graphics::Platform> the_graphics_platform();167 virtual std::shared_ptr<graphics::Platform> the_graphics_platform();
168 virtual std::shared_ptr<graphics::NativePlatform> the_graphics_native_platform();
167 virtual std::shared_ptr<input::InputConfiguration> the_input_configuration();169 virtual std::shared_ptr<input::InputConfiguration> the_input_configuration();
168 virtual std::shared_ptr<input::InputDispatcher> the_input_dispatcher();170 virtual std::shared_ptr<input::InputDispatcher> the_input_dispatcher();
169 virtual std::shared_ptr<input::InputSender> the_input_sender();171 virtual std::shared_ptr<input::InputSender> the_input_sender();
@@ -331,6 +333,7 @@
331 CachedPtr<shell::InputTargeter> input_targeter;333 CachedPtr<shell::InputTargeter> input_targeter;
332 CachedPtr<input::CursorListener> cursor_listener;334 CachedPtr<input::CursorListener> cursor_listener;
333 CachedPtr<graphics::Platform> graphics_platform;335 CachedPtr<graphics::Platform> graphics_platform;
336 CachedPtr<graphics::NativePlatform> graphics_native_platform;
334 CachedPtr<graphics::BufferInitializer> buffer_initializer;337 CachedPtr<graphics::BufferInitializer> buffer_initializer;
335 CachedPtr<graphics::GraphicBufferAllocator> buffer_allocator;338 CachedPtr<graphics::GraphicBufferAllocator> buffer_allocator;
336 CachedPtr<graphics::Display> display;339 CachedPtr<graphics::Display> display;
@@ -367,7 +370,8 @@
367 CachedPtr<compositor::CompositorReport> compositor_report;370 CachedPtr<compositor::CompositorReport> compositor_report;
368 CachedPtr<logging::Logger> logger;371 CachedPtr<logging::Logger> logger;
369 CachedPtr<graphics::DisplayReport> display_report;372 CachedPtr<graphics::DisplayReport> display_report;
370 CachedPtr<time::Clock> clock;373 // static to workaround the singleton clock in AsioMainLoop when running multiple servers
374 static CachedPtr<time::Clock> clock;
371 CachedPtr<MainLoop> main_loop;375 CachedPtr<MainLoop> main_loop;
372 CachedPtr<ServerStatusListener> server_status_listener;376 CachedPtr<ServerStatusListener> server_status_listener;
373 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;377 CachedPtr<graphics::DisplayConfigurationPolicy> display_configuration_policy;
374378
=== modified file 'src/server/default_server_configuration.cpp'
--- src/server/default_server_configuration.cpp 2014-06-17 22:07:15 +0000
+++ src/server/default_server_configuration.cpp 2014-06-27 14:49:35 +0000
@@ -147,6 +147,8 @@
147 });147 });
148}148}
149149
150mir::CachedPtr<mir::time::Clock> mir::DefaultServerConfiguration::clock;
151
150std::shared_ptr<mir::time::Clock> mir::DefaultServerConfiguration::the_clock()152std::shared_ptr<mir::time::Clock> mir::DefaultServerConfiguration::the_clock()
151{153{
152 return clock(154 return clock(
153155
=== modified file 'src/server/graphics/default_configuration.cpp'
--- src/server/graphics/default_configuration.cpp 2014-06-24 21:44:55 +0000
+++ src/server/graphics/default_configuration.cpp 2014-06-27 14:49:35 +0000
@@ -70,22 +70,31 @@
70 return graphics_platform(70 return graphics_platform(
71 [this]()->std::shared_ptr<mg::Platform>71 [this]()->std::shared_ptr<mg::Platform>
72 {72 {
73 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));
74
75 if (!the_options()->is_set(options::host_socket_opt))73 if (!the_options()->is_set(options::host_socket_opt))
76 {74 {
77 // fallback to standalone if host socket is unset75 // fallback to standalone if host socket is unset
76 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));
78 auto create_platform = graphics_lib->load_function<mg::CreatePlatform>("create_platform");77 auto create_platform = graphics_lib->load_function<mg::CreatePlatform>("create_platform");
79 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());78 return create_platform(the_options(), the_emergency_cleanup(), the_display_report());
80 }79 }
8180
82 auto create_native_platform = graphics_lib->load_function<mg::CreateNativePlatform>("create_native_platform");
83
84 return std::make_shared<mir::graphics::nested::NestedPlatform>(81 return std::make_shared<mir::graphics::nested::NestedPlatform>(
85 the_host_connection(),82 the_host_connection(),
86 the_input_dispatcher(),83 the_input_dispatcher(),
87 the_display_report(),84 the_display_report(),
88 create_native_platform(the_display_report()));85 the_graphics_native_platform());
86 });
87}
88
89std::shared_ptr<mg::NativePlatform> mir::DefaultServerConfiguration::the_graphics_native_platform()
90{
91 return graphics_native_platform(
92 [this]()
93 {
94 auto graphics_lib = mir::load_library(the_options()->get<std::string>(options::platform_graphics_lib));
95 auto create_native_platform = graphics_lib->load_function<mg::CreateNativePlatform>("create_native_platform");
96
97 return create_native_platform(the_display_report());
89 });98 });
90}99}
91100
92101
=== modified file 'src/server/graphics/nested/nested_display.cpp'
--- src/server/graphics/nested/nested_display.cpp 2014-06-02 17:07:02 +0000
+++ src/server/graphics/nested/nested_display.cpp 2014-06-27 14:49:35 +0000
@@ -215,10 +215,6 @@
215 });215 });
216 });216 });
217217
218 if (result.empty())
219 BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir needs at least one output for display"));
220
221
222 {218 {
223 std::unique_lock<std::mutex> lock(outputs_mutex);219 std::unique_lock<std::mutex> lock(outputs_mutex);
224 outputs.swap(result);220 outputs.swap(result);
225221
=== modified file 'src/server/run_mir.cpp'
--- src/server/run_mir.cpp 2014-06-02 17:07:02 +0000
+++ src/server/run_mir.cpp 2014-06-27 14:49:35 +0000
@@ -24,6 +24,7 @@
24#include "mir/raii.h"24#include "mir/raii.h"
25#include "mir/emergency_cleanup.h"25#include "mir/emergency_cleanup.h"
2626
27#include <atomic>
27#include <exception>28#include <exception>
28#include <mutex>29#include <mutex>
29#include <csignal>30#include <csignal>
@@ -82,9 +83,11 @@
8283
83 weak_emergency_cleanup = config.the_emergency_cleanup();84 weak_emergency_cleanup = config.the_emergency_cleanup();
8485
86 static std::atomic<unsigned int> concurrent_calls{0};
87
85 auto const raii = raii::paired_calls(88 auto const raii = raii::paired_calls(
86 [&]{ for (auto sig : intercepted) old_handler[sig] = signal(sig, fatal_signal_cleanup); },89 [&]{ if (!concurrent_calls++) for (auto sig : intercepted) old_handler[sig] = signal(sig, fatal_signal_cleanup); },
87 [&]{ for (auto sig : intercepted) signal(sig, old_handler[sig]); });90 [&]{ if (!--concurrent_calls) for (auto sig : intercepted) signal(sig, old_handler[sig]); });
8891
89 init(server);92 init(server);
90 server.run();93 server.run();
9194
=== modified file 'tests/acceptance-tests/test_nested_mir.cpp'
--- tests/acceptance-tests/test_nested_mir.cpp 2014-06-11 16:11:32 +0000
+++ tests/acceptance-tests/test_nested_mir.cpp 2014-06-27 14:49:35 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright © 2013 Canonical Ltd.2 * Copyright © 2013-2014 Canonical Ltd.
3 *3 *
4 * This program is free software: you can redistribute it and/or modify it4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,5 * under the terms of the GNU General Public License version 3,
@@ -17,23 +17,21 @@
17 */17 */
1818
19#include "mir/frontend/session_mediator_report.h"19#include "mir/frontend/session_mediator_report.h"
20#include "mir/graphics/native_platform.h"
20#include "mir/display_server.h"21#include "mir/display_server.h"
21#include "mir/run_mir.h"22#include "mir/run_mir.h"
2223
23#include "mir_test_framework/display_server_test_fixture.h"24#include "mir_test_framework/in_process_server.h"
24#include "mir_test_doubles/mock_gl.h"25#include "mir_test_framework/stubbed_server_configuration.h"
26
25#include "mir_test_doubles/mock_egl.h"27#include "mir_test_doubles/mock_egl.h"
2628
27#ifndef ANDROID29#include <gtest/gtest.h>
28#include "mir_test_doubles/mock_gbm.h"
29#endif
30
31#include <gmock/gmock.h>30#include <gmock/gmock.h>
32#include <gtest/gtest.h>
3331
34namespace mf = mir::frontend;32namespace mf = mir::frontend;
33namespace mg = mir::graphics;
35namespace mtf = mir_test_framework;34namespace mtf = mir_test_framework;
36
37using namespace testing;35using namespace testing;
3836
39namespace37namespace
@@ -67,7 +65,7 @@
67 void session_error(const std::string&, const char*, const std::string&) override {};65 void session_error(const std::string&, const char*, const std::string&) override {};
68};66};
6967
70struct HostServerConfiguration : public mtf::TestingServerConfiguration68struct HostServerConfiguration : mtf::StubbedServerConfiguration
71{69{
72 virtual std::shared_ptr<mf::SessionMediatorReport> the_session_mediator_report()70 virtual std::shared_ptr<mf::SessionMediatorReport> the_session_mediator_report()
73 {71 {
@@ -97,13 +95,61 @@
97 }95 }
98};96};
9997
98struct NativePlatformAdapter : mg::NativePlatform
99{
100 NativePlatformAdapter(std::shared_ptr<mg::Platform> const& adaptee) :
101 adaptee(adaptee) {}
102
103 void initialize(std::shared_ptr<mg::NestedContext> const& /*nested_context*/) override {}
104
105 std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
106 std::shared_ptr<mg::BufferInitializer> const& buffer_initializer) override
107 {
108 return adaptee->create_buffer_allocator(buffer_initializer);
109 }
110
111 std::shared_ptr<mg::PlatformIPCPackage> get_ipc_package() override
112 {
113 return adaptee->get_ipc_package();
114 }
115
116 std::shared_ptr<mg::InternalClient> create_internal_client() override
117 {
118 return adaptee->create_internal_client();
119 }
120
121 void fill_buffer_package(
122 mg::BufferIPCPacker* packer,
123 mg::Buffer const* buffer,
124 mg::BufferIpcMsgType msg_type) const override
125 {
126 return adaptee->fill_buffer_package(packer, buffer, msg_type);
127 }
128
129 std::shared_ptr<mg::Platform> const adaptee;
130};
131
100struct NestedServerConfiguration : FakeCommandLine, public mir::DefaultServerConfiguration132struct NestedServerConfiguration : FakeCommandLine, public mir::DefaultServerConfiguration
101{133{
102 NestedServerConfiguration(std::string const& host_socket) :134 NestedServerConfiguration(
135 std::string const& host_socket,
136 std::shared_ptr<mg::Platform> const& graphics_platform) :
103 FakeCommandLine(host_socket),137 FakeCommandLine(host_socket),
104 DefaultServerConfiguration(FakeCommandLine::argc, FakeCommandLine::argv)138 DefaultServerConfiguration(FakeCommandLine::argc, FakeCommandLine::argv),
105 {139 graphics_platform(graphics_platform)
106 }140 {
141 }
142
143 std::shared_ptr<mg::NativePlatform> the_graphics_native_platform() override
144 {
145 return graphics_native_platform(
146 [this]() -> std::shared_ptr<mg::NativePlatform>
147 {
148 return std::make_shared<NativePlatformAdapter>(graphics_platform);
149 });
150 }
151
152 std::shared_ptr<mg::Platform> const graphics_platform;
107};153};
108154
109struct NestedMockEGL : mir::test::doubles::MockEGL155struct NestedMockEGL : mir::test::doubles::MockEGL
@@ -113,13 +159,6 @@
113 {159 {
114 InSequence init_before_terminate;160 InSequence init_before_terminate;
115 EXPECT_CALL(*this, eglGetDisplay(_)).Times(1);161 EXPECT_CALL(*this, eglGetDisplay(_)).Times(1);
116
117 EXPECT_CALL(*this, eglInitialize(_, _, _)).Times(1).WillRepeatedly(
118 DoAll(WithArgs<1, 2>(Invoke(this, &NestedMockEGL::egl_initialize)), Return(EGL_TRUE)));
119
120 EXPECT_CALL(*this, eglChooseConfig(_, _, _, _, _)).Times(AnyNumber()).WillRepeatedly(
121 DoAll(WithArgs<2, 4>(Invoke(this, &NestedMockEGL::egl_choose_config)), Return(EGL_TRUE)));
122
123 EXPECT_CALL(*this, eglTerminate(_)).Times(1);162 EXPECT_CALL(*this, eglTerminate(_)).Times(1);
124 }163 }
125164
@@ -127,6 +166,18 @@
127 EXPECT_CALL(*this, eglMakeCurrent(_, _, _, _)).Times(AnyNumber());166 EXPECT_CALL(*this, eglMakeCurrent(_, _, _, _)).Times(AnyNumber());
128 EXPECT_CALL(*this, eglDestroySurface(_, _)).Times(AnyNumber());167 EXPECT_CALL(*this, eglDestroySurface(_, _)).Times(AnyNumber());
129168
169 EXPECT_CALL(*this, eglQueryString(_, _)).Times(AnyNumber());
170 ON_CALL(*this, eglQueryString(_,EGL_EXTENSIONS))
171 .WillByDefault(Return("EGL_KHR_image "
172 "EGL_KHR_image_base "
173 "EGL_MESA_drm_image"));
174
175 EXPECT_CALL(*this, eglChooseConfig(_, _, _, _, _)).Times(AnyNumber()).WillRepeatedly(
176 DoAll(WithArgs<2, 4>(Invoke(this, &NestedMockEGL::egl_choose_config)), Return(EGL_TRUE)));
177
178 EXPECT_CALL(*this, eglGetCurrentContext()).Times(AnyNumber());
179 EXPECT_CALL(*this, eglCreatePbufferSurface(_, _, _)).Times(AnyNumber());
180
130 EXPECT_CALL(*this, eglGetProcAddress(StrEq("eglCreateImageKHR"))).Times(AnyNumber());181 EXPECT_CALL(*this, eglGetProcAddress(StrEq("eglCreateImageKHR"))).Times(AnyNumber());
131 EXPECT_CALL(*this, eglGetProcAddress(StrEq("eglDestroyImageKHR"))).Times(AnyNumber());182 EXPECT_CALL(*this, eglGetProcAddress(StrEq("eglDestroyImageKHR"))).Times(AnyNumber());
132 EXPECT_CALL(*this, eglGetProcAddress(StrEq("glEGLImageTargetTexture2DOES"))).Times(AnyNumber());183 EXPECT_CALL(*this, eglGetProcAddress(StrEq("glEGLImageTargetTexture2DOES"))).Times(AnyNumber());
@@ -147,117 +198,39 @@
147 }198 }
148};199};
149200
150struct NestedMockPlatform201struct NestedServer : mtf::InProcessServer, HostServerConfiguration
151#ifndef ANDROID202{
152 : mir::test::doubles::MockGBM203 NestedMockEGL mock_egl;
153#endif204
154{205 virtual mir::DefaultServerConfiguration& server_config()
155 NestedMockPlatform()206 {
156 {207 return *this;
157#ifndef ANDROID
158 InSequence gbm_device_lifecycle;
159 EXPECT_CALL(*this, gbm_create_device(_)).Times(1);
160 EXPECT_CALL(*this, gbm_device_destroy(_)).Times(1);
161#endif
162 }
163};
164
165struct NestedMockGL : NiceMock<mir::test::doubles::MockGL>
166{
167 NestedMockGL() {}
168};
169
170template<class NestedServerConfiguration>
171struct ClientConfig : mtf::TestingClientConfiguration
172{
173 ClientConfig(std::string const& host_socket) : host_socket(host_socket) {}
174
175 std::string const host_socket;
176
177 void exec() override
178 {
179 try
180 {
181 NestedMockPlatform mock_gbm;
182 NestedMockEGL mock_egl;
183 NestedMockGL mock_gl;
184 NestedServerConfiguration nested_config(host_socket);
185
186 mir::run_mir(nested_config, [](mir::DisplayServer& server){server.stop();});
187
188 // TODO - remove FAIL() as we should exit (NB we need logic to cause exit).
189 FAIL();
190 }
191 catch (std::exception const& x)
192 {
193 // TODO - this is only temporary until NestedPlatform is implemented.
194 EXPECT_THAT(x.what(), HasSubstr("Platform::create_buffer_allocator is not implemented yet!"));
195 }
196 }208 }
197};209};
198}210}
199211
200using TestNestedMir = mtf::BespokeDisplayServerTestFixture;212TEST_F(NestedServer, nested_platform_connects_and_disconnects)
201
202// TODO resolve problems running "nested" tests on android and running nested on MESA
203#ifdef ANDROID
204#define DISABLED_ON_ANDROID_AND_MESA(name) DISABLED_##name
205#else
206#define DISABLED_ON_ANDROID_AND_MESA(name) DISABLED_##name
207#endif
208
209TEST_F(TestNestedMir, DISABLED_ON_ANDROID_AND_MESA(nested_platform_connects_and_disconnects))
210{213{
211 struct MyHostServerConfiguration : HostServerConfiguration214 std::string const connection_string{new_connection()};
212 {215 NestedServerConfiguration nested_config{connection_string, the_graphics_platform()};
213 void exec() override216
214 {217 InSequence seq;
215 InSequence seq;218 EXPECT_CALL(*mock_session_mediator_report, session_connect_called(_)).Times(1);
216 EXPECT_CALL(*mock_session_mediator_report, session_connect_called(_)).Times(1);219 EXPECT_CALL(*mock_session_mediator_report, session_disconnect_called(_)).Times(1);
217 EXPECT_CALL(*mock_session_mediator_report, session_disconnect_called(_)).Times(1);220
218 }221 mir::run_mir(nested_config, [](mir::DisplayServer& server){server.stop();});
219 };
220
221 MyHostServerConfiguration host_config;
222 ClientConfig<NestedServerConfiguration> client_config(host_config.the_socket_file());
223
224
225 launch_server_process(host_config);
226 launch_client_process(client_config);
227}222}
228223
229//////////////////////////////////////////////////////////////////224//////////////////////////////////////////////////////////////////
230// TODO the following tests were used in investigating lifetime issues.225// TODO the following test was used in investigating lifetime issues.
231// TODO they may not have much long term value, but decide that later226// TODO it may not have much long term value, but decide that later.
232227TEST_F(NestedServer, on_exit_display_objects_should_be_destroyed)
233TEST(DisplayLeak, on_exit_display_objects_should_be_destroyed)228{
234{229 std::string const connection_string{new_connection()};
235 struct MyServerConfiguration : mtf::TestingServerConfiguration230
236 {231 struct MyServerConfiguration : NestedServerConfiguration
237 std::shared_ptr<mir::graphics::Display> the_display() override232 {
238 {233 using NestedServerConfiguration::NestedServerConfiguration;
239 auto const& temp = mtf::TestingServerConfiguration::the_display();
240 my_display = temp;
241 return temp;
242 }
243
244 std::weak_ptr<mir::graphics::Display> my_display;
245 };
246
247 MyServerConfiguration host_config;
248
249 mir::run_mir(host_config, [](mir::DisplayServer& server){server.stop();});
250
251 EXPECT_FALSE(host_config.my_display.lock()) << "after run_mir() exits the display should be released";
252}
253
254TEST_F(TestNestedMir, DISABLED_ON_ANDROID_AND_MESA(on_exit_display_objects_should_be_destroyed))
255{
256 struct MyNestedServerConfiguration : NestedServerConfiguration
257 {
258 // TODO clang says "error: inheriting constructors are not supported"
259 // using NestedServerConfiguration::NestedServerConfiguration;
260 MyNestedServerConfiguration(std::string const& host_socket) : NestedServerConfiguration(host_socket) {}
261234
262 std::shared_ptr<mir::graphics::Display> the_display() override235 std::shared_ptr<mir::graphics::Display> the_display() override
263 {236 {
@@ -266,17 +239,12 @@
266 return temp;239 return temp;
267 }240 }
268241
269 ~MyNestedServerConfiguration()
270 {
271 EXPECT_FALSE(my_display.lock()) << "after run_mir() exits the display should be released";
272 }
273
274 std::weak_ptr<mir::graphics::Display> my_display;242 std::weak_ptr<mir::graphics::Display> my_display;
275 };243 };
276244
277 HostServerConfiguration host_config;245 MyServerConfiguration config{connection_string, the_graphics_platform()};
278 ClientConfig<MyNestedServerConfiguration> client_config(host_config.the_socket_file());246
279247 mir::run_mir(config, [](mir::DisplayServer& server){server.stop();});
280 launch_server_process(host_config);248
281 launch_client_process(client_config);249 EXPECT_FALSE(config.my_display.lock()) << "after run_mir() exits the display should be released";
282}250}

Subscribers

People subscribed via source and target branches