Mir

Merge lp:~robert-ancell/mir/vt-option into lp:~mir-team/mir/trunk

Proposed by Robert Ancell
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
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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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
?

review: Needs Fixing
Revision history for this message
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)
  ...

Revision history for this message
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)

Revision history for this message
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.

Revision history for this message
Robert Ancell (robert-ancell) wrote :
Revision history for this message
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_server_shell --vt 6
ERROR: /home/dan/bzr/mir/tmp.vt/src/server/graphics/gbm/linux_virtual_terminal.cpp(197): Throw in function int mir::graphics::gbm::LinuxVirtualTerminal::open_vt(int)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >
std::exception::what: Failed to open current VT <---- This is wrong. It's not trying to open the "current" one.
[boost::errinfo_errno_*] = 13, "Permission denied"
[boost::errinfo_file_name_*] = /dev/tty6

review: Approve
Revision history for this message
Chris Halse Rogers (raof) wrote :

Looks good to me, does what it says on the tin.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/render_to_fb.cpp'
--- examples/render_to_fb.cpp 2013-05-21 15:11:41 +0000
+++ examples/render_to_fb.cpp 2013-06-21 01:45:33 +0000
@@ -23,12 +23,15 @@
23#include "mir/logging/display_report.h"23#include "mir/logging/display_report.h"
24#include "mir/logging/dumb_console_logger.h"24#include "mir/logging/dumb_console_logger.h"
2525
26#include "mir/options/program_option.h"
27
26#include "graphics.h"28#include "graphics.h"
2729
28#include <csignal>30#include <csignal>
2931
30namespace mg=mir::graphics;32namespace mg=mir::graphics;
31namespace ml=mir::logging;33namespace ml=mir::logging;
34namespace mo=mir::options;
3235
33namespace36namespace
34{37{
@@ -54,7 +57,7 @@
54 sigaction(SIGTERM, &sa, NULL);57 sigaction(SIGTERM, &sa, NULL);
5558
56 auto logger = std::make_shared<ml::DumbConsoleLogger>();59 auto logger = std::make_shared<ml::DumbConsoleLogger>();
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));
58 auto display = platform->create_display();61 auto display = platform->create_display();
5962
60 mir::draw::glAnimationBasic gl_animation;63 mir::draw::glAnimationBasic gl_animation;
6164
=== modified file 'include/server/mir/graphics/platform.h'
--- include/server/mir/graphics/platform.h 2013-06-19 09:57:32 +0000
+++ include/server/mir/graphics/platform.h 2013-06-21 01:45:33 +0000
@@ -34,6 +34,10 @@
34class Buffer;34class Buffer;
35class BufferIPCPacker;35class BufferIPCPacker;
36}36}
37namespace options
38{
39class Option;
40}
3741
38/// Graphics subsystem. Mediates interaction between core system and42/// Graphics subsystem. Mediates interaction between core system and
39/// the graphics environment.43/// the graphics environment.
@@ -107,13 +111,14 @@
107/**111/**
108 * Creates and returns a new graphics platform.112 * Creates and returns a new graphics platform.
109 *113 *
114 * \param [in] options options to use for this platform
110 * \param [in] report the object to use to report interesting events from the display subsystem115 * \param [in] report the object to use to report interesting events from the display subsystem
111 *116 *
112 * This factory function needs to be implemented by each platform.117 * This factory function needs to be implemented by each platform.
113 *118 *
114 * \ingroup platform_enablement119 * \ingroup platform_enablement
115 */120 */
116std::shared_ptr<Platform> create_platform(std::shared_ptr<DisplayReport> const& report);121std::shared_ptr<Platform> create_platform(std::shared_ptr<options::Option> const& options, std::shared_ptr<DisplayReport> const& report);
117122
118}123}
119}124}
120125
=== modified file 'src/server/default_server_configuration.cpp'
--- src/server/default_server_configuration.cpp 2013-06-12 16:25:38 +0000
+++ src/server/default_server_configuration.cpp 2013-06-21 01:45:33 +0000
@@ -242,7 +242,9 @@
242 "directory instead of the default logging directory."242 "directory instead of the default logging directory."
243 " [string:default=\"\"]")243 " [string:default=\"\"]")
244 ("ipc-thread-pool", po::value<int>(),244 ("ipc-thread-pool", po::value<int>(),
245 "threads in frontend thread pool. [int:default=10]");245 "threads in frontend thread pool. [int:default=10]")
246 ("vt", po::value<int>(),
247 "VT to run on or 0 to use current. [int:default=0]");
246}248}
247249
248boost::program_options::options_description_easy_init mir::DefaultServerConfiguration::add_options()250boost::program_options::options_description_easy_init mir::DefaultServerConfiguration::add_options()
@@ -299,7 +301,7 @@
299 // graphics libraries.301 // graphics libraries.
300 // Alternatively, if we want to dynamically load the graphics library302 // Alternatively, if we want to dynamically load the graphics library
301 // then this would be the place to do that.303 // then this would be the place to do that.
302 return mg::create_platform(the_display_report());304 return mg::create_platform(the_options(), the_display_report());
303 });305 });
304}306}
305307
306308
=== modified file 'src/server/graphics/android/android_platform.cpp'
--- src/server/graphics/android/android_platform.cpp 2013-06-12 10:23:43 +0000
+++ src/server/graphics/android/android_platform.cpp 2013-06-21 01:45:33 +0000
@@ -28,11 +28,13 @@
28#include "mir/graphics/buffer_initializer.h"28#include "mir/graphics/buffer_initializer.h"
29#include "mir/compositor/buffer_id.h"29#include "mir/compositor/buffer_id.h"
30#include "mir/compositor/buffer_ipc_packer.h"30#include "mir/compositor/buffer_ipc_packer.h"
31#include "mir/options/option.h"
3132
32namespace mg=mir::graphics;33namespace mg=mir::graphics;
33namespace mga=mir::graphics::android;34namespace mga=mir::graphics::android;
34namespace mc=mir::compositor;35namespace mc=mir::compositor;
35namespace mf=mir::frontend;36namespace mf=mir::frontend;
37namespace mo = mir::options;
3638
37mga::AndroidPlatform::AndroidPlatform(std::shared_ptr<mg::DisplayReport> const& display_report)39mga::AndroidPlatform::AndroidPlatform(std::shared_ptr<mg::DisplayReport> const& display_report)
38 : display_report(display_report)40 : display_report(display_report)
@@ -98,7 +100,7 @@
98 return std::make_shared<mga::InternalClient>();100 return std::make_shared<mga::InternalClient>();
99}101}
100102
101std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& display_report)103std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& /*options*/, std::shared_ptr<DisplayReport> const& display_report)
102{104{
103 return std::make_shared<mga::AndroidPlatform>(display_report);105 return std::make_shared<mga::AndroidPlatform>(display_report);
104}106}
105107
=== modified file 'src/server/graphics/gbm/gbm_platform.cpp'
--- src/server/graphics/gbm/gbm_platform.cpp 2013-06-12 10:23:43 +0000
+++ src/server/graphics/gbm/gbm_platform.cpp 2013-06-21 01:45:33 +0000
@@ -24,6 +24,7 @@
24#include "linux_virtual_terminal.h"24#include "linux_virtual_terminal.h"
25#include "mir/graphics/platform_ipc_package.h"25#include "mir/graphics/platform_ipc_package.h"
26#include "mir/compositor/buffer_ipc_packer.h"26#include "mir/compositor/buffer_ipc_packer.h"
27#include "mir/options/option.h"
2728
28#include "drm_close_threadsafe.h"29#include "drm_close_threadsafe.h"
2930
@@ -33,6 +34,7 @@
33namespace mg = mir::graphics;34namespace mg = mir::graphics;
34namespace mgg = mg::gbm;35namespace mgg = mg::gbm;
35namespace mc = mir::compositor;36namespace mc = mir::compositor;
37namespace mo = mir::options;
36namespace38namespace
37{39{
3840
@@ -142,10 +144,10 @@
142 return std::make_shared<mgg::InternalClient>(internal_native_display);144 return std::make_shared<mgg::InternalClient>(internal_native_display);
143}145}
144146
145std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& report)147std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<mo::Option> const& options, std::shared_ptr<DisplayReport> const& report)
146{148{
147 auto real_fops = std::make_shared<RealVTFileOperations>();149 auto real_fops = std::make_shared<RealVTFileOperations>();
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);
149 return std::make_shared<mgg::GBMPlatform>(report, vt);151 return std::make_shared<mgg::GBMPlatform>(report, vt);
150}152}
151153
152154
=== modified file 'src/server/graphics/gbm/linux_virtual_terminal.cpp'
--- src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-04-25 09:48:54 +0000
+++ src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-06-21 01:45:33 +0000
@@ -38,10 +38,11 @@
3838
39mgg::LinuxVirtualTerminal::LinuxVirtualTerminal(39mgg::LinuxVirtualTerminal::LinuxVirtualTerminal(
40 std::shared_ptr<VTFileOperations> const& fops,40 std::shared_ptr<VTFileOperations> const& fops,
41 int vt_number,
41 std::shared_ptr<DisplayReport> const& report)42 std::shared_ptr<DisplayReport> const& report)
42 : fops{fops},43 : fops{fops},
43 report{report},44 report{report},
44 vt_fd{fops, open_vt(find_active_vt_number())},45 vt_fd{fops, open_vt(vt_number)},
45 prev_kd_mode{0},46 prev_kd_mode{0},
46 prev_vt_mode(),47 prev_vt_mode(),
47 active{true}48 active{true}
@@ -173,6 +174,13 @@
173174
174int mgg::LinuxVirtualTerminal::open_vt(int vt_number)175int mgg::LinuxVirtualTerminal::open_vt(int vt_number)
175{176{
177 auto activate = true;
178 if (vt_number <= 0)
179 {
180 vt_number = find_active_vt_number();
181 activate = false;
182 }
183
176 std::stringstream vt_path_stream;184 std::stringstream vt_path_stream;
177 vt_path_stream << "/dev/tty" << vt_number;185 vt_path_stream << "/dev/tty" << vt_number;
178186
@@ -189,5 +197,18 @@
189 << boost::errinfo_errno(errno));197 << boost::errinfo_errno(errno));
190 }198 }
191199
200 if (activate)
201 {
202 auto status = fops->ioctl(vt_fd, VT_ACTIVATE, vt_number);
203 if (status < 0)
204 {
205 BOOST_THROW_EXCEPTION(
206 boost::enable_error_info(
207 std::runtime_error("Failed to activate VT"))
208 << boost::errinfo_file_name(active_vt_path)
209 << boost::errinfo_errno(errno));
210 }
211 }
212
192 return vt_fd;213 return vt_fd;
193}214}
194215
=== modified file 'src/server/graphics/gbm/linux_virtual_terminal.h'
--- src/server/graphics/gbm/linux_virtual_terminal.h 2013-04-25 09:48:54 +0000
+++ src/server/graphics/gbm/linux_virtual_terminal.h 2013-06-21 01:45:33 +0000
@@ -56,6 +56,7 @@
56{56{
57public:57public:
58 LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops,58 LinuxVirtualTerminal(std::shared_ptr<VTFileOperations> const& fops,
59 int vt_number,
59 std::shared_ptr<DisplayReport> const& report);60 std::shared_ptr<DisplayReport> const& report);
60 ~LinuxVirtualTerminal() noexcept(true);61 ~LinuxVirtualTerminal() noexcept(true);
6162
6263
=== modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp'
--- tests/integration-tests/graphics/android/test_internal_client.cpp 2013-06-12 16:22:17 +0000
+++ tests/integration-tests/graphics/android/test_internal_client.cpp 2013-06-21 01:45:33 +0000
@@ -34,6 +34,7 @@
34#include "mir/shell/surface_creation_parameters.h"34#include "mir/shell/surface_creation_parameters.h"
35#include "mir/frontend/surface_id.h"35#include "mir/frontend/surface_id.h"
36#include "mir/input/input_channel_factory.h"36#include "mir/input/input_channel_factory.h"
37#include "mir/options/program_option.h"
3738
38#include "mir_test_doubles/stub_input_registrar.h"39#include "mir_test_doubles/stub_input_registrar.h"
3940
@@ -52,6 +53,7 @@
52namespace mf=mir::frontend;53namespace mf=mir::frontend;
53namespace mi=mir::input;54namespace mi=mir::input;
54namespace mtd=mir::test::doubles;55namespace mtd=mir::test::doubles;
56namespace mo=mir::options;
5557
56namespace58namespace
57{59{
@@ -95,8 +97,9 @@
95 auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller);97 auto surface_source = std::make_shared<msh::SurfaceSource>(surface_controller);
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>());
9799
100 auto options = std::shared_ptr<mo::ProgramOption>();
98 auto report = std::shared_ptr<mg::NullDisplayReport>(); 101 auto report = std::shared_ptr<mg::NullDisplayReport>();
99 auto platform = mg::create_platform(report);102 auto platform = mg::create_platform(options, report);
100 auto internal_client = platform->create_internal_client();103 auto internal_client = platform->create_internal_client();
101104
102 int major, minor, n;105 int major, minor, n;
103106
=== modified file 'tests/integration-tests/graphics/gbm/test_buffer_integration.cpp'
--- tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-06-20 08:27:10 +0000
+++ tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-06-21 01:45:33 +0000
@@ -100,7 +100,7 @@
100 auto options = mtf::TestingServerConfiguration().the_options();100 auto options = mtf::TestingServerConfiguration().the_options();
101101
102 if (options->get("tests-use-real-graphics", false))102 if (options->get("tests-use-real-graphics", false))
103 platform = mg::create_platform(std::make_shared<mg::NullDisplayReport>());103 platform = mg::create_platform(options, std::make_shared<mg::NullDisplayReport>());
104 else104 else
105 platform = std::make_shared<StubGraphicPlatform>();105 platform = std::make_shared<StubGraphicPlatform>();
106106
107107
=== modified file 'tests/unit-tests/graphics/android/test_android_platform.cpp'
--- tests/unit-tests/graphics/android/test_android_platform.cpp 2013-05-17 18:48:07 +0000
+++ tests/unit-tests/graphics/android/test_android_platform.cpp 2013-06-21 01:45:33 +0000
@@ -19,6 +19,7 @@
19#include "mir/graphics/null_display_report.h"19#include "mir/graphics/null_display_report.h"
20#include "src/server/graphics/android/android_platform.h"20#include "src/server/graphics/android/android_platform.h"
21#include "mir/compositor/buffer_ipc_packer.h"21#include "mir/compositor/buffer_ipc_packer.h"
22#include "mir/options/program_option.h"
22#include "mir_test_doubles/mock_buffer.h"23#include "mir_test_doubles/mock_buffer.h"
23#include "mir_test_doubles/mock_buffer_packer.h"24#include "mir_test_doubles/mock_buffer_packer.h"
24#include <system/window.h>25#include <system/window.h>
@@ -28,6 +29,7 @@
28namespace mga=mir::graphics::android;29namespace mga=mir::graphics::android;
29namespace mtd=mir::test::doubles;30namespace mtd=mir::test::doubles;
30namespace geom=mir::geometry;31namespace geom=mir::geometry;
32namespace mo=mir::options;
3133
32class PlatformBufferIPCPackaging : public ::testing::Test34class PlatformBufferIPCPackaging : public ::testing::Test
33{35{
@@ -81,7 +83,7 @@
81 EXPECT_CALL(*mock_buffer, stride())83 EXPECT_CALL(*mock_buffer, stride())
82 .WillOnce(testing::Return(dummy_stride));84 .WillOnce(testing::Return(dummy_stride));
8385
84 auto platform = mg::create_platform(stub_display_report);86 auto platform = mg::create_platform(std::make_shared<mo::ProgramOption>(), stub_display_report);
8587
86 auto mock_packer = std::make_shared<mtd::MockPacker>();88 auto mock_packer = std::make_shared<mtd::MockPacker>();
87 int offset = 0;89 int offset = 0;
8890
=== modified file 'tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp'
--- tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp 2013-04-18 12:56:58 +0000
+++ tests/unit-tests/graphics/gbm/test_linux_virtual_terminal.cpp 2013-06-21 01:45:33 +0000
@@ -115,7 +115,7 @@
115 .WillOnce(Return(0));115 .WillOnce(Return(0));
116 }116 }
117117
118 void set_up_expectations_for_vt_setup(int vt_num)118 void set_up_expectations_for_vt_setup(int vt_num, bool activate)
119 {119 {
120 using namespace testing;120 using namespace testing;
121121
@@ -125,6 +125,10 @@
125 EXPECT_CALL(mock_fops, open(StrEq(ss.str()), _))125 EXPECT_CALL(mock_fops, open(StrEq(ss.str()), _))
126 .WillOnce(Return(fake_vt_fd));126 .WillOnce(Return(fake_vt_fd));
127127
128 if (activate)
129 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, VT_ACTIVATE, vt_num))
130 .WillOnce(Return(0));
131
128 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDGETMODE, An<void*>()))132 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDGETMODE, An<void*>()))
129 .WillOnce(DoAll(SetIoctlPointee<int>(fake_kd_mode), Return(0)));133 .WillOnce(DoAll(SetIoctlPointee<int>(fake_kd_mode), Return(0)));
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*>()))
@@ -162,6 +166,23 @@
162};166};
163167
164168
169TEST_F(LinuxVirtualTerminalTest, use_provided_vt)
170{
171 using namespace testing;
172
173 int const vt_num{7};
174
175 InSequence s;
176
177 set_up_expectations_for_vt_setup(vt_num, true);
178 set_up_expectations_for_vt_teardown();
179
180 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
181 auto null_report = std::make_shared<mg::NullDisplayReport>();
182
183 mgg::LinuxVirtualTerminal vt{fops, vt_num, null_report};
184}
185
165TEST_F(LinuxVirtualTerminalTest, sets_up_current_vt)186TEST_F(LinuxVirtualTerminalTest, sets_up_current_vt)
166{187{
167 using namespace testing;188 using namespace testing;
@@ -171,13 +192,13 @@
171 InSequence s;192 InSequence s;
172193
173 set_up_expectations_for_current_vt_search(vt_num);194 set_up_expectations_for_current_vt_search(vt_num);
174 set_up_expectations_for_vt_setup(vt_num);195 set_up_expectations_for_vt_setup(vt_num, false);
175 set_up_expectations_for_vt_teardown();196 set_up_expectations_for_vt_teardown();
176197
177 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);198 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
178 auto null_report = std::make_shared<mg::NullDisplayReport>();199 auto null_report = std::make_shared<mg::NullDisplayReport>();
179200
180 mgg::LinuxVirtualTerminal vt{fops, null_report};201 mgg::LinuxVirtualTerminal vt{fops, 0, null_report};
181}202}
182203
183TEST_F(LinuxVirtualTerminalTest, failure_to_find_current_vt_throws)204TEST_F(LinuxVirtualTerminalTest, failure_to_find_current_vt_throws)
@@ -203,7 +224,7 @@
203 auto null_report = std::make_shared<mg::NullDisplayReport>();224 auto null_report = std::make_shared<mg::NullDisplayReport>();
204225
205 EXPECT_THROW({226 EXPECT_THROW({
206 mgg::LinuxVirtualTerminal vt(fops, null_report);227 mgg::LinuxVirtualTerminal vt(fops, 0, null_report);
207 }, std::runtime_error);228 }, std::runtime_error);
208}229}
209230
@@ -216,7 +237,7 @@
216 InSequence s;237 InSequence s;
217238
218 set_up_expectations_for_current_vt_search(vt_num);239 set_up_expectations_for_current_vt_search(vt_num);
219 set_up_expectations_for_vt_setup(vt_num);240 set_up_expectations_for_vt_setup(vt_num, false);
220241
221 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS))242 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS))
222 .WillOnce(Return(0));243 .WillOnce(Return(0));
@@ -226,7 +247,7 @@
226 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);247 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
227 auto null_report = std::make_shared<mg::NullDisplayReport>();248 auto null_report = std::make_shared<mg::NullDisplayReport>();
228249
229 mgg::LinuxVirtualTerminal vt(fops, null_report);250 mgg::LinuxVirtualTerminal vt(fops, 0, null_report);
230 vt.set_graphics_mode();251 vt.set_graphics_mode();
231}252}
232253
@@ -239,7 +260,7 @@
239 InSequence s;260 InSequence s;
240261
241 set_up_expectations_for_current_vt_search(vt_num);262 set_up_expectations_for_current_vt_search(vt_num);
242 set_up_expectations_for_vt_setup(vt_num);263 set_up_expectations_for_vt_setup(vt_num, false);
243264
244 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS))265 EXPECT_CALL(mock_fops, ioctl(fake_vt_fd, KDSETMODE, KD_GRAPHICS))
245 .WillOnce(Return(-1));266 .WillOnce(Return(-1));
@@ -249,7 +270,7 @@
249 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);270 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
250 auto null_report = std::make_shared<mg::NullDisplayReport>();271 auto null_report = std::make_shared<mg::NullDisplayReport>();
251272
252 mgg::LinuxVirtualTerminal vt(fops, null_report);273 mgg::LinuxVirtualTerminal vt(fops, 0, null_report);
253 EXPECT_THROW({274 EXPECT_THROW({
254 vt.set_graphics_mode();275 vt.set_graphics_mode();
255 }, std::runtime_error);276 }, std::runtime_error);
@@ -265,14 +286,14 @@
265 InSequence s;286 InSequence s;
266287
267 set_up_expectations_for_current_vt_search(vt_num);288 set_up_expectations_for_current_vt_search(vt_num);
268 set_up_expectations_for_vt_setup(vt_num);289 set_up_expectations_for_vt_setup(vt_num, false);
269 set_up_expectations_for_switch_handler(SIGUSR1);290 set_up_expectations_for_switch_handler(SIGUSR1);
270 set_up_expectations_for_vt_teardown();291 set_up_expectations_for_vt_teardown();
271292
272 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);293 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
273 auto null_report = std::make_shared<mg::NullDisplayReport>();294 auto null_report = std::make_shared<mg::NullDisplayReport>();
274295
275 mgg::LinuxVirtualTerminal vt(fops, null_report);296 mgg::LinuxVirtualTerminal vt(fops, 0, null_report);
276297
277 auto null_handler = [] { return true; };298 auto null_handler = [] { return true; };
278 vt.register_switch_handlers(mock_main_loop, null_handler, null_handler);299 vt.register_switch_handlers(mock_main_loop, null_handler, null_handler);
@@ -288,7 +309,7 @@
288 InSequence s;309 InSequence s;
289310
290 set_up_expectations_for_current_vt_search(vt_num);311 set_up_expectations_for_current_vt_search(vt_num);
291 set_up_expectations_for_vt_setup(vt_num);312 set_up_expectations_for_vt_setup(vt_num, false);
292 set_up_expectations_for_switch_handler(SIGUSR1);313 set_up_expectations_for_switch_handler(SIGUSR1);
293314
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));
@@ -298,7 +319,7 @@
298 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);319 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
299 auto null_report = std::make_shared<mg::NullDisplayReport>();320 auto null_report = std::make_shared<mg::NullDisplayReport>();
300321
301 mgg::LinuxVirtualTerminal vt(fops, null_report);322 mgg::LinuxVirtualTerminal vt(fops, 0, null_report);
302323
303 auto succeeding_handler = [] { return true; };324 auto succeeding_handler = [] { return true; };
304 vt.register_switch_handlers(mock_main_loop, succeeding_handler, succeeding_handler);325 vt.register_switch_handlers(mock_main_loop, succeeding_handler, succeeding_handler);
@@ -318,7 +339,7 @@
318 InSequence s;339 InSequence s;
319340
320 set_up_expectations_for_current_vt_search(vt_num);341 set_up_expectations_for_current_vt_search(vt_num);
321 set_up_expectations_for_vt_setup(vt_num);342 set_up_expectations_for_vt_setup(vt_num, false);
322 set_up_expectations_for_switch_handler(SIGUSR1);343 set_up_expectations_for_switch_handler(SIGUSR1);
323344
324 /* First switch away attempt */345 /* First switch away attempt */
@@ -335,7 +356,7 @@
335356
336 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);357 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
337358
338 mgg::LinuxVirtualTerminal vt(fops, mt::fake_shared(mock_report));359 mgg::LinuxVirtualTerminal vt(fops, 0, mt::fake_shared(mock_report));
339360
340 auto failing_handler = [] { return false; };361 auto failing_handler = [] { return false; };
341 vt.register_switch_handlers(mock_main_loop, failing_handler, failing_handler);362 vt.register_switch_handlers(mock_main_loop, failing_handler, failing_handler);
@@ -357,7 +378,7 @@
357 InSequence s;378 InSequence s;
358379
359 set_up_expectations_for_current_vt_search(vt_num);380 set_up_expectations_for_current_vt_search(vt_num);
360 set_up_expectations_for_vt_setup(vt_num);381 set_up_expectations_for_vt_setup(vt_num, false);
361 set_up_expectations_for_switch_handler(SIGUSR1);382 set_up_expectations_for_switch_handler(SIGUSR1);
362383
363 /* Switch away */384 /* Switch away */
@@ -371,7 +392,7 @@
371392
372 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);393 auto fops = mt::fake_shared<mgg::VTFileOperations>(mock_fops);
373394
374 mgg::LinuxVirtualTerminal vt(fops, mt::fake_shared(mock_report));395 mgg::LinuxVirtualTerminal vt(fops, 0, mt::fake_shared(mock_report));
375396
376 auto succeeding_handler = [] { return true; };397 auto succeeding_handler = [] { return true; };
377 auto failing_handler = [] { return false; };398 auto failing_handler = [] { return false; };
378399
=== modified file 'tests/unit-tests/graphics/test_graphics_platform.cpp'
--- tests/unit-tests/graphics/test_graphics_platform.cpp 2013-05-20 15:55:48 +0000
+++ tests/unit-tests/graphics/test_graphics_platform.cpp 2013-06-21 01:45:33 +0000
@@ -32,6 +32,7 @@
32#endif32#endif
33#include "mir/graphics/buffer_initializer.h"33#include "mir/graphics/buffer_initializer.h"
34#include "mir/logging/dumb_console_logger.h"34#include "mir/logging/dumb_console_logger.h"
35#include "mir/options/program_option.h"
3536
36#include "mir/graphics/null_display_report.h"37#include "mir/graphics/null_display_report.h"
3738
@@ -42,6 +43,7 @@
42namespace ml = mir::logging;43namespace ml = mir::logging;
43namespace geom = mir::geometry;44namespace geom = mir::geometry;
44namespace mtd = mir::test::doubles;45namespace mtd = mir::test::doubles;
46namespace mo = mir::options;
4547
46class GraphicsPlatform : public ::testing::Test48class GraphicsPlatform : public ::testing::Test
47{49{
@@ -75,7 +77,7 @@
75 std::shared_ptr<mg::Platform> create_platform()77 std::shared_ptr<mg::Platform> create_platform()
76 {78 {
77#ifdef ANDROID79#ifdef ANDROID
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>());
79#else81#else
80 return std::make_shared<mg::gbm::GBMPlatform>(82 return std::make_shared<mg::gbm::GBMPlatform>(
81 std::make_shared<mg::NullDisplayReport>(),83 std::make_shared<mg::NullDisplayReport>(),

Subscribers

People subscribed via source and target branches