Merge lp:~andreas-pokorny/mir/fix-1528135 into lp:mir
- fix-1528135
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Andreas Pokorny |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3255 |
Proposed branch: | lp:~andreas-pokorny/mir/fix-1528135 |
Merge into: | lp:mir |
Diff against target: |
315 lines (+187/-45) 5 files modified
debian/mir-test-tools.install (+1/-0) src/server/graphics/default_configuration.cpp (+57/-45) tests/acceptance-tests/test_server_shutdown.cpp (+20/-0) tests/mir_test_framework/CMakeLists.txt (+20/-0) tests/mir_test_framework/platform_graphics_throw.cpp (+89/-0) |
To merge this branch: | bzr merge lp:~andreas-pokorny/mir/fix-1528135 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Mir CI Bot | continuous-integration | Approve | |
Chris Halse Rogers | Approve | ||
Daniel van Vugt | Abstain | ||
Kevin DuBois (community) | Approve | ||
Alan Griffiths | Approve | ||
Review via email:
|
Commit message
Handle exceptions during platform construction
Since we no longer assign the mir::SharedLibrary instance for a graphics platform to a global variable or a DefaultServerCo
Description of the change
I was looking for a more generic solution. But the problem cannot be solved from within make_module_ptr since make_module_ptr is still within the shared library. I.e. one attempt was to attach the SharedLibrary to the exception object instead. That helped only halfways - the exception diagnostic could be printed but still the unwinding information was accessed by libstdc++ again after that. So it just crashed later. I only see a solution that catches the exception outside the library but not too far so that the offending library is still alive...
So the original solution remains unchanged.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alan Griffiths (alan-griffiths) wrote : | # |
No test?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3240
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3240
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
I'm all for fixing bug 1528135 by any means. But it doesn't help the fact that make_module_ptr is fundamentally unsafe and needs fixing or removing completely. We can however treat them as separate issues...
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andreas Pokorny (andreas-pokorny) wrote : | # |
> No test?
Oh right I just need a platform that throws on construcion.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andreas Pokorny (andreas-pokorny) wrote : | # |
Ok this need another change. The test platform is incomplete the exception is thrown to early..
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3241
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3242
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3241
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3242
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3242
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andreas Pokorny (andreas-pokorny) wrote : | # |
8: [----------] 1 test from ServerShutdownW
8: [ RUN ] ServerShutdownW
8: unknown file: Failure
8: C++ exception with description "unrecognised option 'logging'" thrown in the test body.
8: [ FAILED ] ServerShutdownW
8: [----------] 1 test from ServerShutdownW
8:
not the exception i was looking for..
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3243
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3243
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3244
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:3244
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3245
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3245
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/mir-test-tools.install' | |||
2 | --- debian/mir-test-tools.install 2015-10-13 02:10:53 +0000 | |||
3 | +++ debian/mir-test-tools.install 2016-01-20 18:02:01 +0000 | |||
4 | @@ -9,6 +9,7 @@ | |||
5 | 9 | usr/lib/*/mir/tools/libmirclientlttng.so | 9 | usr/lib/*/mir/tools/libmirclientlttng.so |
6 | 10 | usr/lib/*/mir/tools/libmirserverlttng.so | 10 | usr/lib/*/mir/tools/libmirserverlttng.so |
7 | 11 | usr/lib/*/mir/server-platform/graphics-dummy.so | 11 | usr/lib/*/mir/server-platform/graphics-dummy.so |
8 | 12 | usr/lib/*/mir/server-platform/graphics-throw.so | ||
9 | 12 | usr/lib/*/mir/server-platform/input-stub.so | 13 | usr/lib/*/mir/server-platform/input-stub.so |
10 | 13 | usr/lib/*/mir/client-platform/dummy.so | 14 | usr/lib/*/mir/client-platform/dummy.so |
11 | 14 | usr/share/udev_recordings | 15 | usr/share/udev_recordings |
12 | 15 | 16 | ||
13 | === modified file 'src/server/graphics/default_configuration.cpp' | |||
14 | --- src/server/graphics/default_configuration.cpp 2016-01-18 15:48:38 +0000 | |||
15 | +++ src/server/graphics/default_configuration.cpp 2016-01-20 18:02:01 +0000 | |||
16 | @@ -38,12 +38,14 @@ | |||
17 | 38 | #include "mir/abnormal_exit.h" | 38 | #include "mir/abnormal_exit.h" |
18 | 39 | #include "mir/emergency_cleanup.h" | 39 | #include "mir/emergency_cleanup.h" |
19 | 40 | #include "mir/log.h" | 40 | #include "mir/log.h" |
20 | 41 | #include "mir/report_exception.h" | ||
21 | 41 | 42 | ||
22 | 42 | #include "mir_toolkit/common.h" | 43 | #include "mir_toolkit/common.h" |
23 | 43 | 44 | ||
24 | 44 | #include <boost/throw_exception.hpp> | 45 | #include <boost/throw_exception.hpp> |
25 | 45 | 46 | ||
26 | 46 | #include <map> | 47 | #include <map> |
27 | 48 | #include <sstream> | ||
28 | 47 | 49 | ||
29 | 48 | namespace mg = mir::graphics; | 50 | namespace mg = mir::graphics; |
30 | 49 | namespace ml = mir::logging; | 51 | namespace ml = mir::logging; |
31 | @@ -73,51 +75,61 @@ | |||
32 | 73 | [this]()->std::shared_ptr<mg::Platform> | 75 | [this]()->std::shared_ptr<mg::Platform> |
33 | 74 | { | 76 | { |
34 | 75 | std::shared_ptr<mir::SharedLibrary> platform_library; | 77 | std::shared_ptr<mir::SharedLibrary> platform_library; |
80 | 76 | 78 | std::stringstream error_report; | |
81 | 77 | // if a host socket is set we should use the host graphics module to create a "guest" platform | 79 | try |
82 | 78 | if (the_options()->is_set(options::host_socket_opt)) | 80 | { |
83 | 79 | { | 81 | // if a host socket is set we should use the host graphics module to create a "guest" platform |
84 | 80 | auto const host_connection = the_host_connection(); | 82 | if (the_options()->is_set(options::host_socket_opt)) |
85 | 81 | 83 | { | |
86 | 82 | platform_library = std::make_shared<mir::SharedLibrary>(host_connection->graphics_platform_library()); | 84 | auto const host_connection = the_host_connection(); |
87 | 83 | 85 | ||
88 | 84 | auto create_guest_platform = platform_library->load_function<mg::CreateGuestPlatform>( | 86 | platform_library = std::make_shared<mir::SharedLibrary>(host_connection->graphics_platform_library()); |
89 | 85 | "create_guest_platform", | 87 | |
90 | 86 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); | 88 | auto create_guest_platform = platform_library->load_function<mg::CreateGuestPlatform>( |
91 | 87 | 89 | "create_guest_platform", | |
92 | 88 | return create_guest_platform(the_display_report(), host_connection); | 90 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
93 | 89 | } | 91 | |
94 | 90 | 92 | return create_guest_platform(the_display_report(), host_connection); | |
95 | 91 | // fallback to standalone if host socket is unset | 93 | } |
96 | 92 | if (the_options()->is_set(options::platform_graphics_lib)) | 94 | |
97 | 93 | { | 95 | // fallback to standalone if host socket is unset |
98 | 94 | platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib)); | 96 | if (the_options()->is_set(options::platform_graphics_lib)) |
99 | 95 | } | 97 | { |
100 | 96 | else | 98 | platform_library = std::make_shared<mir::SharedLibrary>(the_options()->get<std::string>(options::platform_graphics_lib)); |
101 | 97 | { | 99 | } |
102 | 98 | auto const& path = the_options()->get<std::string>(options::platform_path); | 100 | else |
103 | 99 | auto platforms = mir::libraries_for_path(path, *the_shared_library_prober_report()); | 101 | { |
104 | 100 | if (platforms.empty()) | 102 | auto const& path = the_options()->get<std::string>(options::platform_path); |
105 | 101 | { | 103 | auto platforms = mir::libraries_for_path(path, *the_shared_library_prober_report()); |
106 | 102 | auto msg = "Failed to find any platform plugins in: " + path; | 104 | if (platforms.empty()) |
107 | 103 | throw std::runtime_error(msg.c_str()); | 105 | { |
108 | 104 | } | 106 | auto msg = "Failed to find any platform plugins in: " + path; |
109 | 105 | platform_library = mir::graphics::module_for_device(platforms, dynamic_cast<mir::options::ProgramOption&>(*the_options())); | 107 | throw std::runtime_error(msg.c_str()); |
110 | 106 | } | 108 | } |
111 | 107 | auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>( | 109 | platform_library = mir::graphics::module_for_device(platforms, dynamic_cast<mir::options::ProgramOption&>(*the_options())); |
112 | 108 | "create_host_platform", | 110 | } |
113 | 109 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); | 111 | auto create_host_platform = platform_library->load_function<mg::CreateHostPlatform>( |
114 | 110 | auto describe_module = platform_library->load_function<mg::DescribeModule>( | 112 | "create_host_platform", |
115 | 111 | "describe_graphics_module", | 113 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
116 | 112 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); | 114 | auto describe_module = platform_library->load_function<mg::DescribeModule>( |
117 | 113 | auto description = describe_module(); | 115 | "describe_graphics_module", |
118 | 114 | mir::log_info("Selected driver: %s (version %d.%d.%d)", | 116 | MIR_SERVER_GRAPHICS_PLATFORM_VERSION); |
119 | 115 | description->name, | 117 | auto description = describe_module(); |
120 | 116 | description->major_version, | 118 | mir::log_info("Selected driver: %s (version %d.%d.%d)", |
121 | 117 | description->minor_version, | 119 | description->name, |
122 | 118 | description->micro_version); | 120 | description->major_version, |
123 | 119 | 121 | description->minor_version, | |
124 | 120 | return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report()); | 122 | description->micro_version); |
125 | 123 | |||
126 | 124 | return create_host_platform(the_options(), the_emergency_cleanup(), the_display_report()); | ||
127 | 125 | } | ||
128 | 126 | catch(...) | ||
129 | 127 | { | ||
130 | 128 | // access exception information before platform library gets unloaded | ||
131 | 129 | error_report << "Exception while creating graphics platform" << std::endl; | ||
132 | 130 | mir::report_exception(error_report); | ||
133 | 131 | } | ||
134 | 132 | BOOST_THROW_EXCEPTION(std::runtime_error(error_report.str())); | ||
135 | 121 | }); | 133 | }); |
136 | 122 | } | 134 | } |
137 | 123 | 135 | ||
138 | 124 | 136 | ||
139 | === modified file 'tests/acceptance-tests/test_server_shutdown.cpp' | |||
140 | --- tests/acceptance-tests/test_server_shutdown.cpp 2015-08-20 08:40:03 +0000 | |||
141 | +++ tests/acceptance-tests/test_server_shutdown.cpp 2016-01-20 18:02:01 +0000 | |||
142 | @@ -17,14 +17,19 @@ | |||
143 | 17 | */ | 17 | */ |
144 | 18 | 18 | ||
145 | 19 | #include "mir/fatal.h" | 19 | #include "mir/fatal.h" |
146 | 20 | #include "mir/server.h" | ||
147 | 20 | 21 | ||
148 | 21 | #include "mir_test_framework/interprocess_client_server_test.h" | 22 | #include "mir_test_framework/interprocess_client_server_test.h" |
149 | 22 | #include "mir_test_framework/process.h" | 23 | #include "mir_test_framework/process.h" |
150 | 24 | #include "mir_test_framework/temporary_environment_value.h" | ||
151 | 25 | #include "mir_test_framework/executable_path.h" | ||
152 | 26 | #include "mir/test/doubles/null_logger.h" | ||
153 | 23 | 27 | ||
154 | 24 | #include <gtest/gtest.h> | 28 | #include <gtest/gtest.h> |
155 | 25 | 29 | ||
156 | 26 | namespace mt = mir::test; | 30 | namespace mt = mir::test; |
157 | 27 | namespace mtf = mir_test_framework; | 31 | namespace mtf = mir_test_framework; |
158 | 32 | namespace mtd = mt::doubles; | ||
159 | 28 | 33 | ||
160 | 29 | using ServerShutdown = mtf::InterprocessClientServerTest; | 34 | using ServerShutdown = mtf::InterprocessClientServerTest; |
161 | 30 | 35 | ||
162 | @@ -50,6 +55,21 @@ | |||
163 | 50 | } | 55 | } |
164 | 51 | } | 56 | } |
165 | 52 | 57 | ||
166 | 58 | // Regression test for LP: #1528135 | ||
167 | 59 | TEST(ServerShutdownWithException, clean_shutdown_on_plugin_construction_exception) | ||
168 | 60 | { | ||
169 | 61 | char const* argv = "ServerShutdownWithException"; | ||
170 | 62 | mtf::TemporaryEnvironmentValue graphics_platform("MIR_SERVER_PLATFORM_GRAPHICS_LIB", mtf::server_platform("graphics-throw.so").c_str()); | ||
171 | 63 | mtf::TemporaryEnvironmentValue input_platform("MIR_SERVER_PLATFORM_INPUT_LIB", mtf::server_platform("input-stub.so").c_str()); | ||
172 | 64 | mir::Server server; | ||
173 | 65 | |||
174 | 66 | server.add_configuration_option(mtd::logging_opt, mtd::logging_descr, false); | ||
175 | 67 | server.set_command_line_handler([](int, char const* const*){}); | ||
176 | 68 | server.set_command_line(0, &argv); | ||
177 | 69 | server.apply_settings(); | ||
178 | 70 | server.run(); | ||
179 | 71 | } | ||
180 | 72 | |||
181 | 53 | using ServerShutdownDeathTest = ServerShutdown; | 73 | using ServerShutdownDeathTest = ServerShutdown; |
182 | 54 | 74 | ||
183 | 55 | TEST_F(ServerShutdownDeathTest, abort_removes_endpoint) | 75 | TEST_F(ServerShutdownDeathTest, abort_removes_endpoint) |
184 | 56 | 76 | ||
185 | === modified file 'tests/mir_test_framework/CMakeLists.txt' | |||
186 | --- tests/mir_test_framework/CMakeLists.txt 2016-01-12 03:56:59 +0000 | |||
187 | +++ tests/mir_test_framework/CMakeLists.txt 2016-01-20 18:02:01 +0000 | |||
188 | @@ -154,6 +154,25 @@ | |||
189 | 154 | LINK_FLAGS "-Wl,--version-script,${server_symbol_map}" | 154 | LINK_FLAGS "-Wl,--version-script,${server_symbol_map}" |
190 | 155 | ) | 155 | ) |
191 | 156 | 156 | ||
192 | 157 | add_library( | ||
193 | 158 | mirplatformgraphicsthrow MODULE | ||
194 | 159 | platform_graphics_throw.cpp | ||
195 | 160 | ) | ||
196 | 161 | |||
197 | 162 | target_link_libraries( | ||
198 | 163 | mirplatformgraphicsthrow | ||
199 | 164 | |||
200 | 165 | mirplatform | ||
201 | 166 | ) | ||
202 | 167 | |||
203 | 168 | set_target_properties( | ||
204 | 169 | mirplatformgraphicsthrow PROPERTIES; | ||
205 | 170 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/server-modules | ||
206 | 171 | OUTPUT_NAME graphics-throw | ||
207 | 172 | PREFIX "" | ||
208 | 173 | LINK_FLAGS "-Wl,--version-script,${server_symbol_map}" | ||
209 | 174 | ) | ||
210 | 175 | |||
211 | 157 | add_custom_command(TARGET mir-test-framework-static POST_BUILD | 176 | add_custom_command(TARGET mir-test-framework-static POST_BUILD |
212 | 158 | COMMAND ${CMAKE_COMMAND} -E copy_directory | 177 | COMMAND ${CMAKE_COMMAND} -E copy_directory |
213 | 159 | ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/udev_recordings | 178 | ${CMAKE_CURRENT_SOURCE_DIR}/udev_recordings ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/udev_recordings |
214 | @@ -168,6 +187,7 @@ | |||
215 | 168 | string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) | 187 | string (REPLACE " -Wl,--no-undefined" " " CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) |
216 | 169 | 188 | ||
217 | 170 | install(TARGETS mirplatformgraphicsstub LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) | 189 | install(TARGETS mirplatformgraphicsstub LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) |
218 | 190 | install(TARGETS mirplatformgraphicsthrow LIBRARY DESTINATION ${MIR_SERVER_PLATFORM_PATH}) | ||
219 | 171 | 191 | ||
220 | 172 | install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH}) | 192 | install(TARGETS mirclientplatformstub LIBRARY DESTINATION ${MIR_CLIENT_PLATFORM_PATH}) |
221 | 173 | 193 | ||
222 | 174 | 194 | ||
223 | === added file 'tests/mir_test_framework/platform_graphics_throw.cpp' | |||
224 | --- tests/mir_test_framework/platform_graphics_throw.cpp 1970-01-01 00:00:00 +0000 | |||
225 | +++ tests/mir_test_framework/platform_graphics_throw.cpp 2016-01-20 18:02:01 +0000 | |||
226 | @@ -0,0 +1,89 @@ | |||
227 | 1 | /* | ||
228 | 2 | * Copyright © 2015 Canonical Ltd. | ||
229 | 3 | * | ||
230 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
231 | 5 | * under the terms of the GNU General Public License version 3, | ||
232 | 6 | * as published by the Free Software Foundation. | ||
233 | 7 | * | ||
234 | 8 | * This program is distributed in the hope that it will be useful, | ||
235 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
236 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
237 | 11 | * GNU General Public License for more details. | ||
238 | 12 | * | ||
239 | 13 | * You should have received a copy of the GNU General Public License | ||
240 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
241 | 15 | * | ||
242 | 16 | * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com> | ||
243 | 17 | */ | ||
244 | 18 | |||
245 | 19 | #include "mir/graphics/platform.h" | ||
246 | 20 | #include "mir/test/doubles/null_platform.h" | ||
247 | 21 | #include "mir/assert_module_entry_point.h" | ||
248 | 22 | #include "mir/libname.h" | ||
249 | 23 | |||
250 | 24 | #include <boost/throw_exception.hpp> | ||
251 | 25 | |||
252 | 26 | namespace mg = mir::graphics; | ||
253 | 27 | namespace mo = mir::options; | ||
254 | 28 | namespace mir | ||
255 | 29 | { | ||
256 | 30 | namespace options | ||
257 | 31 | { | ||
258 | 32 | class ProgramOption; | ||
259 | 33 | } | ||
260 | 34 | } | ||
261 | 35 | |||
262 | 36 | namespace | ||
263 | 37 | { | ||
264 | 38 | class ExceptionThrowingPlatform : public mir::test::doubles::NullPlatform | ||
265 | 39 | { | ||
266 | 40 | public: | ||
267 | 41 | ExceptionThrowingPlatform() | ||
268 | 42 | { | ||
269 | 43 | BOOST_THROW_EXCEPTION(std::runtime_error("Exception during construction")); | ||
270 | 44 | } | ||
271 | 45 | }; | ||
272 | 46 | |||
273 | 47 | } | ||
274 | 48 | |||
275 | 49 | mg::PlatformPriority probe_graphics_platform(mo::ProgramOption const& /*options*/) | ||
276 | 50 | { | ||
277 | 51 | mir::assert_entry_point_signature<mg::PlatformProbe>(&probe_graphics_platform); | ||
278 | 52 | return mg::PlatformPriority::unsupported; | ||
279 | 53 | } | ||
280 | 54 | |||
281 | 55 | mir::ModuleProperties const description { | ||
282 | 56 | "throw-on-creation", | ||
283 | 57 | MIR_VERSION_MAJOR, | ||
284 | 58 | MIR_VERSION_MINOR, | ||
285 | 59 | MIR_VERSION_MICRO, | ||
286 | 60 | mir::libname() | ||
287 | 61 | }; | ||
288 | 62 | |||
289 | 63 | mir::ModuleProperties const* describe_graphics_module() | ||
290 | 64 | { | ||
291 | 65 | mir::assert_entry_point_signature<mg::DescribeModule>(&describe_graphics_module); | ||
292 | 66 | return &description; | ||
293 | 67 | } | ||
294 | 68 | |||
295 | 69 | void add_graphics_platform_options(boost::program_options::options_description&) | ||
296 | 70 | { | ||
297 | 71 | mir::assert_entry_point_signature<mg::AddPlatformOptions>(&add_graphics_platform_options); | ||
298 | 72 | } | ||
299 | 73 | |||
300 | 74 | mir::UniqueModulePtr<mg::Platform> create_host_platform( | ||
301 | 75 | std::shared_ptr<mo::Option> const&, | ||
302 | 76 | std::shared_ptr<mir::EmergencyCleanupRegistry> const&, | ||
303 | 77 | std::shared_ptr<mg::DisplayReport> const&) | ||
304 | 78 | { | ||
305 | 79 | mir::assert_entry_point_signature<mg::CreateHostPlatform>(&create_host_platform); | ||
306 | 80 | return mir::make_module_ptr<ExceptionThrowingPlatform>(); | ||
307 | 81 | } | ||
308 | 82 | |||
309 | 83 | mir::UniqueModulePtr<mg::Platform> create_guest_platform( | ||
310 | 84 | std::shared_ptr<mg::DisplayReport> const&, | ||
311 | 85 | std::shared_ptr<mg::NestedContext> const&) | ||
312 | 86 | { | ||
313 | 87 | mir::assert_entry_point_signature<mg::CreateGuestPlatform>(&create_guest_platform); | ||
314 | 88 | return mir::make_module_ptr<ExceptionThrowingPlatform>(); | ||
315 | 89 | } |
PASSED: Continuous integration, rev:3240 /mir-jenkins. ubuntu. com/job/ mir-ci/ 40/ /mir-jenkins. ubuntu. com/job/ generic- update- mp/39/console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 40/rebuild
https:/