Merge lp:~robert-ancell/mir/vt-option into lp:~mir-team/mir/trunk
- vt-option
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Chris Halse Rogers |
Approved revision: | no longer in the source branch. |
Merged at revision: | 763 |
Proposed branch: | lp:~robert-ancell/mir/vt-option |
Merge into: | lp:~mir-team/mir/trunk |
Diff against target: |
487 lines (+92/-28) 12 files modified
examples/render_to_fb.cpp (+4/-1) include/server/mir/graphics/platform.h (+6/-1) src/server/default_server_configuration.cpp (+4/-2) src/server/graphics/android/android_platform.cpp (+3/-1) src/server/graphics/gbm/gbm_platform.cpp (+4/-2) src/server/graphics/gbm/linux_virtual_terminal.cpp (+22/-1) src/server/graphics/gbm/linux_virtual_terminal.h (+1/-0) tests/integration-tests/graphics/android/test_internal_client.cpp (+4/-1) tests/integration-tests/graphics/gbm/test_buffer_integration.cpp (+1/-1) tests/unit-tests/graphics/android/test_android_platform.cpp (+3/-1) tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp (+37/-16) tests/unit-tests/graphics/test_graphics_platform.cpp (+3/-1) |
To merge this branch: | bzr merge lp:~robert-ancell/mir/vt-option |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Halse Rogers | Approve | ||
Daniel van Vugt | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+170476@code.launchpad.net |
Commit message
Allow the VT to run on to be specified
Description of the change
Make it possible to choose the VT. This is required when running from LightDM as it needs to be put on the VT that Plymouth was using. Also if we want Mir to work without a system compositor we need to place each Mir server on a specified VT to be able to switch between them.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:760
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Daniel van Vugt (vanvugt) wrote : | # |
1. Regression: Mouse pointer visible on all VTs (regression of bug 1176117).
2. Regression: X server dies when switching VTs (regression of bug ???).
3. Mir server is not always visible on the VT specified (the screen is not black.. ?).
4. Query: VT numbers seem to be:
-1 -> current
0 -> VT1
1 -> VT2
2 -> VT3
so why not use:
0 -> current
1 -> VT1
2 -> VT2
3 -> VT3
?
Daniel van Vugt (vanvugt) wrote : | # |
4. Umm, I mean you have:
-1 -> current
0 -> VT0 -> tty1 (Alt+F1)
1 -> VT1 -> tty2 (Alt+F2)
but I think this would make more sense to people:
0 --> current
1 -> VT0 -> tty1 (Alt+F1)
2 -> VT1 -> tty2 (Alt+F2)
...
Robert Ancell (robert-ancell) wrote : | # |
VT numbers seem to start at 1, so changed to:
0 --> current
1 -> VT1 -> tty1 (Alt+F1)
2 -> VT1 -> tty2 (Alt+F2)
Robert Ancell (robert-ancell) wrote : | # |
Setting the selected VT to active seems to fix any odd issues I've seen and matches what other display servers do.
Robert Ancell (robert-ancell) wrote : | # |
Daniel van Vugt (vanvugt) wrote : | # |
Cool, works nicely now.
I noticed a little bug, but that's only a side-effect and not really part of this proposal. Running as non-root gives a slightly inaccurate error message now:
(run from tty3) mir_demo_
ERROR: /home/dan/
Dynamic exception type: boost::
std::exception:
[boost:
[boost:
Chris Halse Rogers (raof) wrote : | # |
Looks good to me, does what it says on the tin.
Preview Diff
1 | === modified file 'examples/render_to_fb.cpp' | |||
2 | --- examples/render_to_fb.cpp 2013-05-21 15:11:41 +0000 | |||
3 | +++ examples/render_to_fb.cpp 2013-06-21 01:45:33 +0000 | |||
4 | @@ -23,12 +23,15 @@ | |||
5 | 23 | #include "mir/logging/display_report.h" | 23 | #include "mir/logging/display_report.h" |
6 | 24 | #include "mir/logging/dumb_console_logger.h" | 24 | #include "mir/logging/dumb_console_logger.h" |
7 | 25 | 25 | ||
8 | 26 | #include "mir/options/program_option.h" | ||
9 | 27 | |||
10 | 26 | #include "graphics.h" | 28 | #include "graphics.h" |
11 | 27 | 29 | ||
12 | 28 | #include <csignal> | 30 | #include <csignal> |
13 | 29 | 31 | ||
14 | 30 | namespace mg=mir::graphics; | 32 | namespace mg=mir::graphics; |
15 | 31 | namespace ml=mir::logging; | 33 | namespace ml=mir::logging; |
16 | 34 | namespace mo=mir::options; | ||
17 | 32 | 35 | ||
18 | 33 | namespace | 36 | namespace |
19 | 34 | { | 37 | { |
20 | @@ -54,7 +57,7 @@ | |||
21 | 54 | sigaction(SIGTERM, &sa, NULL); | 57 | sigaction(SIGTERM, &sa, NULL); |
22 | 55 | 58 | ||
23 | 56 | auto logger = std::make_shared<ml::DumbConsoleLogger>(); | 59 | auto logger = std::make_shared<ml::DumbConsoleLogger>(); |
25 | 57 | auto platform = mg::create_platform(std::make_shared<ml::DisplayReport>(logger)); | 60 | auto platform = mg::create_platform(std::make_shared<mo::ProgramOption>(), std::make_shared<ml::DisplayReport>(logger)); |
26 | 58 | auto display = platform->create_display(); | 61 | auto display = platform->create_display(); |
27 | 59 | 62 | ||
28 | 60 | mir::draw::glAnimationBasic gl_animation; | 63 | mir::draw::glAnimationBasic gl_animation; |
29 | 61 | 64 | ||
30 | === modified file 'include/server/mir/graphics/platform.h' | |||
31 | --- include/server/mir/graphics/platform.h 2013-06-19 09:57:32 +0000 | |||
32 | +++ include/server/mir/graphics/platform.h 2013-06-21 01:45:33 +0000 | |||
33 | @@ -34,6 +34,10 @@ | |||
34 | 34 | class Buffer; | 34 | class Buffer; |
35 | 35 | class BufferIPCPacker; | 35 | class BufferIPCPacker; |
36 | 36 | } | 36 | } |
37 | 37 | namespace options | ||
38 | 38 | { | ||
39 | 39 | class Option; | ||
40 | 40 | } | ||
41 | 37 | 41 | ||
42 | 38 | /// Graphics subsystem. Mediates interaction between core system and | 42 | /// Graphics subsystem. Mediates interaction between core system and |
43 | 39 | /// the graphics environment. | 43 | /// the graphics environment. |
44 | @@ -107,13 +111,14 @@ | |||
45 | 107 | /** | 111 | /** |
46 | 108 | * Creates and returns a new graphics platform. | 112 | * Creates and returns a new graphics platform. |
47 | 109 | * | 113 | * |
48 | 114 | * \param [in] options options to use for this platform | ||
49 | 110 | * \param [in] report the object to use to report interesting events from the display subsystem | 115 | * \param [in] report the object to use to report interesting events from the display subsystem |
50 | 111 | * | 116 | * |
51 | 112 | * This factory function needs to be implemented by each platform. | 117 | * This factory function needs to be implemented by each platform. |
52 | 113 | * | 118 | * |
53 | 114 | * \ingroup platform_enablement | 119 | * \ingroup platform_enablement |
54 | 115 | */ | 120 | */ |
56 | 116 | std::shared_ptr<Platform> create_platform(std::shared_ptr<DisplayReport> const& report); | 121 | std::shared_ptr<Platform> create_platform(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report); |
57 | 117 | 122 | ||
58 | 118 | } | 123 | } |
59 | 119 | } | 124 | } |
60 | 120 | 125 | ||
61 | === modified file 'src/server/default_server_configuration.cpp' | |||
62 | --- src/server/default_server_configuration.cpp 2013-06-12 16:25:38 +0000 | |||
63 | +++ src/server/default_server_configuration.cpp 2013-06-21 01:45:33 +0000 | |||
64 | @@ -242,7 +242,9 @@ | |||
65 | 242 | "directory instead of the default logging directory." | 242 | "directory instead of the default logging directory." |
66 | 243 | " [string:default=\"\"]") | 243 | " [string:default=\"\"]") |
67 | 244 | ("ipc-thread-pool", po::value<int>(), | 244 | ("ipc-thread-pool", po::value<int>(), |
69 | 245 | "threads in frontend thread pool. [int:default=10]"); | 245 | "threads in frontend thread pool. [int:default=10]") |
70 | 246 | ("vt", po::value<int>(), | ||
71 | 247 | "VT to run on or 0 to use current. [int:default=0]"); | ||
72 | 246 | } | 248 | } |
73 | 247 | 249 | ||
74 | 248 | boost::program_options::options_description_easy_init mir::DefaultServerConfiguration::add_options() | 250 | boost::program_options::options_description_easy_init mir::DefaultServerConfiguration::add_options() |
75 | @@ -299,7 +301,7 @@ | |||
76 | 299 | // graphics libraries. | 301 | // graphics libraries. |
77 | 300 | // Alternatively, if we want to dynamically load the graphics library | 302 | // Alternatively, if we want to dynamically load the graphics library |
78 | 301 | // then this would be the place to do that. | 303 | // then this would be the place to do that. |
80 | 302 | return mg::create_platform(the_display_report()); | 304 | return mg::create_platform(the_options(), the_display_report()); |
81 | 303 | }); | 305 | }); |
82 | 304 | } | 306 | } |
83 | 305 | 307 | ||
84 | 306 | 308 | ||
85 | === modified file 'src/server/graphics/android/android_platform.cpp' | |||
86 | --- src/server/graphics/android/android_platform.cpp 2013-06-12 10:23:43 +0000 | |||
87 | +++ src/server/graphics/android/android_platform.cpp 2013-06-21 01:45:33 +0000 | |||
88 | @@ -28,11 +28,13 @@ | |||
89 | 28 | #include "mir/graphics/buffer_initializer.h" | 28 | #include "mir/graphics/buffer_initializer.h" |
90 | 29 | #include "mir/compositor/buffer_id.h" | 29 | #include "mir/compositor/buffer_id.h" |
91 | 30 | #include "mir/compositor/buffer_ipc_packer.h" | 30 | #include "mir/compositor/buffer_ipc_packer.h" |
92 | 31 | #include "mir/options/option.h" | ||
93 | 31 | 32 | ||
94 | 32 | namespace mg=mir::graphics; | 33 | namespace mg=mir::graphics; |
95 | 33 | namespace mga=mir::graphics::android; | 34 | namespace mga=mir::graphics::android; |
96 | 34 | namespace mc=mir::compositor; | 35 | namespace mc=mir::compositor; |
97 | 35 | namespace mf=mir::frontend; | 36 | namespace mf=mir::frontend; |
98 | 37 | namespace mo = mir::options; | ||
99 | 36 | 38 | ||
100 | 37 | mga::AndroidPlatform::AndroidPlatform(std::shared_ptr<mg::DisplayReport> const& display_report) | 39 | mga::AndroidPlatform::AndroidPlatform(std::shared_ptr<mg::DisplayReport> const& display_report) |
101 | 38 | : display_report(display_report) | 40 | : display_report(display_report) |
102 | @@ -98,7 +100,7 @@ | |||
103 | 98 | return std::make_shared<mga::InternalClient>(); | 100 | return std::make_shared<mga::InternalClient>(); |
104 | 99 | } | 101 | } |
105 | 100 | 102 | ||
107 | 101 | std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& display_report) | 103 | std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report) |
108 | 102 | { | 104 | { |
109 | 103 | return std::make_shared<mga::AndroidPlatform>(display_report); | 105 | return std::make_shared<mga::AndroidPlatform>(display_report); |
110 | 104 | } | 106 | } |
111 | 105 | 107 | ||
112 | === modified file 'src/server/graphics/gbm/gbm_platform.cpp' | |||
113 | --- src/server/graphics/gbm/gbm_platform.cpp 2013-06-12 10:23:43 +0000 | |||
114 | +++ src/server/graphics/gbm/gbm_platform.cpp 2013-06-21 01:45:33 +0000 | |||
115 | @@ -24,6 +24,7 @@ | |||
116 | 24 | #include "linux_virtual_terminal.h" | 24 | #include "linux_virtual_terminal.h" |
117 | 25 | #include "mir/graphics/platform_ipc_package.h" | 25 | #include "mir/graphics/platform_ipc_package.h" |
118 | 26 | #include "mir/compositor/buffer_ipc_packer.h" | 26 | #include "mir/compositor/buffer_ipc_packer.h" |
119 | 27 | #include "mir/options/option.h" | ||
120 | 27 | 28 | ||
121 | 28 | #include "drm_close_threadsafe.h" | 29 | #include "drm_close_threadsafe.h" |
122 | 29 | 30 | ||
123 | @@ -33,6 +34,7 @@ | |||
124 | 33 | namespace mg = mir::graphics; | 34 | namespace mg = mir::graphics; |
125 | 34 | namespace mgg = mg::gbm; | 35 | namespace mgg = mg::gbm; |
126 | 35 | namespace mc = mir::compositor; | 36 | namespace mc = mir::compositor; |
127 | 37 | namespace mo = mir::options; | ||
128 | 36 | namespace | 38 | namespace |
129 | 37 | { | 39 | { |
130 | 38 | 40 | ||
131 | @@ -142,10 +144,10 @@ | |||
132 | 142 | return std::make_shared<mgg::InternalClient>(internal_native_display); | 144 | return std::make_shared<mgg::InternalClient>(internal_native_display); |
133 | 143 | } | 145 | } |
134 | 144 | 146 | ||
136 | 145 | std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& report) | 147 | std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& report) |
137 | 146 | { | 148 | { |
138 | 147 | auto real_fops = std::make_shared<RealVTFileOperations>(); | 149 | auto real_fops = std::make_shared<RealVTFileOperations>(); |
140 | 148 | auto vt = std::make_shared<mgg::LinuxVirtualTerminal>(real_fops, report); | 150 | auto vt = std::make_shared<mgg::LinuxVirtualTerminal>(real_fops, options->get("vt", 0), report); |
141 | 149 | return std::make_shared<mgg::GBMPlatform>(report, vt); | 151 | return std::make_shared<mgg::GBMPlatform>(report, vt); |
142 | 150 | } | 152 | } |
143 | 151 | 153 | ||
144 | 152 | 154 | ||
145 | === modified file 'src/server/graphics/gbm/linux_virtual_terminal.cpp' | |||
146 | --- src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-04-25 09:48:54 +0000 | |||
147 | +++ src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-06-21 01:45:33 +0000 | |||
148 | @@ -38,10 +38,11 @@ | |||
149 | 38 | 38 | ||
150 | 39 | mgg::LinuxVirtualTerminal::LinuxVirtualTerminal( | 39 | mgg::LinuxVirtualTerminal::LinuxVirtualTerminal( |
151 | 40 | std::shared_ptr<VTFileOperations> const& fops, | 40 | std::shared_ptr<VTFileOperations> const& fops, |
152 | 41 | int vt_number, | ||
153 | 41 | std::shared_ptr<DisplayReport> const& report) | 42 | std::shared_ptr<DisplayReport> const& report) |
154 | 42 | : fops{fops}, | 43 | : fops{fops}, |
155 | 43 | report{report}, | 44 | report{report}, |
157 | 44 | vt_fd{fops, open_vt(find_active_vt_number())}, | 45 | vt_fd{fops, open_vt(vt_number)}, |
158 | 45 | prev_kd_mode{0}, | 46 | prev_kd_mode{0}, |
159 | 46 | prev_vt_mode(), | 47 | prev_vt_mode(), |
160 | 47 | active{true} | 48 | active{true} |
161 | @@ -173,6 +174,13 @@ | |||
162 | 173 | 174 | ||
163 | 174 | int mgg::LinuxVirtualTerminal::open_vt(int vt_number) | 175 | int mgg::LinuxVirtualTerminal::open_vt(int vt_number) |
164 | 175 | { | 176 | { |
165 | 177 | auto activate = true; | ||
166 | 178 | if (vt_number <= 0) | ||
167 | 179 | { | ||
168 | 180 | vt_number = find_active_vt_number(); | ||
169 | 181 | activate = false; | ||
170 | 182 | } | ||
171 | 183 | |||
172 | 176 | std::stringstream vt_path_stream; | 184 | std::stringstream vt_path_stream; |
173 | 177 | vt_path_stream << "/dev/tty" << vt_number; | 185 | vt_path_stream << "/dev/tty" << vt_number; |
174 | 178 | 186 | ||
175 | @@ -189,5 +197,18 @@ | |||
176 | 189 | << boost::errinfo_errno(errno)); | 197 | << boost::errinfo_errno(errno)); |
177 | 190 | } | 198 | } |
178 | 191 | 199 | ||
179 | 200 | if (activate) | ||
180 | 201 | { | ||
181 | 202 | auto status = fops->ioctl(vt_fd, VT_ACTIVATE, vt_number); | ||
182 | 203 | if (status < 0) | ||
183 | 204 | { | ||
184 | 205 | BOOST_THROW_EXCEPTION( | ||
185 | 206 | boost::enable_error_info( | ||
186 | 207 | std::runtime_error("Failed to activate VT")) | ||
187 | 208 | << boost::errinfo_file_name(active_vt_path) | ||
188 | 209 | << boost::errinfo_errno(errno)); | ||
189 | 210 | } | ||
190 | 211 | } | ||
191 | 212 | |||
192 | 192 | return vt_fd; | 213 | return vt_fd; |
193 | 193 | } | 214 | } |
194 | 194 | 215 | ||
195 | === modified file 'src/server/graphics/gbm/linux_virtual_terminal.h' | |||
196 | --- src/server/graphics/gbm/linux_virtual_terminal.h 2013-04-25 09:48:54 +0000 | |||
197 | +++ src/server/graphics/gbm/linux_virtual_terminal.h 2013-06-21 01:45:33 +0000 | |||
198 | @@ -56,6 +56,7 @@ | |||
199 | 56 | { | 56 | { |
200 | 57 | public: | 57 | public: |
201 | 58 | LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops, | 58 | LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops, |
202 | 59 | int vt_number, | ||
203 | 59 | std::shared_ptr<DisplayReport> const& report); | 60 | std::shared_ptr<DisplayReport> const& report); |
204 | 60 | ~LinuxVirtualTerminal() noexcept(true); | 61 | ~LinuxVirtualTerminal() noexcept(true); |
205 | 61 | 62 | ||
206 | 62 | 63 | ||
207 | === modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp' | |||
208 | --- tests/integration-tests/graphics/android/test_internal_client.cpp 2013-06-12 16:22:17 +0000 | |||
209 | +++ tests/integration-tests/graphics/android/test_internal_client.cpp 2013-06-21 01:45:33 +0000 | |||
210 | @@ -34,6 +34,7 @@ | |||
211 | 34 | #include "mir/shell/surface_creation_parameters.h" | 34 | #include "mir/shell/surface_creation_parameters.h" |
212 | 35 | #include "mir/frontend/surface_id.h" | 35 | #include "mir/frontend/surface_id.h" |
213 | 36 | #include "mir/input/input_channel_factory.h" | 36 | #include "mir/input/input_channel_factory.h" |
214 | 37 | #include "mir/options/program_option.h" | ||
215 | 37 | 38 | ||
216 | 38 | #include "mir_test_doubles/stub_input_registrar.h" | 39 | #include "mir_test_doubles/stub_input_registrar.h" |
217 | 39 | 40 | ||
218 | @@ -52,6 +53,7 @@ | |||
219 | 52 | namespace mf=mir::frontend; | 53 | namespace mf=mir::frontend; |
220 | 53 | namespace mi=mir::input; | 54 | namespace mi=mir::input; |
221 | 54 | namespace mtd=mir::test::doubles; | 55 | namespace mtd=mir::test::doubles; |
222 | 56 | namespace mo=mir::options; | ||
223 | 55 | 57 | ||
224 | 56 | namespace | 58 | namespace |
225 | 57 | { | 59 | { |
226 | @@ -95,8 +97,9 @@ | |||
227 | 95 | auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller); | 97 | auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller); |
228 | 96 | auto mir_surface = surface_source->create_surface(params, id, std::shared_ptr<mir::events::EventSink>()); | 98 | auto mir_surface = surface_source->create_surface(params, id, std::shared_ptr<mir::events::EventSink>()); |
229 | 97 | 99 | ||
230 | 100 | auto options = std::shared_ptr<mo::ProgramOption>(); | ||
231 | 98 | auto report = std::shared_ptr<mg::NullDisplayReport>(); | 101 | auto report = std::shared_ptr<mg::NullDisplayReport>(); |
233 | 99 | auto platform = mg::create_platform(report); | 102 | auto platform = mg::create_platform(options, report); |
234 | 100 | auto internal_client = platform->create_internal_client(); | 103 | auto internal_client = platform->create_internal_client(); |
235 | 101 | 104 | ||
236 | 102 | int major, minor, n; | 105 | int major, minor, n; |
237 | 103 | 106 | ||
238 | === modified file 'tests/integration-tests/graphics/gbm/test_buffer_integration.cpp' | |||
239 | --- tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-06-20 08:27:10 +0000 | |||
240 | +++ tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-06-21 01:45:33 +0000 | |||
241 | @@ -100,7 +100,7 @@ | |||
242 | 100 | auto options = mtf::TestingServerConfiguration().the_options(); | 100 | auto options = mtf::TestingServerConfiguration().the_options(); |
243 | 101 | 101 | ||
244 | 102 | if (options->get("tests-use-real-graphics", false)) | 102 | if (options->get("tests-use-real-graphics", false)) |
246 | 103 | platform = mg::create_platform(std::make_shared<mg::NullDisplayReport>()); | 103 | platform = mg::create_platform(options, std::make_shared<mg::NullDisplayReport>()); |
247 | 104 | else | 104 | else |
248 | 105 | platform = std::make_shared<StubGraphicPlatform>(); | 105 | platform = std::make_shared<StubGraphicPlatform>(); |
249 | 106 | 106 | ||
250 | 107 | 107 | ||
251 | === modified file 'tests/unit-tests/graphics/android/test_android_platform.cpp' | |||
252 | --- tests/unit-tests/graphics/android/test_android_platform.cpp 2013-05-17 18:48:07 +0000 | |||
253 | +++ tests/unit-tests/graphics/android/test_android_platform.cpp 2013-06-21 01:45:33 +0000 | |||
254 | @@ -19,6 +19,7 @@ | |||
255 | 19 | #include "mir/graphics/null_display_report.h" | 19 | #include "mir/graphics/null_display_report.h" |
256 | 20 | #include "src/server/graphics/android/android_platform.h" | 20 | #include "src/server/graphics/android/android_platform.h" |
257 | 21 | #include "mir/compositor/buffer_ipc_packer.h" | 21 | #include "mir/compositor/buffer_ipc_packer.h" |
258 | 22 | #include "mir/options/program_option.h" | ||
259 | 22 | #include "mir_test_doubles/mock_buffer.h" | 23 | #include "mir_test_doubles/mock_buffer.h" |
260 | 23 | #include "mir_test_doubles/mock_buffer_packer.h" | 24 | #include "mir_test_doubles/mock_buffer_packer.h" |
261 | 24 | #include <system/window.h> | 25 | #include <system/window.h> |
262 | @@ -28,6 +29,7 @@ | |||
263 | 28 | namespace mga=mir::graphics::android; | 29 | namespace mga=mir::graphics::android; |
264 | 29 | namespace mtd=mir::test::doubles; | 30 | namespace mtd=mir::test::doubles; |
265 | 30 | namespace geom=mir::geometry; | 31 | namespace geom=mir::geometry; |
266 | 32 | namespace mo=mir::options; | ||
267 | 31 | 33 | ||
268 | 32 | class PlatformBufferIPCPackaging : public ::testing::Test | 34 | class PlatformBufferIPCPackaging : public ::testing::Test |
269 | 33 | { | 35 | { |
270 | @@ -81,7 +83,7 @@ | |||
271 | 81 | EXPECT_CALL(*mock_buffer, stride()) | 83 | EXPECT_CALL(*mock_buffer, stride()) |
272 | 82 | .WillOnce(testing::Return(dummy_stride)); | 84 | .WillOnce(testing::Return(dummy_stride)); |
273 | 83 | 85 | ||
275 | 84 | auto platform = mg::create_platform(stub_display_report); | 86 | auto platform = mg::create_platform(std::make_shared<mo::ProgramOption>(), stub_display_report); |
276 | 85 | 87 | ||
277 | 86 | auto mock_packer = std::make_shared<mtd::MockPacker>(); | 88 | auto mock_packer = std::make_shared<mtd::MockPacker>(); |
278 | 87 | int offset = 0; | 89 | int offset = 0; |
279 | 88 | 90 | ||
280 | === modified file 'tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp' | |||
281 | --- tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp 2013-04-18 12:56:58 +0000 | |||
282 | +++ tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp 2013-06-21 01:45:33 +0000 | |||
283 | @@ -115,7 +115,7 @@ | |||
284 | 115 | .WillOnce(Return(0)); | 115 | .WillOnce(Return(0)); |
285 | 116 | } | 116 | } |
286 | 117 | 117 | ||
288 | 118 | void set_up_expectations_for_vt_setup(int vt_num) | 118 | void set_up_expectations_for_vt_setup(int vt_num, bool activate) |
289 | 119 | { | 119 | { |
290 | 120 | using namespace testing; | 120 | using namespace testing; |
291 | 121 | 121 | ||
292 | @@ -125,6 +125,10 @@ | |||
293 | 125 | EXPECT_CALL(mock_fops, open(StrEq(ss.str()), _)) | 125 | EXPECT_CALL(mock_fops, open(StrEq(ss.str()), _)) |
294 | 126 | .WillOnce(Return(fake_vt_fd)); | 126 | .WillOnce(Return(fake_vt_fd)); |
295 | 127 | 127 | ||
296 | 128 | if (activate) | ||
297 | 129 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_ACTIVATE, vt_num)) | ||
298 | 130 | .WillOnce(Return(0)); | ||
299 | 131 | |||
300 | 128 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDGETMODE, An<void*>())) | 132 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDGETMODE, An<void*>())) |
301 | 129 | .WillOnce(DoAll(SetIoctlPointee<int>(fake_kd_mode), Return(0))); | 133 | .WillOnce(DoAll(SetIoctlPointee<int>(fake_kd_mode), Return(0))); |
302 | 130 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_GETMODE, An<void*>())) | 134 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_GETMODE, An<void*>())) |
303 | @@ -162,6 +166,23 @@ | |||
304 | 162 | }; | 166 | }; |
305 | 163 | 167 | ||
306 | 164 | 168 | ||
307 | 169 | TEST_F(LinuxVirtualTerminalTest, use_provided_vt) | ||
308 | 170 | { | ||
309 | 171 | using namespace testing; | ||
310 | 172 | |||
311 | 173 | int const vt_num{7}; | ||
312 | 174 | |||
313 | 175 | InSequence s; | ||
314 | 176 | |||
315 | 177 | set_up_expectations_for_vt_setup(vt_num, true); | ||
316 | 178 | set_up_expectations_for_vt_teardown(); | ||
317 | 179 | |||
318 | 180 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | ||
319 | 181 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | ||
320 | 182 | |||
321 | 183 | mgg::LinuxVirtualTerminal vt{fops, vt_num, null_report}; | ||
322 | 184 | } | ||
323 | 185 | |||
324 | 165 | TEST_F(LinuxVirtualTerminalTest, sets_up_current_vt) | 186 | TEST_F(LinuxVirtualTerminalTest, sets_up_current_vt) |
325 | 166 | { | 187 | { |
326 | 167 | using namespace testing; | 188 | using namespace testing; |
327 | @@ -171,13 +192,13 @@ | |||
328 | 171 | InSequence s; | 192 | InSequence s; |
329 | 172 | 193 | ||
330 | 173 | set_up_expectations_for_current_vt_search(vt_num); | 194 | set_up_expectations_for_current_vt_search(vt_num); |
332 | 174 | set_up_expectations_for_vt_setup(vt_num); | 195 | set_up_expectations_for_vt_setup(vt_num, false); |
333 | 175 | set_up_expectations_for_vt_teardown(); | 196 | set_up_expectations_for_vt_teardown(); |
334 | 176 | 197 | ||
335 | 177 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 198 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
336 | 178 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 199 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
337 | 179 | 200 | ||
339 | 180 | mgg::LinuxVirtualTerminal vt{fops, null_report}; | 201 | mgg::LinuxVirtualTerminal vt{fops, 0, null_report}; |
340 | 181 | } | 202 | } |
341 | 182 | 203 | ||
342 | 183 | TEST_F(LinuxVirtualTerminalTest, failure_to_find_current_vt_throws) | 204 | TEST_F(LinuxVirtualTerminalTest, failure_to_find_current_vt_throws) |
343 | @@ -203,7 +224,7 @@ | |||
344 | 203 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 224 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
345 | 204 | 225 | ||
346 | 205 | EXPECT_THROW({ | 226 | EXPECT_THROW({ |
348 | 206 | mgg::LinuxVirtualTerminal vt(fops, null_report); | 227 | mgg::LinuxVirtualTerminal vt(fops, 0, null_report); |
349 | 207 | }, std::runtime_error); | 228 | }, std::runtime_error); |
350 | 208 | } | 229 | } |
351 | 209 | 230 | ||
352 | @@ -216,7 +237,7 @@ | |||
353 | 216 | InSequence s; | 237 | InSequence s; |
354 | 217 | 238 | ||
355 | 218 | set_up_expectations_for_current_vt_search(vt_num); | 239 | set_up_expectations_for_current_vt_search(vt_num); |
357 | 219 | set_up_expectations_for_vt_setup(vt_num); | 240 | set_up_expectations_for_vt_setup(vt_num, false); |
358 | 220 | 241 | ||
359 | 221 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS)) | 242 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS)) |
360 | 222 | .WillOnce(Return(0)); | 243 | .WillOnce(Return(0)); |
361 | @@ -226,7 +247,7 @@ | |||
362 | 226 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 247 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
363 | 227 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 248 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
364 | 228 | 249 | ||
366 | 229 | mgg::LinuxVirtualTerminal vt(fops, null_report); | 250 | mgg::LinuxVirtualTerminal vt(fops, 0, null_report); |
367 | 230 | vt.set_graphics_mode(); | 251 | vt.set_graphics_mode(); |
368 | 231 | } | 252 | } |
369 | 232 | 253 | ||
370 | @@ -239,7 +260,7 @@ | |||
371 | 239 | InSequence s; | 260 | InSequence s; |
372 | 240 | 261 | ||
373 | 241 | set_up_expectations_for_current_vt_search(vt_num); | 262 | set_up_expectations_for_current_vt_search(vt_num); |
375 | 242 | set_up_expectations_for_vt_setup(vt_num); | 263 | set_up_expectations_for_vt_setup(vt_num, false); |
376 | 243 | 264 | ||
377 | 244 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS)) | 265 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS)) |
378 | 245 | .WillOnce(Return(-1)); | 266 | .WillOnce(Return(-1)); |
379 | @@ -249,7 +270,7 @@ | |||
380 | 249 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 270 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
381 | 250 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 271 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
382 | 251 | 272 | ||
384 | 252 | mgg::LinuxVirtualTerminal vt(fops, null_report); | 273 | mgg::LinuxVirtualTerminal vt(fops, 0, null_report); |
385 | 253 | EXPECT_THROW({ | 274 | EXPECT_THROW({ |
386 | 254 | vt.set_graphics_mode(); | 275 | vt.set_graphics_mode(); |
387 | 255 | }, std::runtime_error); | 276 | }, std::runtime_error); |
388 | @@ -265,14 +286,14 @@ | |||
389 | 265 | InSequence s; | 286 | InSequence s; |
390 | 266 | 287 | ||
391 | 267 | set_up_expectations_for_current_vt_search(vt_num); | 288 | set_up_expectations_for_current_vt_search(vt_num); |
393 | 268 | set_up_expectations_for_vt_setup(vt_num); | 289 | set_up_expectations_for_vt_setup(vt_num, false); |
394 | 269 | set_up_expectations_for_switch_handler(SIGUSR1); | 290 | set_up_expectations_for_switch_handler(SIGUSR1); |
395 | 270 | set_up_expectations_for_vt_teardown(); | 291 | set_up_expectations_for_vt_teardown(); |
396 | 271 | 292 | ||
397 | 272 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 293 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
398 | 273 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 294 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
399 | 274 | 295 | ||
401 | 275 | mgg::LinuxVirtualTerminal vt(fops, null_report); | 296 | mgg::LinuxVirtualTerminal vt(fops, 0, null_report); |
402 | 276 | 297 | ||
403 | 277 | auto null_handler = [] { return true; }; | 298 | auto null_handler = [] { return true; }; |
404 | 278 | vt.register_switch_handlers(mock_main_loop, null_handler, null_handler); | 299 | vt.register_switch_handlers(mock_main_loop, null_handler, null_handler); |
405 | @@ -288,7 +309,7 @@ | |||
406 | 288 | InSequence s; | 309 | InSequence s; |
407 | 289 | 310 | ||
408 | 290 | set_up_expectations_for_current_vt_search(vt_num); | 311 | set_up_expectations_for_current_vt_search(vt_num); |
410 | 291 | set_up_expectations_for_vt_setup(vt_num); | 312 | set_up_expectations_for_vt_setup(vt_num, false); |
411 | 292 | set_up_expectations_for_switch_handler(SIGUSR1); | 313 | set_up_expectations_for_switch_handler(SIGUSR1); |
412 | 293 | 314 | ||
413 | 294 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_RELDISP, allow_switch)); | 315 | EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_RELDISP, allow_switch)); |
414 | @@ -298,7 +319,7 @@ | |||
415 | 298 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 319 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
416 | 299 | auto null_report = std::make_shared<mg::NullDisplayReport>(); | 320 | auto null_report = std::make_shared<mg::NullDisplayReport>(); |
417 | 300 | 321 | ||
419 | 301 | mgg::LinuxVirtualTerminal vt(fops, null_report); | 322 | mgg::LinuxVirtualTerminal vt(fops, 0, null_report); |
420 | 302 | 323 | ||
421 | 303 | auto succeeding_handler = [] { return true; }; | 324 | auto succeeding_handler = [] { return true; }; |
422 | 304 | vt.register_switch_handlers(mock_main_loop, succeeding_handler, succeeding_handler); | 325 | vt.register_switch_handlers(mock_main_loop, succeeding_handler, succeeding_handler); |
423 | @@ -318,7 +339,7 @@ | |||
424 | 318 | InSequence s; | 339 | InSequence s; |
425 | 319 | 340 | ||
426 | 320 | set_up_expectations_for_current_vt_search(vt_num); | 341 | set_up_expectations_for_current_vt_search(vt_num); |
428 | 321 | set_up_expectations_for_vt_setup(vt_num); | 342 | set_up_expectations_for_vt_setup(vt_num, false); |
429 | 322 | set_up_expectations_for_switch_handler(SIGUSR1); | 343 | set_up_expectations_for_switch_handler(SIGUSR1); |
430 | 323 | 344 | ||
431 | 324 | /* First switch away attempt */ | 345 | /* First switch away attempt */ |
432 | @@ -335,7 +356,7 @@ | |||
433 | 335 | 356 | ||
434 | 336 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 357 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
435 | 337 | 358 | ||
437 | 338 | mgg::LinuxVirtualTerminal vt(fops, mt::fake_shared(mock_report)); | 359 | mgg::LinuxVirtualTerminal vt(fops, 0, mt::fake_shared(mock_report)); |
438 | 339 | 360 | ||
439 | 340 | auto failing_handler = [] { return false; }; | 361 | auto failing_handler = [] { return false; }; |
440 | 341 | vt.register_switch_handlers(mock_main_loop, failing_handler, failing_handler); | 362 | vt.register_switch_handlers(mock_main_loop, failing_handler, failing_handler); |
441 | @@ -357,7 +378,7 @@ | |||
442 | 357 | InSequence s; | 378 | InSequence s; |
443 | 358 | 379 | ||
444 | 359 | set_up_expectations_for_current_vt_search(vt_num); | 380 | set_up_expectations_for_current_vt_search(vt_num); |
446 | 360 | set_up_expectations_for_vt_setup(vt_num); | 381 | set_up_expectations_for_vt_setup(vt_num, false); |
447 | 361 | set_up_expectations_for_switch_handler(SIGUSR1); | 382 | set_up_expectations_for_switch_handler(SIGUSR1); |
448 | 362 | 383 | ||
449 | 363 | /* Switch away */ | 384 | /* Switch away */ |
450 | @@ -371,7 +392,7 @@ | |||
451 | 371 | 392 | ||
452 | 372 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); | 393 | auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops); |
453 | 373 | 394 | ||
455 | 374 | mgg::LinuxVirtualTerminal vt(fops, mt::fake_shared(mock_report)); | 395 | mgg::LinuxVirtualTerminal vt(fops, 0, mt::fake_shared(mock_report)); |
456 | 375 | 396 | ||
457 | 376 | auto succeeding_handler = [] { return true; }; | 397 | auto succeeding_handler = [] { return true; }; |
458 | 377 | auto failing_handler = [] { return false; }; | 398 | auto failing_handler = [] { return false; }; |
459 | 378 | 399 | ||
460 | === modified file 'tests/unit-tests/graphics/test_graphics_platform.cpp' | |||
461 | --- tests/unit-tests/graphics/test_graphics_platform.cpp 2013-05-20 15:55:48 +0000 | |||
462 | +++ tests/unit-tests/graphics/test_graphics_platform.cpp 2013-06-21 01:45:33 +0000 | |||
463 | @@ -32,6 +32,7 @@ | |||
464 | 32 | #endif | 32 | #endif |
465 | 33 | #include "mir/graphics/buffer_initializer.h" | 33 | #include "mir/graphics/buffer_initializer.h" |
466 | 34 | #include "mir/logging/dumb_console_logger.h" | 34 | #include "mir/logging/dumb_console_logger.h" |
467 | 35 | #include "mir/options/program_option.h" | ||
468 | 35 | 36 | ||
469 | 36 | #include "mir/graphics/null_display_report.h" | 37 | #include "mir/graphics/null_display_report.h" |
470 | 37 | 38 | ||
471 | @@ -42,6 +43,7 @@ | |||
472 | 42 | namespace ml = mir::logging; | 43 | namespace ml = mir::logging; |
473 | 43 | namespace geom = mir::geometry; | 44 | namespace geom = mir::geometry; |
474 | 44 | namespace mtd = mir::test::doubles; | 45 | namespace mtd = mir::test::doubles; |
475 | 46 | namespace mo = mir::options; | ||
476 | 45 | 47 | ||
477 | 46 | class GraphicsPlatform : public ::testing::Test | 48 | class GraphicsPlatform : public ::testing::Test |
478 | 47 | { | 49 | { |
479 | @@ -75,7 +77,7 @@ | |||
480 | 75 | std::shared_ptr<mg::Platform> create_platform() | 77 | std::shared_ptr<mg::Platform> create_platform() |
481 | 76 | { | 78 | { |
482 | 77 | #ifdef ANDROID | 79 | #ifdef ANDROID |
484 | 78 | return mg::create_platform(std::make_shared<mg::NullDisplayReport>()); | 80 | return mg::create_platform(std::make_shared<mo::ProgramOption>(), std::make_shared<mg::NullDisplayReport>()); |
485 | 79 | #else | 81 | #else |
486 | 80 | return std::make_shared<mg::gbm::GBMPlatform>( | 82 | return std::make_shared<mg::gbm::GBMPlatform>( |
487 | 81 | std::make_shared<mg::NullDisplayReport>(), | 83 | std::make_shared<mg::NullDisplayReport>(), |
FAILED: Continuous integration, rev:759 jenkins. qa.ubuntu. com/job/ mir-ci/ 773/ jenkins. qa.ubuntu. com/job/ mir-android- saucy-i386- build/972/ console jenkins. qa.ubuntu. com/job/ mir-clang- saucy-amd64- build/854 jenkins. qa.ubuntu. com/job/ mir-saucy- amd64-ci/ 11 jenkins. qa.ubuntu. com/job/ mir-saucy- amd64-ci/ 11/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-vm- ci-build/ ./distribution= quantal, flavor= amd64/452
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mir-ci/ 773/rebuild
http://