Merge lp:~afrantzis/mir/remove-set-gbm-device-nested into lp:mir
- remove-set-gbm-device-nested
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Alexandros Frantzis |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2298 |
Proposed branch: | lp:~afrantzis/mir/remove-set-gbm-device-nested |
Merge into: | lp:mir |
Prerequisite: | lp:~afrantzis/mir/platform-operation-set-gbm-device |
Diff against target: |
623 lines (+162/-105) 17 files modified
src/client/mir_connection_api.cpp (+11/-6) src/include/platform/mir/graphics/nested_context.h (+0/-1) src/platforms/mesa/client/client_platform.cpp (+6/-5) src/platforms/mesa/server/guest_platform.cpp (+48/-19) src/platforms/mesa/server/guest_platform.h (+1/-1) src/platforms/mesa/server/ipc_operations.cpp (+10/-9) src/platforms/mesa/server/nested_authentication.cpp (+10/-9) src/server/frontend/session_mediator.cpp (+8/-7) src/server/graphics/nested/mir_client_host_connection.cpp (+0/-10) src/server/graphics/nested/mir_client_host_connection.h (+0/-1) tests/include/mir_test_doubles/mock_nested_context.h (+15/-1) tests/include/mir_test_doubles/stub_host_connection.h (+0/-1) tests/integration-tests/test_drm_auth_magic.cpp (+5/-3) tests/unit-tests/client/mesa/test_client_platform.cpp (+12/-5) tests/unit-tests/graphics/mesa/test_guest_platform.cpp (+22/-1) tests/unit-tests/graphics/mesa/test_ipc_operations.cpp (+5/-3) tests/unit-tests/graphics/mesa/test_nested_authentication.cpp (+9/-23) |
To merge this branch: | bzr merge lp:~afrantzis/mir/remove-set-gbm-device-nested |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Alan Griffiths | Approve | ||
Daniel van Vugt | Pending | ||
Review via email: mp+248337@code.launchpad.net |
This proposal supersedes a proposal from 2015-02-02.
Commit message
nested: Replace drm_set_gbm_device calls with platform_operation calls
Description of the change
nested: Replace drm_set_gbm_device calls with platform_operation calls
This MP removes the last instance of a platform-dependent API from the nested server.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Targeting the wrong branch now. Somehow!?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2283
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
244 + auto request_ptr = reinterpret_
245 + request_
Here and elsewhere you're reinterpret_casting data allocated with a uint8_t alignment to structure that needs stricter alignment (e.g. int or type*). That isn't safe (and even on processors where it is "safe" can be very inefficient.
Alexandros Frantzis (afrantzis) wrote : | # |
Failure seems unrelated. Rebuilding.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2283
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
> 244 + auto request_ptr = reinterpret_
> 245 + request_
>
> Here and elsewhere you're reinterpret_casting data allocated with a uint8_t alignment to structure > that needs stricter alignment (e.g. int or type*). That isn't safe (and even on processors where it > is "safe" can be very inefficient.
Fixed. I also fixed instances of this issue introduced by earlier branches.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2284
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2285
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'src/client/mir_connection_api.cpp' | |||
2 | --- src/client/mir_connection_api.cpp 2015-02-03 18:51:02 +0000 | |||
3 | +++ src/client/mir_connection_api.cpp 2015-02-04 15:02:31 +0000 | |||
4 | @@ -346,9 +346,12 @@ | |||
5 | 346 | static_cast<AuthMagicPlatformOperationContext*>(context)}; | 346 | static_cast<AuthMagicPlatformOperationContext*>(context)}; |
6 | 347 | 347 | ||
7 | 348 | auto response_data = mir_platform_message_get_data(response_msg.get()); | 348 | auto response_data = mir_platform_message_get_data(response_msg.get()); |
11 | 349 | auto auth_response = reinterpret_cast<MirMesaAuthMagicResponse const*>(response_data.data); | 349 | MirMesaAuthMagicResponse auth_response{-1}; |
12 | 350 | 350 | ||
13 | 351 | auth_magic_context->callback(auth_response->status, auth_magic_context->context); | 351 | if (response_data.size == sizeof(auth_response)) |
14 | 352 | std::memcpy(&auth_response, response_data.data, response_data.size); | ||
15 | 353 | |||
16 | 354 | auth_magic_context->callback(auth_response.status, auth_magic_context->context); | ||
17 | 352 | } | 355 | } |
18 | 353 | 356 | ||
19 | 354 | void assign_set_gbm_device_status( | 357 | void assign_set_gbm_device_status( |
20 | @@ -359,11 +362,13 @@ | |||
21 | 359 | &mir_platform_message_release); | 362 | &mir_platform_message_release); |
22 | 360 | 363 | ||
23 | 361 | auto const response_data = mir_platform_message_get_data(response_msg.get()); | 364 | auto const response_data = mir_platform_message_get_data(response_msg.get()); |
26 | 362 | auto const set_gbm_device_response_ptr = | 365 | MirMesaSetGBMDeviceResponse set_gbm_device_response{-1}; |
27 | 363 | reinterpret_cast<MirMesaSetGBMDeviceResponse const*>(response_data.data); | 366 | |
28 | 367 | if (response_data.size == sizeof(set_gbm_device_response)) | ||
29 | 368 | std::memcpy(&set_gbm_device_response, response_data.data, response_data.size); | ||
30 | 364 | 369 | ||
31 | 365 | auto status_ptr = static_cast<int*>(context); | 370 | auto status_ptr = static_cast<int*>(context); |
33 | 366 | *status_ptr = set_gbm_device_response_ptr->status; | 371 | *status_ptr = set_gbm_device_response.status; |
34 | 367 | } | 372 | } |
35 | 368 | 373 | ||
36 | 369 | } | 374 | } |
37 | 370 | 375 | ||
38 | === modified file 'src/include/platform/mir/graphics/nested_context.h' | |||
39 | --- src/include/platform/mir/graphics/nested_context.h 2015-02-02 12:18:18 +0000 | |||
40 | +++ src/include/platform/mir/graphics/nested_context.h 2015-02-04 15:02:31 +0000 | |||
41 | @@ -35,7 +35,6 @@ | |||
42 | 35 | virtual ~NestedContext() = default; | 35 | virtual ~NestedContext() = default; |
43 | 36 | 36 | ||
44 | 37 | virtual std::vector<int> platform_fd_items() = 0; | 37 | virtual std::vector<int> platform_fd_items() = 0; |
45 | 38 | virtual void drm_set_gbm_device(struct gbm_device* dev) = 0; | ||
46 | 39 | virtual PlatformOperationMessage platform_operation( | 38 | virtual PlatformOperationMessage platform_operation( |
47 | 40 | unsigned int op, PlatformOperationMessage const& request) = 0; | 39 | unsigned int op, PlatformOperationMessage const& request) = 0; |
48 | 41 | 40 | ||
49 | 42 | 41 | ||
50 | === modified file 'src/platforms/mesa/client/client_platform.cpp' | |||
51 | --- src/platforms/mesa/client/client_platform.cpp 2015-02-03 15:07:44 +0000 | |||
52 | +++ src/platforms/mesa/client/client_platform.cpp 2015-02-04 15:02:31 +0000 | |||
53 | @@ -136,14 +136,15 @@ | |||
54 | 136 | MirPlatformMessage const* msg) | 136 | MirPlatformMessage const* msg) |
55 | 137 | { | 137 | { |
56 | 138 | auto const op = mir_platform_message_get_opcode(msg); | 138 | auto const op = mir_platform_message_get_opcode(msg); |
57 | 139 | auto const msg_data = mir_platform_message_get_data(msg); | ||
58 | 139 | 140 | ||
60 | 140 | if (op == MirMesaPlatformOperation::set_gbm_device) | 141 | if (op == MirMesaPlatformOperation::set_gbm_device && |
61 | 142 | msg_data.size == sizeof(MirMesaSetGBMDeviceRequest)) | ||
62 | 141 | { | 143 | { |
66 | 142 | auto const msg_data = mir_platform_message_get_data(msg); | 144 | MirMesaSetGBMDeviceRequest set_gbm_device_request{nullptr}; |
67 | 143 | auto const set_gbm_device_request_ptr = | 145 | std::memcpy(&set_gbm_device_request, msg_data.data, msg_data.size); |
65 | 144 | reinterpret_cast<MirMesaSetGBMDeviceRequest const*>(msg_data.data); | ||
68 | 145 | 146 | ||
70 | 146 | gbm_dev = set_gbm_device_request_ptr->device; | 147 | gbm_dev = set_gbm_device_request.device; |
71 | 147 | 148 | ||
72 | 148 | static int const success{0}; | 149 | static int const success{0}; |
73 | 149 | MirMesaSetGBMDeviceResponse const response{success}; | 150 | MirMesaSetGBMDeviceResponse const response{success}; |
74 | 150 | 151 | ||
75 | === modified file 'src/platforms/mesa/server/guest_platform.cpp' | |||
76 | --- src/platforms/mesa/server/guest_platform.cpp 2015-01-22 09:00:14 +0000 | |||
77 | +++ src/platforms/mesa/server/guest_platform.cpp 2015-02-04 15:02:31 +0000 | |||
78 | @@ -19,32 +19,67 @@ | |||
79 | 19 | */ | 19 | */ |
80 | 20 | 20 | ||
81 | 21 | #include "guest_platform.h" | 21 | #include "guest_platform.h" |
83 | 22 | 22 | #include "nested_authentication.h" | |
84 | 23 | #include "ipc_operations.h" | ||
85 | 23 | #include "buffer_allocator.h" | 24 | #include "buffer_allocator.h" |
88 | 24 | #include "mir/graphics/buffer_ipc_message.h" | 25 | |
87 | 25 | #include "mir/graphics/platform_ipc_package.h" | ||
89 | 26 | #include "mir/graphics/nested_context.h" | 26 | #include "mir/graphics/nested_context.h" |
94 | 27 | 27 | #include "mir/graphics/platform_operation_message.h" | |
95 | 28 | #include "nested_authentication.h" | 28 | #include "mir_toolkit/mesa/platform_operation.h" |
92 | 29 | |||
93 | 30 | #include "ipc_operations.h" | ||
96 | 31 | 29 | ||
97 | 32 | #include <boost/exception/errinfo_errno.hpp> | 30 | #include <boost/exception/errinfo_errno.hpp> |
98 | 33 | #include <boost/throw_exception.hpp> | 31 | #include <boost/throw_exception.hpp> |
99 | 34 | 32 | ||
100 | 35 | #include <mutex> | 33 | #include <mutex> |
101 | 36 | #include <stdexcept> | 34 | #include <stdexcept> |
102 | 35 | #include <cstring> | ||
103 | 37 | 36 | ||
104 | 38 | namespace mg = mir::graphics; | 37 | namespace mg = mir::graphics; |
105 | 39 | namespace mgm = mg::mesa; | 38 | namespace mgm = mg::mesa; |
106 | 40 | 39 | ||
112 | 41 | mgm::GuestPlatform::GuestPlatform(std::shared_ptr<NestedContext> const& nested_context_arg) | 40 | namespace |
113 | 42 | { | 41 | { |
114 | 43 | //TODO: a bit of round-about initialization to clean up here | 42 | |
115 | 44 | nested_context = nested_context_arg; | 43 | void set_guest_gbm_device(mg::NestedContext& nested_context, gbm_device* gbm_dev) |
116 | 45 | auto fds = nested_context->platform_fd_items(); | 44 | { |
117 | 45 | MirMesaSetGBMDeviceRequest const request{gbm_dev}; | ||
118 | 46 | mg::PlatformOperationMessage request_msg; | ||
119 | 47 | request_msg.data.resize(sizeof(MirMesaSetGBMDeviceRequest)); | ||
120 | 48 | std::memcpy(request_msg.data.data(), &request, sizeof(request)); | ||
121 | 49 | |||
122 | 50 | auto const response_msg = nested_context.platform_operation( | ||
123 | 51 | MirMesaPlatformOperation::set_gbm_device, | ||
124 | 52 | request_msg); | ||
125 | 53 | |||
126 | 54 | if (response_msg.data.size() == sizeof(MirMesaSetGBMDeviceResponse)) | ||
127 | 55 | { | ||
128 | 56 | static int const success{0}; | ||
129 | 57 | MirMesaSetGBMDeviceResponse response{-1}; | ||
130 | 58 | std::memcpy(&response, response_msg.data.data(), response_msg.data.size()); | ||
131 | 59 | if (response.status != success) | ||
132 | 60 | { | ||
133 | 61 | std::string const msg{"Nested Mir failed to set the gbm device."}; | ||
134 | 62 | BOOST_THROW_EXCEPTION( | ||
135 | 63 | boost::enable_error_info(std::runtime_error(msg)) | ||
136 | 64 | << boost::errinfo_errno(response.status)); | ||
137 | 65 | } | ||
138 | 66 | } | ||
139 | 67 | else | ||
140 | 68 | { | ||
141 | 69 | std::string const msg{"Nested Mir failed to set the gbm device: Invalid response."}; | ||
142 | 70 | BOOST_THROW_EXCEPTION(std::runtime_error(msg)); | ||
143 | 71 | } | ||
144 | 72 | } | ||
145 | 73 | |||
146 | 74 | } | ||
147 | 75 | |||
148 | 76 | mgm::GuestPlatform::GuestPlatform( | ||
149 | 77 | std::shared_ptr<NestedContext> const& nested_context) | ||
150 | 78 | : nested_context{nested_context} | ||
151 | 79 | { | ||
152 | 80 | auto const fds = nested_context->platform_fd_items(); | ||
153 | 46 | gbm.setup(fds.at(0)); | 81 | gbm.setup(fds.at(0)); |
155 | 47 | nested_context->drm_set_gbm_device(gbm.device); | 82 | set_guest_gbm_device(*nested_context, gbm.device); |
156 | 48 | ipc_ops = std::make_shared<mgm::IpcOperations>( | 83 | ipc_ops = std::make_shared<mgm::IpcOperations>( |
157 | 49 | std::make_shared<mgm::NestedAuthentication>(nested_context)); | 84 | std::make_shared<mgm::NestedAuthentication>(nested_context)); |
158 | 50 | } | 85 | } |
159 | @@ -61,12 +96,6 @@ | |||
160 | 61 | return std::make_shared<mgm::GuestPlatform>(nested_context); | 96 | return std::make_shared<mgm::GuestPlatform>(nested_context); |
161 | 62 | } | 97 | } |
162 | 63 | 98 | ||
163 | 64 | namespace | ||
164 | 65 | { | ||
165 | 66 | std::shared_ptr<mgm::InternalNativeDisplay> native_display = nullptr; | ||
166 | 67 | std::mutex native_display_guard; | ||
167 | 68 | } | ||
168 | 69 | |||
169 | 70 | std::shared_ptr<mg::PlatformIpcOperations> mgm::GuestPlatform::make_ipc_operations() const | 99 | std::shared_ptr<mg::PlatformIpcOperations> mgm::GuestPlatform::make_ipc_operations() const |
170 | 71 | { | 100 | { |
171 | 72 | return ipc_ops; | 101 | return ipc_ops; |
172 | 73 | 102 | ||
173 | === modified file 'src/platforms/mesa/server/guest_platform.h' | |||
174 | --- src/platforms/mesa/server/guest_platform.h 2015-01-22 09:00:14 +0000 | |||
175 | +++ src/platforms/mesa/server/guest_platform.h 2015-02-04 15:02:31 +0000 | |||
176 | @@ -48,7 +48,7 @@ | |||
177 | 48 | EGLNativeDisplayType egl_native_display() const override; | 48 | EGLNativeDisplayType egl_native_display() const override; |
178 | 49 | 49 | ||
179 | 50 | private: | 50 | private: |
181 | 51 | std::shared_ptr<NestedContext> nested_context; | 51 | std::shared_ptr<NestedContext> const nested_context; |
182 | 52 | helpers::GBMHelper gbm; | 52 | helpers::GBMHelper gbm; |
183 | 53 | std::shared_ptr<PlatformIpcOperations> ipc_ops; | 53 | std::shared_ptr<PlatformIpcOperations> ipc_ops; |
184 | 54 | }; | 54 | }; |
185 | 55 | 55 | ||
186 | === modified file 'src/platforms/mesa/server/ipc_operations.cpp' | |||
187 | --- src/platforms/mesa/server/ipc_operations.cpp 2015-02-02 12:18:18 +0000 | |||
188 | +++ src/platforms/mesa/server/ipc_operations.cpp 2015-02-04 15:02:31 +0000 | |||
189 | @@ -31,6 +31,8 @@ | |||
190 | 31 | #include <boost/exception/get_error_info.hpp> | 31 | #include <boost/exception/get_error_info.hpp> |
191 | 32 | #include <boost/exception/errinfo_errno.hpp> | 32 | #include <boost/exception/errinfo_errno.hpp> |
192 | 33 | 33 | ||
193 | 34 | #include <cstring> | ||
194 | 35 | |||
195 | 34 | namespace mg = mir::graphics; | 36 | namespace mg = mir::graphics; |
196 | 35 | namespace mgm = mir::graphics::mesa; | 37 | namespace mgm = mir::graphics::mesa; |
197 | 36 | 38 | ||
198 | @@ -89,8 +91,7 @@ | |||
199 | 89 | MirMesaAuthMagicRequest auth_magic_request; | 91 | MirMesaAuthMagicRequest auth_magic_request; |
200 | 90 | if (request.data.size() == sizeof(auth_magic_request)) | 92 | if (request.data.size() == sizeof(auth_magic_request)) |
201 | 91 | { | 93 | { |
204 | 92 | auth_magic_request = | 94 | std::memcpy(&auth_magic_request, request.data.data(), request.data.size()); |
203 | 93 | *reinterpret_cast<decltype(auth_magic_request) const*>(request.data.data()); | ||
205 | 94 | } | 95 | } |
206 | 95 | else | 96 | else |
207 | 96 | { | 97 | { |
208 | @@ -98,27 +99,27 @@ | |||
209 | 98 | std::runtime_error("Invalid request message for auth_magic platform operation")); | 99 | std::runtime_error("Invalid request message for auth_magic platform operation")); |
210 | 99 | } | 100 | } |
211 | 100 | 101 | ||
216 | 101 | mg::PlatformOperationMessage response; | 102 | MirMesaAuthMagicResponse auth_magic_response{-1}; |
213 | 102 | response.data.resize(sizeof(MirMesaAuthMagicResponse)); | ||
214 | 103 | auto const auth_magic_response_ptr = | ||
215 | 104 | reinterpret_cast<MirMesaAuthMagicResponse*>(response.data.data()); | ||
217 | 105 | 103 | ||
218 | 106 | try | 104 | try |
219 | 107 | { | 105 | { |
220 | 108 | drm_auth->auth_magic(auth_magic_request.magic); | 106 | drm_auth->auth_magic(auth_magic_request.magic); |
222 | 109 | auth_magic_response_ptr->status = 0; | 107 | auth_magic_response.status = 0; |
223 | 110 | } | 108 | } |
224 | 111 | catch (std::exception const& e) | 109 | catch (std::exception const& e) |
225 | 112 | { | 110 | { |
226 | 113 | auto errno_ptr = boost::get_error_info<boost::errinfo_errno>(e); | 111 | auto errno_ptr = boost::get_error_info<boost::errinfo_errno>(e); |
227 | 114 | 112 | ||
228 | 115 | if (errno_ptr != nullptr) | 113 | if (errno_ptr != nullptr) |
230 | 116 | auth_magic_response_ptr->status = *errno_ptr; | 114 | auth_magic_response.status = *errno_ptr; |
231 | 117 | else | 115 | else |
232 | 118 | throw; | 116 | throw; |
233 | 119 | } | 117 | } |
234 | 120 | 118 | ||
236 | 121 | return response; | 119 | mg::PlatformOperationMessage response_msg; |
237 | 120 | response_msg.data.resize(sizeof(auth_magic_response)); | ||
238 | 121 | std::memcpy(response_msg.data.data(), &auth_magic_response, sizeof(auth_magic_response)); | ||
239 | 122 | return response_msg; | ||
240 | 122 | } | 123 | } |
241 | 123 | else if (op == MirMesaPlatformOperation::auth_fd) | 124 | else if (op == MirMesaPlatformOperation::auth_fd) |
242 | 124 | { | 125 | { |
243 | 125 | 126 | ||
244 | === modified file 'src/platforms/mesa/server/nested_authentication.cpp' | |||
245 | --- src/platforms/mesa/server/nested_authentication.cpp 2015-02-02 12:18:18 +0000 | |||
246 | +++ src/platforms/mesa/server/nested_authentication.cpp 2015-02-04 15:02:31 +0000 | |||
247 | @@ -25,6 +25,8 @@ | |||
248 | 25 | #include <boost/exception/errinfo_errno.hpp> | 25 | #include <boost/exception/errinfo_errno.hpp> |
249 | 26 | #include <boost/throw_exception.hpp> | 26 | #include <boost/throw_exception.hpp> |
250 | 27 | 27 | ||
251 | 28 | #include <cstring> | ||
252 | 29 | |||
253 | 28 | namespace mg = mir::graphics; | 30 | namespace mg = mir::graphics; |
254 | 29 | namespace mgm = mir::graphics::mesa; | 31 | namespace mgm = mir::graphics::mesa; |
255 | 30 | 32 | ||
256 | @@ -33,12 +35,11 @@ | |||
257 | 33 | 35 | ||
258 | 34 | mg::PlatformOperationMessage make_auth_magic_request_message(drm_magic_t magic) | 36 | mg::PlatformOperationMessage make_auth_magic_request_message(drm_magic_t magic) |
259 | 35 | { | 37 | { |
266 | 36 | mg::PlatformOperationMessage request; | 38 | MirMesaAuthMagicRequest const request{magic}; |
267 | 37 | request.data.resize(sizeof(MirMesaAuthMagicRequest)); | 39 | mg::PlatformOperationMessage request_msg; |
268 | 38 | auto auth_magic_request_ptr = | 40 | request_msg.data.resize(sizeof(request)); |
269 | 39 | reinterpret_cast<MirMesaAuthMagicRequest*>(request.data.data()); | 41 | std::memcpy(request_msg.data.data(), &request, sizeof(request)); |
270 | 40 | auth_magic_request_ptr->magic = magic; | 42 | return request_msg; |
265 | 41 | return request; | ||
271 | 42 | } | 43 | } |
272 | 43 | 44 | ||
273 | 44 | MirMesaAuthMagicResponse auth_magic_response_from_message( | 45 | MirMesaAuthMagicResponse auth_magic_response_from_message( |
274 | @@ -46,10 +47,10 @@ | |||
275 | 46 | { | 47 | { |
276 | 47 | if (msg.data.size() == sizeof(MirMesaAuthMagicResponse)) | 48 | if (msg.data.size() == sizeof(MirMesaAuthMagicResponse)) |
277 | 48 | { | 49 | { |
280 | 49 | auto auth_magic_response_ptr = | 50 | MirMesaAuthMagicResponse response{-1}; |
281 | 50 | reinterpret_cast<MirMesaAuthMagicResponse const*>(msg.data.data()); | 51 | std::memcpy(&response, msg.data.data(), msg.data.size()); |
282 | 51 | 52 | ||
284 | 52 | return *auth_magic_response_ptr; | 53 | return response; |
285 | 53 | } | 54 | } |
286 | 54 | 55 | ||
287 | 55 | BOOST_THROW_EXCEPTION( | 56 | BOOST_THROW_EXCEPTION( |
288 | 56 | 57 | ||
289 | === modified file 'src/server/frontend/session_mediator.cpp' | |||
290 | --- src/server/frontend/session_mediator.cpp 2015-02-02 12:18:18 +0000 | |||
291 | +++ src/server/frontend/session_mediator.cpp 2015-02-04 15:02:31 +0000 | |||
292 | @@ -61,6 +61,7 @@ | |||
293 | 61 | 61 | ||
294 | 62 | #include <mutex> | 62 | #include <mutex> |
295 | 63 | #include <functional> | 63 | #include <functional> |
296 | 64 | #include <cstring> | ||
297 | 64 | 65 | ||
298 | 65 | namespace ms = mir::scene; | 66 | namespace ms = mir::scene; |
299 | 66 | namespace mf = mir::frontend; | 67 | namespace mf = mir::frontend; |
300 | @@ -636,18 +637,18 @@ | |||
301 | 636 | 637 | ||
302 | 637 | auto const magic = request->magic(); | 638 | auto const magic = request->magic(); |
303 | 638 | 639 | ||
304 | 640 | MirMesaAuthMagicRequest const auth_magic_request{magic}; | ||
305 | 639 | mg::PlatformOperationMessage platform_request; | 641 | mg::PlatformOperationMessage platform_request; |
310 | 640 | platform_request.data.resize(sizeof(MirMesaAuthMagicRequest)); | 642 | platform_request.data.resize(sizeof(auth_magic_request)); |
311 | 641 | auto const auth_magic_request_ptr = | 643 | std::memcpy(platform_request.data.data(), &auth_magic_request, sizeof(auth_magic_request)); |
308 | 642 | reinterpret_cast<MirMesaAuthMagicRequest*>(platform_request.data.data()); | ||
309 | 643 | *auth_magic_request_ptr = MirMesaAuthMagicRequest{magic}; | ||
312 | 644 | 644 | ||
313 | 645 | auto const platform_response = ipc_operations->platform_operation( | 645 | auto const platform_response = ipc_operations->platform_operation( |
314 | 646 | MirMesaPlatformOperation::auth_magic, platform_request); | 646 | MirMesaPlatformOperation::auth_magic, platform_request); |
315 | 647 | 647 | ||
319 | 648 | auto const auth_magic_response_ptr = | 648 | MirMesaAuthMagicResponse auth_magic_response{-1}; |
320 | 649 | reinterpret_cast<MirMesaAuthMagicResponse const*>(platform_response.data.data()); | 649 | std::memcpy(&auth_magic_response, platform_response.data.data(), |
321 | 650 | response->set_status_code(auth_magic_response_ptr->status); | 650 | platform_response.data.size()); |
322 | 651 | response->set_status_code(auth_magic_response.status); | ||
323 | 651 | 652 | ||
324 | 652 | done->Run(); | 653 | done->Run(); |
325 | 653 | } | 654 | } |
326 | 654 | 655 | ||
327 | === modified file 'src/server/graphics/nested/mir_client_host_connection.cpp' | |||
328 | --- src/server/graphics/nested/mir_client_host_connection.cpp 2015-02-03 18:51:02 +0000 | |||
329 | +++ src/server/graphics/nested/mir_client_host_connection.cpp 2015-02-04 15:02:31 +0000 | |||
330 | @@ -18,7 +18,6 @@ | |||
331 | 18 | 18 | ||
332 | 19 | #include "mir_client_host_connection.h" | 19 | #include "mir_client_host_connection.h" |
333 | 20 | #include "mir_toolkit/mir_client_library.h" | 20 | #include "mir_toolkit/mir_client_library.h" |
334 | 21 | #include "mir_toolkit/mir_client_library_drm.h" | ||
335 | 22 | #include "mir/raii.h" | 21 | #include "mir/raii.h" |
336 | 23 | #include "mir/graphics/platform_operation_message.h" | 22 | #include "mir/graphics/platform_operation_message.h" |
337 | 24 | 23 | ||
338 | @@ -163,15 +162,6 @@ | |||
339 | 163 | mir_connection, surface_parameters); | 162 | mir_connection, surface_parameters); |
340 | 164 | } | 163 | } |
341 | 165 | 164 | ||
342 | 166 | void mgn::MirClientHostConnection::drm_set_gbm_device(struct gbm_device* dev) | ||
343 | 167 | { | ||
344 | 168 | if (!mir_connection_drm_set_gbm_device(mir_connection, dev)) | ||
345 | 169 | { | ||
346 | 170 | std::string const msg("Nested Mir failed to set the gbm device"); | ||
347 | 171 | BOOST_THROW_EXCEPTION(std::runtime_error(msg)); | ||
348 | 172 | } | ||
349 | 173 | } | ||
350 | 174 | |||
351 | 175 | mg::PlatformOperationMessage mgn::MirClientHostConnection::platform_operation( | 165 | mg::PlatformOperationMessage mgn::MirClientHostConnection::platform_operation( |
352 | 176 | unsigned int op, mg::PlatformOperationMessage const& request) | 166 | unsigned int op, mg::PlatformOperationMessage const& request) |
353 | 177 | { | 167 | { |
354 | 178 | 168 | ||
355 | === modified file 'src/server/graphics/nested/mir_client_host_connection.h' | |||
356 | --- src/server/graphics/nested/mir_client_host_connection.h 2015-02-02 12:18:18 +0000 | |||
357 | +++ src/server/graphics/nested/mir_client_host_connection.h 2015-02-04 15:02:31 +0000 | |||
358 | @@ -48,7 +48,6 @@ | |||
359 | 48 | void set_display_config_change_callback(std::function<void()> const& cb) override; | 48 | void set_display_config_change_callback(std::function<void()> const& cb) override; |
360 | 49 | void apply_display_config(MirDisplayConfiguration&) override; | 49 | void apply_display_config(MirDisplayConfiguration&) override; |
361 | 50 | 50 | ||
362 | 51 | void drm_set_gbm_device(struct gbm_device* dev) override; | ||
363 | 52 | virtual PlatformOperationMessage platform_operation( | 51 | virtual PlatformOperationMessage platform_operation( |
364 | 53 | unsigned int op, PlatformOperationMessage const& request) override; | 52 | unsigned int op, PlatformOperationMessage const& request) override; |
365 | 54 | 53 | ||
366 | 55 | 54 | ||
367 | === modified file 'tests/include/mir_test_doubles/mock_nested_context.h' | |||
368 | --- tests/include/mir_test_doubles/mock_nested_context.h 2015-01-26 15:53:18 +0000 | |||
369 | +++ tests/include/mir_test_doubles/mock_nested_context.h 2015-02-04 15:02:31 +0000 | |||
370 | @@ -24,6 +24,21 @@ | |||
371 | 24 | 24 | ||
372 | 25 | namespace mir | 25 | namespace mir |
373 | 26 | { | 26 | { |
374 | 27 | namespace graphics | ||
375 | 28 | { | ||
376 | 29 | inline bool operator==(PlatformOperationMessage const& msg1, | ||
377 | 30 | PlatformOperationMessage const& msg2) | ||
378 | 31 | { | ||
379 | 32 | return msg1.data == msg2.data && msg1.fds == msg2.fds; | ||
380 | 33 | } | ||
381 | 34 | |||
382 | 35 | inline bool operator!=(PlatformOperationMessage const& msg1, | ||
383 | 36 | PlatformOperationMessage const& msg2) | ||
384 | 37 | { | ||
385 | 38 | return !(msg1 == msg2); | ||
386 | 39 | } | ||
387 | 40 | } | ||
388 | 41 | |||
389 | 27 | namespace test | 42 | namespace test |
390 | 28 | { | 43 | { |
391 | 29 | namespace doubles | 44 | namespace doubles |
392 | @@ -33,7 +48,6 @@ | |||
393 | 33 | { | 48 | { |
394 | 34 | MOCK_METHOD0(platform_fd_items, std::vector<int>()); | 49 | MOCK_METHOD0(platform_fd_items, std::vector<int>()); |
395 | 35 | MOCK_METHOD1(drm_auth_magic, void(int magic)); | 50 | MOCK_METHOD1(drm_auth_magic, void(int magic)); |
396 | 36 | MOCK_METHOD1(drm_set_gbm_device, void(struct gbm_device* dev)); | ||
397 | 37 | MOCK_METHOD2(platform_operation, graphics::PlatformOperationMessage( | 51 | MOCK_METHOD2(platform_operation, graphics::PlatformOperationMessage( |
398 | 38 | unsigned int, graphics::PlatformOperationMessage const&)); | 52 | unsigned int, graphics::PlatformOperationMessage const&)); |
399 | 39 | }; | 53 | }; |
400 | 40 | 54 | ||
401 | === modified file 'tests/include/mir_test_doubles/stub_host_connection.h' | |||
402 | --- tests/include/mir_test_doubles/stub_host_connection.h 2015-01-26 15:53:18 +0000 | |||
403 | +++ tests/include/mir_test_doubles/stub_host_connection.h 2015-02-04 15:02:31 +0000 | |||
404 | @@ -61,7 +61,6 @@ | |||
405 | 61 | return std::make_shared<NullHostSurface>(); | 61 | return std::make_shared<NullHostSurface>(); |
406 | 62 | } | 62 | } |
407 | 63 | 63 | ||
408 | 64 | void drm_set_gbm_device(struct gbm_device*) override {} | ||
409 | 65 | graphics::PlatformOperationMessage platform_operation( | 64 | graphics::PlatformOperationMessage platform_operation( |
410 | 66 | unsigned int, graphics::PlatformOperationMessage const&) override | 65 | unsigned int, graphics::PlatformOperationMessage const&) override |
411 | 67 | { | 66 | { |
412 | 68 | 67 | ||
413 | === modified file 'tests/integration-tests/test_drm_auth_magic.cpp' | |||
414 | --- tests/integration-tests/test_drm_auth_magic.cpp 2015-02-02 12:18:18 +0000 | |||
415 | +++ tests/integration-tests/test_drm_auth_magic.cpp 2015-02-04 15:02:31 +0000 | |||
416 | @@ -35,6 +35,8 @@ | |||
417 | 35 | #include <gmock/gmock.h> | 35 | #include <gmock/gmock.h> |
418 | 36 | #include <gtest/gtest.h> | 36 | #include <gtest/gtest.h> |
419 | 37 | 37 | ||
420 | 38 | #include <cstring> | ||
421 | 39 | |||
422 | 38 | namespace mg = mir::graphics; | 40 | namespace mg = mir::graphics; |
423 | 39 | namespace mc = mir::compositor; | 41 | namespace mc = mir::compositor; |
424 | 40 | namespace geom = mir::geometry; | 42 | namespace geom = mir::geometry; |
425 | @@ -102,9 +104,9 @@ | |||
426 | 102 | if (!platform) | 104 | if (!platform) |
427 | 103 | { | 105 | { |
428 | 104 | mg::PlatformOperationMessage pkg; | 106 | mg::PlatformOperationMessage pkg; |
432 | 105 | pkg.data.resize(sizeof(MirMesaAuthMagicResponse)); | 107 | pkg.data.resize(sizeof(auth_magic_response)); |
433 | 106 | *(reinterpret_cast<MirMesaAuthMagicResponse*>(pkg.data.data())) = | 108 | std::memcpy(pkg.data.data(), &auth_magic_response, |
434 | 107 | auth_magic_response; | 109 | sizeof(auth_magic_response)); |
435 | 108 | 110 | ||
436 | 109 | auto ipc_ops = std::make_shared<NiceMock<MockAuthenticatingIpcOps>>(); | 111 | auto ipc_ops = std::make_shared<NiceMock<MockAuthenticatingIpcOps>>(); |
437 | 110 | EXPECT_CALL(*ipc_ops, platform_operation(_,_)) | 112 | EXPECT_CALL(*ipc_ops, platform_operation(_,_)) |
438 | 111 | 113 | ||
439 | === modified file 'tests/unit-tests/client/mesa/test_client_platform.cpp' | |||
440 | --- tests/unit-tests/client/mesa/test_client_platform.cpp 2015-02-03 15:07:44 +0000 | |||
441 | +++ tests/unit-tests/client/mesa/test_client_platform.cpp 2015-02-04 15:02:31 +0000 | |||
442 | @@ -29,6 +29,8 @@ | |||
443 | 29 | #include <gtest/gtest.h> | 29 | #include <gtest/gtest.h> |
444 | 30 | #include <gmock/gmock.h> | 30 | #include <gmock/gmock.h> |
445 | 31 | 31 | ||
446 | 32 | #include <cstring> | ||
447 | 33 | |||
448 | 32 | namespace mcl = mir::client; | 34 | namespace mcl = mir::client; |
449 | 33 | namespace mclm = mir::client::mesa; | 35 | namespace mclm = mir::client::mesa; |
450 | 34 | namespace mtf = mir_test_framework; | 36 | namespace mtf = mir_test_framework; |
451 | @@ -95,9 +97,10 @@ | |||
452 | 95 | ASSERT_THAT(response_msg, NotNull()); | 97 | ASSERT_THAT(response_msg, NotNull()); |
453 | 96 | auto const response_data = mir_platform_message_get_data(response_msg.get()); | 98 | auto const response_data = mir_platform_message_get_data(response_msg.get()); |
454 | 97 | ASSERT_THAT(response_data.size, Eq(sizeof(MirMesaSetGBMDeviceResponse))); | 99 | ASSERT_THAT(response_data.size, Eq(sizeof(MirMesaSetGBMDeviceResponse))); |
458 | 98 | auto const response_ptr = | 100 | |
459 | 99 | reinterpret_cast<MirMesaSetGBMDeviceResponse const*>(response_data.data); | 101 | MirMesaSetGBMDeviceResponse response{-1}; |
460 | 100 | EXPECT_THAT(response_ptr->status, Eq(success)); | 102 | std::memcpy(&response, response_data.data, response_data.size); |
461 | 103 | EXPECT_THAT(response.status, Eq(success)); | ||
462 | 101 | } | 104 | } |
463 | 102 | 105 | ||
464 | 103 | TEST_F(MesaClientPlatformTest, appends_gbm_device_to_platform_package) | 106 | TEST_F(MesaClientPlatformTest, appends_gbm_device_to_platform_package) |
465 | @@ -115,6 +118,10 @@ | |||
466 | 115 | 118 | ||
467 | 116 | platform->populate(pkg); | 119 | platform->populate(pkg); |
468 | 117 | EXPECT_THAT(pkg.data_items, Eq(previous_data_count + (sizeof(gbm_dev_dummy) / sizeof(int)))); | 120 | EXPECT_THAT(pkg.data_items, Eq(previous_data_count + (sizeof(gbm_dev_dummy) / sizeof(int)))); |
471 | 118 | EXPECT_THAT(reinterpret_cast<struct gbm_device*>(pkg.data[previous_data_count]), | 121 | |
472 | 119 | Eq(gbm_dev_dummy)); | 122 | gbm_device* device_in_package{nullptr}; |
473 | 123 | std::memcpy(&device_in_package, &pkg.data[previous_data_count], | ||
474 | 124 | sizeof(device_in_package)); | ||
475 | 125 | |||
476 | 126 | EXPECT_THAT(device_in_package, Eq(gbm_dev_dummy)); | ||
477 | 120 | } | 127 | } |
478 | 121 | 128 | ||
479 | === modified file 'tests/unit-tests/graphics/mesa/test_guest_platform.cpp' | |||
480 | --- tests/unit-tests/graphics/mesa/test_guest_platform.cpp 2015-02-02 12:18:18 +0000 | |||
481 | +++ tests/unit-tests/graphics/mesa/test_guest_platform.cpp 2015-02-04 15:02:31 +0000 | |||
482 | @@ -33,6 +33,8 @@ | |||
483 | 33 | #include <gtest/gtest.h> | 33 | #include <gtest/gtest.h> |
484 | 34 | #include <gmock/gmock.h> | 34 | #include <gmock/gmock.h> |
485 | 35 | 35 | ||
486 | 36 | #include <cstring> | ||
487 | 37 | |||
488 | 36 | namespace mg = mir::graphics; | 38 | namespace mg = mir::graphics; |
489 | 37 | namespace mgm = mir::graphics::mesa; | 39 | namespace mgm = mir::graphics::mesa; |
490 | 38 | namespace mt = mir::test; | 40 | namespace mt = mir::test; |
491 | @@ -49,8 +51,17 @@ | |||
492 | 49 | { | 51 | { |
493 | 50 | using namespace testing; | 52 | using namespace testing; |
494 | 51 | 53 | ||
495 | 54 | MirMesaSetGBMDeviceResponse const response_success{0}; | ||
496 | 55 | mg::PlatformOperationMessage set_gbm_device_success_msg; | ||
497 | 56 | set_gbm_device_success_msg.data.resize(sizeof(response_success)); | ||
498 | 57 | std::memcpy(set_gbm_device_success_msg.data.data(), | ||
499 | 58 | &response_success, sizeof(response_success)); | ||
500 | 59 | |||
501 | 52 | ON_CALL(mock_nested_context, platform_fd_items()) | 60 | ON_CALL(mock_nested_context, platform_fd_items()) |
502 | 53 | .WillByDefault(Return(std::vector<int>{mock_drm.fake_drm.fd()})); | 61 | .WillByDefault(Return(std::vector<int>{mock_drm.fake_drm.fd()})); |
503 | 62 | ON_CALL(mock_nested_context, | ||
504 | 63 | platform_operation(MirMesaPlatformOperation::set_gbm_device, _)) | ||
505 | 64 | .WillByDefault(Return(set_gbm_device_success_msg)); | ||
506 | 54 | } | 65 | } |
507 | 55 | 66 | ||
508 | 56 | protected: | 67 | protected: |
509 | @@ -69,6 +80,8 @@ | |||
510 | 69 | mg::PlatformOperationMessage auth_fd_response{{},{auth_fd}}; | 80 | mg::PlatformOperationMessage auth_fd_response{{},{auth_fd}}; |
511 | 70 | 81 | ||
512 | 71 | EXPECT_CALL(mock_nested_context, | 82 | EXPECT_CALL(mock_nested_context, |
513 | 83 | platform_operation(MirMesaPlatformOperation::set_gbm_device, _)); | ||
514 | 84 | EXPECT_CALL(mock_nested_context, | ||
515 | 72 | platform_operation(MirMesaPlatformOperation::auth_fd, _)) | 85 | platform_operation(MirMesaPlatformOperation::auth_fd, _)) |
516 | 73 | .WillOnce(Return(auth_fd_response)); | 86 | .WillOnce(Return(auth_fd_response)); |
517 | 74 | 87 | ||
518 | @@ -79,6 +92,14 @@ | |||
519 | 79 | 92 | ||
520 | 80 | TEST_F(MesaGuestPlatformTest, sets_gbm_device_during_initialization) | 93 | TEST_F(MesaGuestPlatformTest, sets_gbm_device_during_initialization) |
521 | 81 | { | 94 | { |
523 | 82 | EXPECT_CALL(mock_nested_context, drm_set_gbm_device(mock_gbm.fake_gbm.device)); | 95 | MirMesaSetGBMDeviceRequest const request{mock_gbm.fake_gbm.device}; |
524 | 96 | mg::PlatformOperationMessage request_msg; | ||
525 | 97 | request_msg.data.resize(sizeof(request)); | ||
526 | 98 | std::memcpy(request_msg.data.data(), &request, sizeof(request)); | ||
527 | 99 | |||
528 | 100 | EXPECT_CALL(mock_nested_context, | ||
529 | 101 | platform_operation(MirMesaPlatformOperation::set_gbm_device, | ||
530 | 102 | request_msg)); | ||
531 | 103 | |||
532 | 83 | mgm::GuestPlatform native(mt::fake_shared(mock_nested_context)); | 104 | mgm::GuestPlatform native(mt::fake_shared(mock_nested_context)); |
533 | 84 | } | 105 | } |
534 | 85 | 106 | ||
535 | === modified file 'tests/unit-tests/graphics/mesa/test_ipc_operations.cpp' | |||
536 | --- tests/unit-tests/graphics/mesa/test_ipc_operations.cpp 2015-02-02 12:18:18 +0000 | |||
537 | +++ tests/unit-tests/graphics/mesa/test_ipc_operations.cpp 2015-02-04 15:02:31 +0000 | |||
538 | @@ -29,6 +29,8 @@ | |||
539 | 29 | #include "mir_test_doubles/mock_drm.h" | 29 | #include "mir_test_doubles/mock_drm.h" |
540 | 30 | #include <gtest/gtest.h> | 30 | #include <gtest/gtest.h> |
541 | 31 | 31 | ||
542 | 32 | #include <cstring> | ||
543 | 33 | |||
544 | 32 | namespace mg = mir::graphics; | 34 | namespace mg = mir::graphics; |
545 | 33 | namespace mt = mir::test; | 35 | namespace mt = mir::test; |
546 | 34 | namespace mtd = mir::test::doubles; | 36 | namespace mtd = mir::test::doubles; |
547 | @@ -101,14 +103,14 @@ | |||
548 | 101 | 103 | ||
549 | 102 | mg::PlatformOperationMessage request_msg; | 104 | mg::PlatformOperationMessage request_msg; |
550 | 103 | request_msg.data.resize(sizeof(request)); | 105 | request_msg.data.resize(sizeof(request)); |
552 | 104 | *(reinterpret_cast<decltype(request)*>(request_msg.data.data())) = request; | 106 | std::memcpy(request_msg.data.data(), &request, sizeof(request)); |
553 | 105 | 107 | ||
554 | 106 | auto response_msg = ipc_ops.platform_operation( | 108 | auto response_msg = ipc_ops.platform_operation( |
555 | 107 | MirMesaPlatformOperation::auth_magic, request_msg); | 109 | MirMesaPlatformOperation::auth_magic, request_msg); |
556 | 108 | 110 | ||
558 | 109 | MirMesaAuthMagicResponse response; | 111 | MirMesaAuthMagicResponse response{-1}; |
559 | 110 | ASSERT_THAT(response_msg.data.size(), Eq(sizeof(response))); | 112 | ASSERT_THAT(response_msg.data.size(), Eq(sizeof(response))); |
561 | 111 | response = *(reinterpret_cast<decltype(response)*>(response_msg.data.data())); | 113 | std::memcpy(&response, response_msg.data.data(), response_msg.data.size()); |
562 | 112 | EXPECT_THAT(response.status, Eq(0)); | 114 | EXPECT_THAT(response.status, Eq(0)); |
563 | 113 | } | 115 | } |
564 | 114 | 116 | ||
565 | 115 | 117 | ||
566 | === modified file 'tests/unit-tests/graphics/mesa/test_nested_authentication.cpp' | |||
567 | --- tests/unit-tests/graphics/mesa/test_nested_authentication.cpp 2015-02-02 12:18:18 +0000 | |||
568 | +++ tests/unit-tests/graphics/mesa/test_nested_authentication.cpp 2015-02-04 15:02:31 +0000 | |||
569 | @@ -25,6 +25,8 @@ | |||
570 | 25 | #include "mir_test/fake_shared.h" | 25 | #include "mir_test/fake_shared.h" |
571 | 26 | #include <gtest/gtest.h> | 26 | #include <gtest/gtest.h> |
572 | 27 | 27 | ||
573 | 28 | #include <cstring> | ||
574 | 29 | |||
575 | 28 | namespace mg = mir::graphics; | 30 | namespace mg = mir::graphics; |
576 | 29 | namespace mgm = mir::graphics::mesa; | 31 | namespace mgm = mir::graphics::mesa; |
577 | 30 | namespace mt = mir::test; | 32 | namespace mt = mir::test; |
578 | @@ -40,38 +42,22 @@ | |||
579 | 40 | }; | 42 | }; |
580 | 41 | } | 43 | } |
581 | 42 | 44 | ||
582 | 43 | namespace mir | ||
583 | 44 | { | ||
584 | 45 | namespace graphics | ||
585 | 46 | { | ||
586 | 47 | |||
587 | 48 | bool operator==(mg::PlatformOperationMessage const& msg1, | ||
588 | 49 | mg::PlatformOperationMessage const& msg2) | ||
589 | 50 | { | ||
590 | 51 | return msg1.data == msg2.data && | ||
591 | 52 | msg1.fds == msg1.fds; | ||
592 | 53 | } | ||
593 | 54 | } | ||
594 | 55 | |||
595 | 56 | } | ||
596 | 57 | |||
597 | 58 | TEST_F(NestedAuthentication, uses_nested_context_for_auth_magic) | 45 | TEST_F(NestedAuthentication, uses_nested_context_for_auth_magic) |
598 | 59 | { | 46 | { |
599 | 60 | using namespace testing; | 47 | using namespace testing; |
600 | 61 | 48 | ||
601 | 62 | unsigned int const magic{332211}; | 49 | unsigned int const magic{332211}; |
602 | 63 | 50 | ||
603 | 51 | MirMesaAuthMagicRequest const request{magic}; | ||
604 | 64 | mg::PlatformOperationMessage msg; | 52 | mg::PlatformOperationMessage msg; |
608 | 65 | msg.data.resize(sizeof(MirMesaAuthMagicRequest)); | 53 | msg.data.resize(sizeof(request)); |
609 | 66 | *reinterpret_cast<MirMesaAuthMagicRequest*>(msg.data.data()) = | 54 | std::memcpy(msg.data.data(), &request, sizeof(request)); |
607 | 67 | MirMesaAuthMagicRequest{magic}; | ||
610 | 68 | 55 | ||
612 | 69 | int const success{0}; | 56 | MirMesaAuthMagicResponse const success_response{0}; |
613 | 70 | mg::PlatformOperationMessage auth_magic_success_response; | 57 | mg::PlatformOperationMessage auth_magic_success_response; |
618 | 71 | auth_magic_success_response.data.resize(sizeof(MirMesaAuthMagicResponse)); | 58 | auth_magic_success_response.data.resize(sizeof(success_response)); |
619 | 72 | *reinterpret_cast<MirMesaAuthMagicResponse*>( | 59 | std::memcpy(auth_magic_success_response.data.data(), &success_response, |
620 | 73 | auth_magic_success_response.data.data()) = | 60 | sizeof(success_response)); |
617 | 74 | MirMesaAuthMagicResponse{success}; | ||
621 | 75 | 61 | ||
622 | 76 | EXPECT_CALL(mock_nested_context, | 62 | EXPECT_CALL(mock_nested_context, |
623 | 77 | platform_operation(MirMesaPlatformOperation::auth_magic, msg)) | 63 | platform_operation(MirMesaPlatformOperation::auth_magic, msg)) |
PASSED: Continuous integration, rev:2283 jenkins. qa.ubuntu. com/job/ mir-ci/ 2871/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/1150 jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/1149 jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/1110 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 868 jenkins. qa.ubuntu. com/job/ mir-vivid- amd64-ci/ 868/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 1110 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 1110/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/4163 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 17664
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/2871/ rebuild
http://