Mir

Merge lp:~alan-griffiths/mir/make-ConfigurationOptions-a-dependency-of-DefaultServerConfiguration into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1420
Proposed branch: lp:~alan-griffiths/mir/make-ConfigurationOptions-a-dependency-of-DefaultServerConfiguration
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/ConfigurationOptions-default_ipc_threads-as-a-constant
Diff against target: 1159 lines (+309/-208)
22 files modified
examples/basic_server_configuration.cpp (+13/-7)
examples/demo-shell/demo_shell.cpp (+15/-7)
examples/render_surfaces.cpp (+20/-11)
examples/server_configuration.cpp (+10/-4)
examples/server_configuration.h (+7/-1)
include/platform/mir/abnormal_exit.h (+3/-3)
include/platform/mir/options/configuration.h (+74/-0)
include/platform/mir/options/default_configuration.h (+28/-76)
include/server/mir/default_server_configuration.h (+12/-6)
src/platform/CMakeLists.txt (+1/-0)
src/platform/options/CMakeLists.txt (+1/-0)
src/platform/options/default_configuration.cpp (+51/-47)
src/platform/options/program_option.cpp (+3/-3)
src/server/CMakeLists.txt (+0/-2)
src/server/default_server_configuration.cpp (+16/-3)
src/server/frontend/default_configuration.cpp (+3/-2)
src/server/graphics/default_configuration.cpp (+12/-8)
src/server/input/default_configuration.cpp (+5/-3)
src/server/logging/default_configuration.cpp (+5/-4)
src/server/report/default_server_configuration.cpp (+13/-14)
tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+2/-0)
tests/mir_test_framework/stubbed_server_configuration.cpp (+15/-7)
To merge this branch: bzr merge lp:~alan-griffiths/mir/make-ConfigurationOptions-a-dependency-of-DefaultServerConfiguration
Reviewer Review Type Date Requested Status
Alan Griffiths Abstain
PS Jenkins bot (community) continuous-integration Approve
Andreas Pokorny (community) Approve
Alexandros Frantzis (community) Approve
Kevin DuBois (community) Needs Fixing
Review via email: mp+206996@code.launchpad.net

Commit message

config: rework to make it easier for clients to customize option setup and processing

Description of the change

config: rework to make it easier for clients to customize option setup and processing

In particular, they are no longer tied to using boost options or passing the command-line args to DefaultServerConfiguration.

Also moved all of the options code into platform as this will facilitate providing and using platform specific options.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

having both mir::options and mir::configuration_options seems a bit redundant, the option names would fit in mir::options well too, and we wouldn't need a new namespace.

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

> having both mir::options and mir::configuration_options seems a bit redundant,
> the option names would fit in mir::options well too, and we wouldn't need a
> new namespace.

I'm open to persuasion, but I don't see that a generic option library mir::options and the specific configuration options used setting up the mir server are actually coherent.

Another approach would be to move ConfigurationOptions and DefaultConfigurationOptions into configuration_options.

I await further opinions before updating the MP.

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

(Latest updates) Looks good.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

1095 === src/server/report/logging/default_configuration.cpp is not needed/used

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

> 1095 === src/server/report/logging/default_configuration.cpp is not
> needed/used

thanks for the catch

Revision history for this message
Andreas Pokorny (andreas-pokorny) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) :
review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/basic_server_configuration.cpp'
2--- examples/basic_server_configuration.cpp 2014-01-30 07:17:36 +0000
3+++ examples/basic_server_configuration.cpp 2014-02-21 14:57:04 +0000
4@@ -17,6 +17,7 @@
5 */
6
7 #include "basic_server_configuration.h"
8+#include "mir/options/default_configuration.h"
9
10 #include "mir/abnormal_exit.h"
11 #include "mir/frontend/connector.h"
12@@ -34,14 +35,19 @@
13 namespace examples
14 {
15
16-BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv)
17- : ServerConfiguration(argc, argv)
18+BasicServerConfiguration::BasicServerConfiguration(int argc, char const** argv) :
19+ ServerConfiguration([argc, argv]
20+ {
21+ auto result = std::make_shared<options::DefaultConfiguration>(argc, argv);
22+
23+ namespace po = boost::program_options;
24+
25+ result->add_options()
26+ (launch_child_opt, po::value<std::string>(), "system() command to launch client");
27+
28+ return result;
29+ }())
30 {
31- namespace po = boost::program_options;
32-
33- add_options()
34- (launch_child_opt, po::value<std::string>(), "system() command to launch client");
35-;
36 }
37
38 void BasicServerConfiguration::launch_client()
39
40=== modified file 'examples/demo-shell/demo_shell.cpp'
41--- examples/demo-shell/demo_shell.cpp 2014-01-13 06:12:33 +0000
42+++ examples/demo-shell/demo_shell.cpp 2014-02-21 14:57:04 +0000
43@@ -1,5 +1,5 @@
44 /*
45- * Copyright © 2013 Canonical Ltd.
46+ * Copyright © 2013-2014 Canonical Ltd.
47 *
48 * This program is free software: you can redistribute it and/or modify
49 * it under the terms of the GNU General Public License version 3 as
50@@ -22,6 +22,7 @@
51 #include "fullscreen_placement_strategy.h"
52 #include "../server_configuration.h"
53
54+#include "mir/options/default_configuration.h"
55 #include "mir/run_mir.h"
56 #include "mir/report_exception.h"
57 #include "mir/graphics/display.h"
58@@ -34,6 +35,7 @@
59 namespace mg = mir::graphics;
60 namespace mf = mir::frontend;
61 namespace mi = mir::input;
62+namespace mo = mir::options;
63
64 namespace mir
65 {
66@@ -44,14 +46,20 @@
67 {
68 DemoServerConfiguration(int argc, char const* argv[],
69 std::initializer_list<std::shared_ptr<mi::EventFilter>> const& filter_list)
70- : ServerConfiguration(argc, argv),
71+ : ServerConfiguration([argc, argv]
72+ {
73+ auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
74+
75+ namespace po = boost::program_options;
76+
77+ result->add_options()
78+ ("fullscreen-surfaces", po::value<bool>()->default_value(false),
79+ "Make all surfaces fullscreen");
80+
81+ return result;
82+ }()),
83 filter_list(filter_list)
84 {
85- namespace po = boost::program_options;
86-
87- add_options()
88- ("fullscreen-surfaces", po::value<bool>(),
89- "Make all surfaces fullscreen [bool:default=false]");
90 }
91
92 std::shared_ptr<msh::PlacementStrategy> the_shell_placement_strategy() override
93
94=== modified file 'examples/render_surfaces.cpp'
95--- examples/render_surfaces.cpp 2014-02-10 08:47:48 +0000
96+++ examples/render_surfaces.cpp 2014-02-21 14:57:04 +0000
97@@ -1,5 +1,5 @@
98 /*
99- * Copyright © 2012 Canonical Ltd.
100+ * Copyright © 2012-2014 Canonical Ltd.
101 *
102 * This program is free software: you can redistribute it and/or modify
103 * it under the terms of the GNU General Public License version 3 as
104@@ -18,6 +18,7 @@
105
106 #include "mir/compositor/display_buffer_compositor_factory.h"
107 #include "mir/compositor/display_buffer_compositor.h"
108+#include "mir/options/default_configuration.h"
109 #include "mir/graphics/graphic_buffer_allocator.h"
110 #include "mir/frontend/connector.h"
111 #include "mir/shell/surface_creation_parameters.h"
112@@ -51,12 +52,14 @@
113 namespace mc = mir::compositor;
114 namespace ms = mir::scene;
115 namespace mf = mir::frontend;
116+namespace mo = mir::options;
117 namespace msh = mir::shell;
118 namespace mi = mir::input;
119 namespace geom = mir::geometry;
120 namespace mt = mir::tools;
121 namespace me = mir::examples;
122
123+
124 ///\page render_surfaces-example render_surfaces.cpp: A simple program using the mir library.
125 ///\tableofcontents
126 ///render_surfaces shows the use of mir to render some moving surfaces
127@@ -252,16 +255,22 @@
128 class RenderSurfacesServerConfiguration : public me::ServerConfiguration
129 {
130 public:
131- RenderSurfacesServerConfiguration(int argc, char const** argv)
132- : ServerConfiguration(argc, argv)
133+ RenderSurfacesServerConfiguration(int argc, char const** argv) :
134+ ServerConfiguration([argc, argv]
135+ {
136+ auto result = std::make_shared<mo::DefaultConfiguration>(argc, argv);
137+
138+ namespace po = boost::program_options;
139+
140+ result->add_options()
141+ (surfaces_to_render, po::value<int>()->default_value(5),
142+ "Number of surfaces to render")
143+ (display_cursor, po::value<bool>()->default_value(false),
144+ "Display test cursor. (If input is disabled it gets animated.)");
145+
146+ return result;
147+ }())
148 {
149- namespace po = boost::program_options;
150-
151- add_options()
152- (surfaces_to_render, po::value<int>()->default_value(5),
153- "Number of surfaces to render")
154- (display_cursor, po::value<bool>()->default_value(false),
155- "Display test cursor. (If input is disabled it gets animated.)");
156 }
157
158 ///\internal [RenderSurfacesServerConfiguration_stubs_tag]
159@@ -443,7 +452,7 @@
160
161 bool input_is_on()
162 {
163- return the_options()->get<bool>(enable_input_opt);
164+ return the_options()->get<bool>(mo::enable_input_opt);
165 }
166
167 std::weak_ptr<mg::Cursor> the_cursor()
168
169=== modified file 'examples/server_configuration.cpp'
170--- examples/server_configuration.cpp 2014-01-30 07:17:36 +0000
171+++ examples/server_configuration.cpp 2014-02-21 14:57:04 +0000
172@@ -1,5 +1,5 @@
173 /*
174- * Copyright © 2013 Canonical Ltd.
175+ * Copyright © 2013-2014 Canonical Ltd.
176 *
177 * This program is free software: you can redistribute it and/or modify
178 * it under the terms of the GNU General Public License version 3 as
179@@ -17,6 +17,7 @@
180 */
181
182 #include "server_configuration.h"
183+#include "mir/options/default_configuration.h"
184 #include "mir/graphics/display_configuration_policy.h"
185 #include "mir/graphics/display_configuration.h"
186 #include "mir/input/composite_event_filter.h"
187@@ -145,16 +146,21 @@
188
189 }
190
191-me::ServerConfiguration::ServerConfiguration(int argc, char const** argv)
192- : DefaultServerConfiguration(argc, argv)
193+me::ServerConfiguration::ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options) :
194+ DefaultServerConfiguration(configuration_options)
195 {
196 namespace po = boost::program_options;
197
198- add_options()
199+ configuration_options->add_options()
200 (display_config_opt, po::value<std::string>()->default_value(clone_opt_val),
201 "Display configuration [{clone,sidebyside,single}]");
202 }
203
204+me::ServerConfiguration::ServerConfiguration(int argc, char const** argv) :
205+ ServerConfiguration(std::make_shared<options::DefaultConfiguration>(argc, argv))
206+{
207+}
208+
209 std::shared_ptr<mg::DisplayConfigurationPolicy>
210 me::ServerConfiguration::the_display_configuration_policy()
211 {
212
213=== modified file 'examples/server_configuration.h'
214--- examples/server_configuration.h 2013-08-28 03:41:48 +0000
215+++ examples/server_configuration.h 2014-02-21 14:57:04 +0000
216@@ -1,5 +1,5 @@
217 /*
218- * Copyright © 2013 Canonical Ltd.
219+ * Copyright © 2013-2014 Canonical Ltd.
220 *
221 * This program is free software: you can redistribute it and/or modify
222 * it under the terms of the GNU General Public License version 3 as
223@@ -23,6 +23,11 @@
224
225 namespace mir
226 {
227+namespace options
228+{
229+class DefaultConfiguration;
230+}
231+
232 namespace examples
233 {
234
235@@ -30,6 +35,7 @@
236 {
237 public:
238 ServerConfiguration(int argc, char const** argv);
239+ explicit ServerConfiguration(std::shared_ptr<options::DefaultConfiguration> const& configuration_options);
240
241 std::shared_ptr<graphics::DisplayConfigurationPolicy> the_display_configuration_policy() override;
242 std::shared_ptr<input::CompositeEventFilter> the_composite_event_filter() override;
243
244=== renamed file 'include/server/mir/abnormal_exit.h' => 'include/platform/mir/abnormal_exit.h'
245--- include/server/mir/abnormal_exit.h 2013-04-24 05:22:20 +0000
246+++ include/platform/mir/abnormal_exit.h 2014-02-21 14:57:04 +0000
247@@ -2,15 +2,15 @@
248 * Copyright © 2013 Canonical Ltd.
249 *
250 * This program is free software: you can redistribute it and/or modify it
251- * under the terms of the GNU General Public License version 3,
252+ * under the terms of the GNU Lesser General Public License version 3,
253 * as published by the Free Software Foundation.
254 *
255 * This program is distributed in the hope that it will be useful,
256 * but WITHOUT ANY WARRANTY; without even the implied warranty of
257 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
258- * GNU General Public License for more details.
259+ * GNU Lesser General Public License for more details.
260 *
261- * You should have received a copy of the GNU General Public License
262+ * You should have received a copy of the GNU Lesser General Public License
263 * along with this program. If not, see <http://www.gnu.org/licenses/>.
264 *
265 * Authored by: Alan Griffiths <alan@octopull.co.uk>
266
267=== added file 'include/platform/mir/options/configuration.h'
268--- include/platform/mir/options/configuration.h 1970-01-01 00:00:00 +0000
269+++ include/platform/mir/options/configuration.h 2014-02-21 14:57:04 +0000
270@@ -0,0 +1,74 @@
271+/*
272+ * Copyright © 2014 Canonical Ltd.
273+ *
274+ * This program is free software: you can redistribute it and/or modify it
275+ * under the terms of the GNU Lesser General Public License version 3,
276+ * as published by the Free Software Foundation.
277+ *
278+ * This program is distributed in the hope that it will be useful,
279+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
280+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
281+ * GNU Lesser General Public License for more details.
282+ *
283+ * You should have received a copy of the GNU Lesser General Public License
284+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
285+ *
286+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
287+ */
288+
289+#ifndef MIR_OPTIONS_CONFIGURATION_H_
290+#define MIR_OPTIONS_CONFIGURATION_H_
291+
292+#include "mir/options/program_option.h"
293+
294+#include <memory>
295+
296+namespace mir
297+{
298+namespace options
299+{
300+extern char const* const server_socket_opt;
301+extern char const* const no_server_socket_opt;
302+extern char const* const enable_input_opt;
303+extern char const* const session_mediator_report_opt;
304+extern char const* const msg_processor_report_opt;
305+extern char const* const compositor_report_opt;
306+extern char const* const display_report_opt;
307+extern char const* const legacy_input_report_opt;
308+extern char const* const connector_report_opt;
309+extern char const* const scene_report_opt;
310+extern char const* const input_report_opt;
311+extern char const* const host_socket_opt;
312+extern char const* const standalone_opt;
313+extern char const* const frontend_threads_opt;
314+
315+extern char const* const name_opt;
316+extern char const* const offscreen_opt;
317+
318+extern char const* const glog;
319+extern char const* const glog_stderrthreshold;
320+extern char const* const glog_minloglevel;
321+extern char const* const glog_log_dir;
322+
323+extern char const* const off_opt_value;
324+extern char const* const log_opt_value;
325+extern char const* const lttng_opt_value;
326+
327+extern char const* const platform_graphics_lib;
328+
329+class Configuration
330+{
331+public:
332+ virtual std::shared_ptr<options::Option> the_options() const = 0;
333+
334+protected:
335+
336+ Configuration() = default;
337+ virtual ~Configuration() = default;
338+ Configuration(Configuration const&) = delete;
339+ Configuration& operator=(Configuration const&) = delete;
340+};
341+}
342+}
343+
344+#endif /* MIR_OPTIONS_CONFIGURATION_H_ */
345
346=== renamed file 'include/server/mir/default_configuration_options.h' => 'include/platform/mir/options/default_configuration.h'
347--- include/server/mir/default_configuration_options.h 2014-02-18 15:12:13 +0000
348+++ include/platform/mir/options/default_configuration.h 2014-02-21 14:57:04 +0000
349@@ -1,101 +1,53 @@
350 /*
351- * Copyright © 2013 Canonical Ltd.
352+ * Copyright © 2013-2014 Canonical Ltd.
353 *
354 * This program is free software: you can redistribute it and/or modify it
355- * under the terms of the GNU General Public License version 3,
356+ * under the terms of the GNU Lesser General Public License version 3,
357 * as published by the Free Software Foundation.
358 *
359 * This program is distributed in the hope that it will be useful,
360 * but WITHOUT ANY WARRANTY; without even the implied warranty of
361 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
362- * GNU General Public License for more details.
363+ * GNU Lesser General Public License for more details.
364 *
365- * You should have received a copy of the GNU General Public License
366+ * You should have received a copy of the GNU Lesser General Public License
367 * along with this program. If not, see <http://www.gnu.org/licenses/>.
368 *
369 * Authored by: Alan Griffiths <alan@octopull.co.uk>
370 */
371
372-#ifndef MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
373-#define MIR_DEFAULT_CONFIGURATION_OPTIONS_H_
374-
375-#include "mir/options/program_option.h"
376-
377-#include <memory>
378+#ifndef MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
379+#define MIR_OPTIONS_DEFAULT_CONFIGURATION_H_
380+
381+#include "mir/options/configuration.h"
382+
383
384 namespace mir
385 {
386-class ConfigurationOptions
387-{
388-public:
389- static char const* const server_socket_opt;
390- static char const* const no_server_socket_opt;
391- static char const* const enable_input_opt;
392- static char const* const session_mediator_report_opt;
393- static char const* const msg_processor_report_opt;
394- static char const* const compositor_report_opt;
395- static char const* const display_report_opt;
396- static char const* const legacy_input_report_opt;
397- static char const* const connector_report_opt;
398- static char const* const scene_report_opt;
399- static char const* const input_report_opt;
400- static char const* const host_socket_opt;
401- static char const* const standalone_opt;
402- static char const* const frontend_threads_opt;
403- static int const default_ipc_threads;
404-
405- static char const* const name_opt;
406- static char const* const offscreen_opt;
407-
408- static char const* const glog;
409- static char const* const glog_stderrthreshold;
410- static char const* const glog_minloglevel;
411- static char const* const glog_log_dir;
412- static char const* const glog_log_dir_default;
413- static int const glog_stderrthreshold_default;
414- static int const glog_minloglevel_default;
415-
416- static bool const enable_input_default;
417-
418- static char const* const off_opt_value;
419- static char const* const log_opt_value;
420- static char const* const lttng_opt_value;
421-
422- static char const* const platform_graphics_lib;
423- static char const* const default_platform_graphics_lib;
424-
425- virtual std::shared_ptr<options::Option> the_options() const = 0;
426-
427-protected:
428-
429-
430- ConfigurationOptions() = default;
431- virtual ~ConfigurationOptions() = default;
432- ConfigurationOptions(ConfigurationOptions const&) = delete;
433- ConfigurationOptions& operator=(ConfigurationOptions const&) = delete;
434-};
435-
436-class DefaultConfigurationOptions : public ConfigurationOptions
437-{
438-public:
439- DefaultConfigurationOptions(int argc, char const* argv[]);
440- virtual ~DefaultConfigurationOptions() = default;
441-
442-protected:
443- // add_options() allows configuration specializations to add their
444- // own options. This MUST be called before the first invocation of
445- // the_options() - typically during construction.
446+namespace options
447+{
448+class DefaultConfiguration : public Configuration
449+{
450+public:
451+ DefaultConfiguration(int argc, char const* argv[]);
452+ virtual ~DefaultConfiguration() = default;
453+
454+ // add_options() allows users to add their own options. This MUST be called
455+ // before the first invocation of the_options() - typically during initialization.
456 boost::program_options::options_description_easy_init add_options();
457- virtual void parse_options(boost::program_options::options_description& options_description, options::ProgramOption& options) const;
458- virtual std::shared_ptr<options::Option> the_options() const;
459
460 private:
461+ // accessed via the base interface, when access to add_options() has been "lost"
462+ std::shared_ptr<options::Option> the_options() const override;
463+
464+ virtual void parse_options(boost::program_options::options_description& options_description, ProgramOption& options) const;
465+
466 int const argc;
467 char const** const argv;
468 std::shared_ptr<boost::program_options::options_description> const program_options;
469- std::shared_ptr<options::Option> mutable options;
470+ std::shared_ptr<Option> mutable options;
471 };
472 }
473-
474-
475-#endif /* MIR_DEFAULT_CONFIGURATION_OPTIONS_H_ */
476+}
477+
478+#endif /* MIR_OPTIONS_DEFAULT_CONFIGURATION_H_ */
479
480=== modified file 'include/server/mir/default_server_configuration.h'
481--- include/server/mir/default_server_configuration.h 2014-02-19 14:01:37 +0000
482+++ include/server/mir/default_server_configuration.h 2014-02-21 14:57:04 +0000
483@@ -1,5 +1,5 @@
484 /*
485- * Copyright © 2012 Canonical Ltd.
486+ * Copyright © 2012-2014 Canonical Ltd.
487 *
488 * This program is free software: you can redistribute it and/or modify it
489 * under the terms of the GNU General Public License version 3,
490@@ -20,7 +20,6 @@
491
492 #include "mir/cached_ptr.h"
493 #include "mir/server_configuration.h"
494-#include "mir/default_configuration_options.h"
495
496 #include <memory>
497 #include <string>
498@@ -113,15 +112,23 @@
499 {
500 class Logger;
501 }
502+
503+namespace options
504+{
505+class Option;
506+class Configuration;
507+}
508+
509 namespace report
510 {
511 class ReportFactory;
512 }
513
514-class DefaultServerConfiguration : public virtual ServerConfiguration, protected DefaultConfigurationOptions
515+class DefaultServerConfiguration : public virtual ServerConfiguration
516 {
517 public:
518 DefaultServerConfiguration(int argc, char const* argv[]);
519+ explicit DefaultServerConfiguration(std::shared_ptr<options::Configuration> const& configuration_options);
520
521 /** @name DisplayServer dependencies
522 * dependencies of DisplayServer on the rest of the Mir
523@@ -239,9 +246,7 @@
524 virtual std::shared_ptr<time::Clock> the_clock();
525
526 protected:
527- using DefaultConfigurationOptions::the_options;
528- using DefaultConfigurationOptions::add_options;
529- using DefaultConfigurationOptions::parse_options;
530+ std::shared_ptr<options::Option> the_options() const;
531
532 virtual std::shared_ptr<input::InputChannelFactory> the_input_channel_factory();
533 virtual std::shared_ptr<scene::MediatingDisplayChanger> the_mediating_display_changer();
534@@ -301,6 +306,7 @@
535 CachedPtr<scene::MediatingDisplayChanger> mediating_display_changer;
536
537 private:
538+ std::shared_ptr<options::Configuration> const configuration_options;
539 std::shared_ptr<input::EventFilter> const default_filter;
540
541 virtual std::string the_socket_file() const;
542
543=== modified file 'src/platform/CMakeLists.txt'
544--- src/platform/CMakeLists.txt 2014-01-22 08:32:55 +0000
545+++ src/platform/CMakeLists.txt 2014-02-21 14:57:04 +0000
546@@ -17,3 +17,4 @@
547 install(TARGETS mirplatform LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
548
549 add_subdirectory(graphics/)
550+add_subdirectory(options)
551
552=== renamed directory 'src/server/options' => 'src/platform/options'
553=== modified file 'src/platform/options/CMakeLists.txt'
554--- src/server/options/CMakeLists.txt 2013-03-13 04:54:15 +0000
555+++ src/platform/options/CMakeLists.txt 2014-02-21 14:57:04 +0000
556@@ -2,6 +2,7 @@
557 CHOICE_SOURCES
558
559 program_option.cpp
560+ default_configuration.cpp
561 )
562
563 add_library(
564
565=== renamed file 'src/server/default_configuration_options.cpp' => 'src/platform/options/default_configuration.cpp'
566--- src/server/default_configuration_options.cpp 2014-02-19 14:01:37 +0000
567+++ src/platform/options/default_configuration.cpp 2014-02-21 14:57:04 +0000
568@@ -2,29 +2,31 @@
569 * Copyright © 2013 Canonical Ltd.
570 *
571 * This program is free software: you can redistribute it and/or modify it
572- * under the terms of the GNU General Public License version 3,
573+ * under the terms of the GNU Lesser General Public License version 3,
574 * as published by the Free Software Foundation.
575 *
576 * This program is distributed in the hope that it will be useful,
577 * but WITHOUT ANY WARRANTY; without even the implied warranty of
578 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
579- * GNU General Public License for more details.
580+ * GNU Lesser General Public License for more details.
581 *
582- * You should have received a copy of the GNU General Public License
583+ * You should have received a copy of the GNU Lesser General Public License
584 * along with this program. If not, see <http://www.gnu.org/licenses/>.
585 *
586 * Authored by: Alan Griffiths <alan@octopull.co.uk>
587 */
588
589-#include "mir/default_configuration_options.h"
590+#include "mir/options/default_configuration.h"
591 #include "mir/default_configuration.h"
592 #include "mir/abnormal_exit.h"
593
594+namespace mo = mir::options;
595+
596 namespace
597 {
598 void parse_arguments(
599 boost::program_options::options_description desc,
600- mir::options::ProgramOption& options,
601+ mo::ProgramOption& options,
602 int argc,
603 char const* argv[])
604 {
605@@ -54,7 +56,7 @@
606
607 void parse_environment(
608 boost::program_options::options_description& desc,
609- mir::options::ProgramOption& options)
610+ mo::ProgramOption& options)
611 {
612 // If MIR_SERVER_HOST_SOCKET is unset, we want to substitute the value of
613 // MIR_SOCKET. Do this now, because MIR_SOCKET will get overwritten later.
614@@ -67,49 +69,51 @@
615 }
616 }
617
618-char const* const mir::ConfigurationOptions::server_socket_opt = "file,f";
619-char const* const mir::ConfigurationOptions::no_server_socket_opt = "no-file";
620-char const* const mir::ConfigurationOptions::enable_input_opt = "enable-input,i";
621-char const* const mir::ConfigurationOptions::session_mediator_report_opt = "session-mediator-report";
622-char const* const mir::ConfigurationOptions::msg_processor_report_opt = "msg-processor-report";
623-char const* const mir::ConfigurationOptions::compositor_report_opt = "compositor-report";
624-char const* const mir::ConfigurationOptions::display_report_opt = "display-report";
625-char const* const mir::ConfigurationOptions::legacy_input_report_opt = "legacy-input-report";
626-char const* const mir::ConfigurationOptions::connector_report_opt = "connector-report";
627-char const* const mir::ConfigurationOptions::scene_report_opt = "scene-report";
628-char const* const mir::ConfigurationOptions::input_report_opt = "input-report";
629-char const* const mir::ConfigurationOptions::host_socket_opt = "host-socket";
630-char const* const mir::ConfigurationOptions::standalone_opt = "standalone";
631-char const* const mir::ConfigurationOptions::frontend_threads_opt = "ipc-thread-pool";
632-int const mir::ConfigurationOptions::default_ipc_threads = 1;
633-char const* const mir::ConfigurationOptions::name_opt = "name";
634-char const* const mir::ConfigurationOptions::offscreen_opt = "offscreen";
635-
636-char const* const mir::ConfigurationOptions::glog = "glog";
637-char const* const mir::ConfigurationOptions::glog_stderrthreshold = "glog-stderrthreshold";
638-char const* const mir::ConfigurationOptions::glog_minloglevel = "glog-minloglevel";
639-char const* const mir::ConfigurationOptions::glog_log_dir = "glog-log-dir";
640-int const mir::ConfigurationOptions::glog_stderrthreshold_default = 2;
641-int const mir::ConfigurationOptions::glog_minloglevel_default = 0;
642-char const* const mir::ConfigurationOptions::glog_log_dir_default = "";
643-
644-bool const mir::ConfigurationOptions::enable_input_default = true;
645-
646-char const* const mir::ConfigurationOptions::off_opt_value = "off";
647-char const* const mir::ConfigurationOptions::log_opt_value = "log";
648-char const* const mir::ConfigurationOptions::lttng_opt_value = "lttng";
649-
650-char const* const mir::ConfigurationOptions::platform_graphics_lib = "platform-graphics-lib";
651-char const* const mir::ConfigurationOptions::default_platform_graphics_lib = "libmirplatformgraphics.so";
652-
653-
654-mir::DefaultConfigurationOptions::DefaultConfigurationOptions(int argc, char const* argv[]) :
655+char const* const mo::server_socket_opt = "file,f";
656+char const* const mo::no_server_socket_opt = "no-file";
657+char const* const mo::enable_input_opt = "enable-input,i";
658+char const* const mo::session_mediator_report_opt = "session-mediator-report";
659+char const* const mo::msg_processor_report_opt = "msg-processor-report";
660+char const* const mo::compositor_report_opt = "compositor-report";
661+char const* const mo::display_report_opt = "display-report";
662+char const* const mo::legacy_input_report_opt = "legacy-input-report";
663+char const* const mo::connector_report_opt = "connector-report";
664+char const* const mo::scene_report_opt = "scene-report";
665+char const* const mo::input_report_opt = "input-report";
666+char const* const mo::host_socket_opt = "host-socket";
667+char const* const mo::standalone_opt = "standalone";
668+char const* const mo::frontend_threads_opt = "ipc-thread-pool";
669+char const* const mo::name_opt = "name";
670+char const* const mo::offscreen_opt = "offscreen";
671+
672+char const* const mo::glog = "glog";
673+char const* const mo::glog_stderrthreshold = "glog-stderrthreshold";
674+char const* const mo::glog_minloglevel = "glog-minloglevel";
675+char const* const mo::glog_log_dir = "glog-log-dir";
676+char const* const mo::off_opt_value = "off";
677+char const* const mo::log_opt_value = "log";
678+char const* const mo::lttng_opt_value = "lttng";
679+
680+char const* const mo::platform_graphics_lib = "platform-graphics-lib";
681+
682+namespace
683+{
684+int const default_ipc_threads = 1;
685+int const glog_stderrthreshold_default = 2;
686+int const glog_minloglevel_default = 0;
687+char const* const glog_log_dir_default = "";
688+bool const enable_input_default = true;
689+char const* const default_platform_graphics_lib = "libmirplatformgraphics.so";
690+}
691+
692+mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :
693 argc(argc),
694 argv(argv),
695 program_options(std::make_shared<boost::program_options::options_description>(
696 "Command-line options.\n"
697 "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\""))
698 {
699+ using namespace options;
700 namespace po = boost::program_options;
701
702 add_options()
703@@ -165,7 +169,7 @@
704 "VT to run on or 0 to use current.");
705 }
706
707-boost::program_options::options_description_easy_init mir::DefaultConfigurationOptions::add_options()
708+boost::program_options::options_description_easy_init mo::DefaultConfiguration::add_options()
709 {
710 if (options)
711 BOOST_THROW_EXCEPTION(std::logic_error("add_options() must be called before the_options()"));
712@@ -173,17 +177,17 @@
713 return program_options->add_options();
714 }
715
716-void mir::DefaultConfigurationOptions::parse_options(boost::program_options::options_description& options_description, mir::options::ProgramOption& options) const
717+void mo::DefaultConfiguration::parse_options(boost::program_options::options_description& options_description, ProgramOption& options) const
718 {
719 parse_arguments(options_description, options, argc, argv);
720 parse_environment(options_description, options);
721 }
722
723-std::shared_ptr<mir::options::Option> mir::DefaultConfigurationOptions::the_options() const
724+std::shared_ptr<mo::Option> mo::DefaultConfiguration::the_options() const
725 {
726 if (!options)
727 {
728- auto options = std::make_shared<mir::options::ProgramOption>();
729+ auto options = std::make_shared<ProgramOption>();
730 parse_options(*program_options, *options);
731 this->options = options;
732 }
733
734=== modified file 'src/platform/options/program_option.cpp'
735--- src/server/options/program_option.cpp 2014-01-30 07:17:36 +0000
736+++ src/platform/options/program_option.cpp 2014-02-21 14:57:04 +0000
737@@ -2,15 +2,15 @@
738 * Copyright © 2012 Canonical Ltd.
739 *
740 * This program is free software: you can redistribute it and/or modify it
741- * under the terms of the GNU General Public License version 3,
742+ * under the terms of the GNU Lesser General Public License version 3,
743 * as published by the Free Software Foundation.
744 *
745 * This program is distributed in the hope that it will be useful,
746 * but WITHOUT ANY WARRANTY; without even the implied warranty of
747 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
748- * GNU General Public License for more details.
749+ * GNU Lesser General Public License for more details.
750 *
751- * You should have received a copy of the GNU General Public License
752+ * You should have received a copy of the GNU Lesser General Public License
753 * along with this program. If not, see <http://www.gnu.org/licenses/>.
754 *
755 * Authored by: Alan Griffiths <alan@octopull.co.uk>
756
757=== modified file 'src/server/CMakeLists.txt'
758--- src/server/CMakeLists.txt 2014-02-20 11:52:25 +0000
759+++ src/server/CMakeLists.txt 2014-02-21 14:57:04 +0000
760@@ -8,7 +8,6 @@
761 add_subdirectory(report/)
762 add_subdirectory(logging/)
763 add_subdirectory(scene/)
764-add_subdirectory(options/)
765 add_subdirectory(frontend/)
766 add_subdirectory(shell/)
767 add_subdirectory(time/)
768@@ -29,7 +28,6 @@
769 run_mir.cpp
770 report_exception.cpp
771 display_server.cpp
772- default_configuration_options.cpp
773 default_server_configuration.cpp
774 asio_main_loop.cpp
775 )
776
777=== modified file 'src/server/default_server_configuration.cpp'
778--- src/server/default_server_configuration.cpp 2014-02-11 15:33:36 +0000
779+++ src/server/default_server_configuration.cpp 2014-02-21 14:57:04 +0000
780@@ -1,5 +1,5 @@
781 /*
782- * Copyright © 2012 Canonical Ltd.
783+ * Copyright © 2012-2014 Canonical Ltd.
784 *
785 * This program is free software: you can redistribute it and/or modify it
786 * under the terms of the GNU General Public License version 3,
787@@ -17,6 +17,7 @@
788 */
789
790 #include "mir/default_server_configuration.h"
791+#include "mir/options/default_configuration.h"
792 #include "mir/abnormal_exit.h"
793 #include "mir/asio_main_loop.h"
794 #include "mir/default_server_status_listener.h"
795@@ -41,19 +42,31 @@
796 namespace geom = mir::geometry;
797 namespace mf = mir::frontend;
798 namespace mg = mir::graphics;
799+namespace mo = mir::options;
800 namespace ms = mir::scene;
801 namespace msh = mir::shell;
802 namespace mi = mir::input;
803
804 mir::DefaultServerConfiguration::DefaultServerConfiguration(int argc, char const* argv[]) :
805- DefaultConfigurationOptions(argc, argv),
806+ DefaultServerConfiguration(std::make_shared<mo::DefaultConfiguration>(argc, argv))
807+{
808+}
809+
810+mir::DefaultServerConfiguration::DefaultServerConfiguration(std::shared_ptr<mo::Configuration> const& configuration_options) :
811+ configuration_options(configuration_options),
812 default_filter(std::make_shared<mi::VTFilter>())
813 {
814 }
815
816+auto mir::DefaultServerConfiguration::the_options() const
817+->std::shared_ptr<options::Option>
818+{
819+ return configuration_options->the_options();
820+}
821+
822 std::string mir::DefaultServerConfiguration::the_socket_file() const
823 {
824- auto socket_file = the_options()->get<std::string>(server_socket_opt);
825+ auto socket_file = the_options()->get<std::string>(options::server_socket_opt);
826
827 // Record this for any children that want to know how to connect to us.
828 // By both listening to this env var on startup and resetting it here,
829
830=== modified file 'src/server/frontend/default_configuration.cpp'
831--- src/server/frontend/default_configuration.cpp 2014-02-19 14:01:37 +0000
832+++ src/server/frontend/default_configuration.cpp 2014-02-21 14:57:04 +0000
833@@ -25,6 +25,7 @@
834 #include "session_mediator.h"
835 #include "unauthorized_display_changer.h"
836
837+#include "mir/options/configuration.h"
838 #include "mir/options/option.h"
839 #include "mir/graphics/graphic_buffer_allocator.h"
840
841@@ -115,9 +116,9 @@
842 return connector(
843 [&,this]() -> std::shared_ptr<mf::Connector>
844 {
845- auto const threads = the_options()->get<int>(frontend_threads_opt);
846+ auto const threads = the_options()->get<int>(options::frontend_threads_opt);
847
848- if (the_options()->is_set(no_server_socket_opt))
849+ if (the_options()->is_set(options::no_server_socket_opt))
850 {
851 return std::make_shared<mf::BasicConnector>(
852 the_session_creator(),
853
854=== modified file 'src/server/graphics/default_configuration.cpp'
855--- src/server/graphics/default_configuration.cpp 2014-02-11 15:29:56 +0000
856+++ src/server/graphics/default_configuration.cpp 2014-02-21 14:57:04 +0000
857@@ -17,6 +17,8 @@
858 */
859
860 #include "mir/default_server_configuration.h"
861+#include "mir/options/configuration.h"
862+#include "mir/options/option.h"
863
864 #include "default_display_configuration_policy.h"
865 #include "nested/host_connection.h"
866@@ -30,6 +32,8 @@
867
868 #include <boost/throw_exception.hpp>
869
870+#include <map>
871+
872 namespace mg = mir::graphics;
873
874 namespace
875@@ -76,10 +80,10 @@
876 return graphics_platform(
877 [this]()->std::shared_ptr<mg::Platform>
878 {
879- auto graphics_lib = load_library(the_options()->get<std::string>(platform_graphics_lib));
880+ auto graphics_lib = load_library(the_options()->get<std::string>(options::platform_graphics_lib));
881
882 // TODO (default-nested): don't fallback to standalone if host socket is unset in 14.04
883- if (the_options()->is_set(standalone_opt) || !the_options()->is_set(host_socket_opt))
884+ if (the_options()->is_set(options::standalone_opt) || !the_options()->is_set(options::host_socket_opt))
885 {
886 auto create_platform = graphics_lib->load_function<mg::CreatePlatform>("create_platform");
887 return create_platform(the_options(), the_display_report());
888@@ -111,7 +115,7 @@
889 return display(
890 [this]() -> std::shared_ptr<mg::Display>
891 {
892- if (the_options()->is_set(offscreen_opt))
893+ if (the_options()->is_set(options::offscreen_opt))
894 {
895 return std::make_shared<mg::offscreen::Display>(
896 the_graphics_platform(),
897@@ -134,19 +138,19 @@
898 {
899 auto const options = the_options();
900
901- if (!options->is_set(standalone_opt))
902+ if (!options->is_set(options::standalone_opt))
903 {
904- if (!options->is_set(host_socket_opt))
905+ if (!options->is_set(options::host_socket_opt))
906 BOOST_THROW_EXCEPTION(mir::AbnormalExit("Exiting Mir! Specify either $MIR_SOCKET or --standalone"));
907
908- auto host_socket = options->get<std::string>(host_socket_opt);
909+ auto host_socket = options->get<std::string>(options::host_socket_opt);
910 auto server_socket = the_socket_file();
911
912 if (server_socket == host_socket)
913 BOOST_THROW_EXCEPTION(mir::AbnormalExit("Exiting Mir! Reason: Nested Mir and Host Mir cannot use the same socket file to accept connections!"));
914
915- auto const my_name = options->is_set(name_opt) ?
916- options->get<std::string>(name_opt) :
917+ auto const my_name = options->is_set(options::name_opt) ?
918+ options->get<std::string>(options::name_opt) :
919 "nested-mir@:" + server_socket;
920
921 return std::make_shared<graphics::nested::HostConnection>(
922
923=== modified file 'src/server/input/default_configuration.cpp'
924--- src/server/input/default_configuration.cpp 2014-02-10 10:57:08 +0000
925+++ src/server/input/default_configuration.cpp 2014-02-21 14:57:04 +0000
926@@ -25,6 +25,8 @@
927 #include "null_input_configuration.h"
928
929 #include "mir/input/android/default_android_input_configuration.h"
930+#include "mir/options/configuration.h"
931+#include "mir/options/option.h"
932 #include "mir/report/legacy_input_report.h"
933
934
935@@ -61,12 +63,12 @@
936 [this]() -> std::shared_ptr<mi::InputConfiguration>
937 {
938 auto const options = the_options();
939- if (!options->get<bool>(enable_input_opt))
940+ if (!options->get<bool>(options::enable_input_opt))
941 {
942 return std::make_shared<mi::NullInputConfiguration>();
943 }
944 // TODO (default-nested): don't fallback to standalone if host socket is unset in 14.04
945- else if (options->is_set(standalone_opt) || !options->is_set(host_socket_opt))
946+ else if (options->is_set(options::standalone_opt) || !options->is_set(options::host_socket_opt))
947 {
948 return std::make_shared<mia::DefaultInputConfiguration>(
949 the_composite_event_filter(),
950@@ -92,7 +94,7 @@
951 return input_manager(
952 [&, this]() -> std::shared_ptr<mi::InputManager>
953 {
954- if (the_options()->get<std::string>(legacy_input_report_opt) == log_opt_value)
955+ if (the_options()->get<std::string>(options::legacy_input_report_opt) == options::log_opt_value)
956 mr::legacy_input::initialize(the_logger());
957 return the_input_configuration()->the_input_manager();
958 });
959
960=== modified file 'src/server/logging/default_configuration.cpp'
961--- src/server/logging/default_configuration.cpp 2014-02-11 15:18:07 +0000
962+++ src/server/logging/default_configuration.cpp 2014-02-21 14:57:04 +0000
963@@ -19,6 +19,7 @@
964 #include "mir/logging/logger.h"
965 #include "mir/logging/glog_logger.h"
966 #include "mir/default_server_configuration.h"
967+#include "mir/options/default_configuration.h"
968 #include "mir/logging/dumb_console_logger.h"
969
970 namespace ml = mir::logging;
971@@ -29,13 +30,13 @@
972 return logger(
973 [this]() -> std::shared_ptr<ml::Logger>
974 {
975- if (the_options()->is_set(glog))
976+ if (the_options()->is_set(options::glog))
977 {
978 return std::make_shared<ml::GlogLogger>(
979 "mir",
980- the_options()->get<int>(glog_stderrthreshold),
981- the_options()->get<int>(glog_minloglevel),
982- the_options()->get<std::string>(glog_log_dir));
983+ the_options()->get<int>(options::glog_stderrthreshold),
984+ the_options()->get<int>(options::glog_minloglevel),
985+ the_options()->get<std::string>(options::glog_log_dir));
986 }
987 else
988 {
989
990=== modified file 'src/server/report/default_server_configuration.cpp'
991--- src/server/report/default_server_configuration.cpp 2014-02-11 15:18:07 +0000
992+++ src/server/report/default_server_configuration.cpp 2014-02-21 14:57:04 +0000
993@@ -17,6 +17,7 @@
994 */
995
996 #include "mir/default_server_configuration.h"
997+#include "mir/options/configuration.h"
998
999 #include "lttng_report_factory.h"
1000 #include "logging_report_factory.h"
1001@@ -34,23 +35,23 @@
1002 {
1003 auto opt = the_options()->get<std::string>(report_opt);
1004
1005- if (opt == log_opt_value)
1006+ if (opt == options::log_opt_value)
1007 {
1008 return std::unique_ptr<mir::report::ReportFactory>(new report::LoggingReportFactory(the_logger(), the_clock()));
1009 }
1010- else if (opt == lttng_opt_value)
1011+ else if (opt == options::lttng_opt_value)
1012 {
1013 return std::unique_ptr<mir::report::ReportFactory>(new report::LttngReportFactory());
1014 }
1015- else if (opt == off_opt_value)
1016+ else if (opt == options::off_opt_value)
1017 {
1018 return std::unique_ptr<mir::report::ReportFactory>(new report::NullReportFactory());
1019 }
1020 else
1021 {
1022 throw AbnormalExit(std::string("Invalid ") + report_opt + " option: " + opt + " (valid options are: \"" +
1023- ConfigurationOptions::off_opt_value + "\" and \"" + ConfigurationOptions::log_opt_value +
1024- "\" and \"" + ConfigurationOptions::lttng_opt_value + "\")");
1025+ options::off_opt_value + "\" and \"" + options::log_opt_value +
1026+ "\" and \"" + options::lttng_opt_value + "\")");
1027 }
1028 }
1029
1030@@ -59,7 +60,7 @@
1031 return compositor_report(
1032 [this]()->std::shared_ptr<mc::CompositorReport>
1033 {
1034- return report_factory(compositor_report_opt)->create_compositor_report();
1035+ return report_factory(options::compositor_report_opt)->create_compositor_report();
1036 });
1037 }
1038
1039@@ -68,7 +69,7 @@
1040 return connector_report(
1041 [this]()->std::shared_ptr<mf::ConnectorReport>
1042 {
1043- return report_factory(connector_report_opt)->create_connector_report();
1044+ return report_factory(options::connector_report_opt)->create_connector_report();
1045 });
1046 }
1047
1048@@ -77,7 +78,7 @@
1049 return session_mediator_report(
1050 [this]()->std::shared_ptr<mf::SessionMediatorReport>
1051 {
1052- return report_factory(session_mediator_report_opt)->create_session_mediator_report();
1053+ return report_factory(options::session_mediator_report_opt)->create_session_mediator_report();
1054 });
1055 }
1056
1057@@ -86,7 +87,7 @@
1058 return message_processor_report(
1059 [this]()->std::shared_ptr<mf::MessageProcessorReport>
1060 {
1061- return report_factory(msg_processor_report_opt)->create_message_processor_report();
1062+ return report_factory(options::msg_processor_report_opt)->create_message_processor_report();
1063 });
1064 }
1065
1066@@ -95,7 +96,7 @@
1067 return display_report(
1068 [this]()->std::shared_ptr<mg::DisplayReport>
1069 {
1070- return report_factory(display_report_opt)->create_display_report();
1071+ return report_factory(options::display_report_opt)->create_display_report();
1072 });
1073 }
1074
1075@@ -104,7 +105,7 @@
1076 return input_report(
1077 [this]()->std::shared_ptr<mi::InputReport>
1078 {
1079- return report_factory(input_report_opt)->create_input_report();
1080+ return report_factory(options::input_report_opt)->create_input_report();
1081 });
1082 }
1083
1084@@ -113,8 +114,6 @@
1085 return scene_report(
1086 [this]()->std::shared_ptr<ms::SceneReport>
1087 {
1088- return report_factory(scene_report_opt)->create_scene_report();
1089+ return report_factory(options::scene_report_opt)->create_scene_report();
1090 });
1091 }
1092-
1093-
1094
1095=== modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp'
1096--- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-02-17 22:35:23 +0000
1097+++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2014-02-21 14:57:04 +0000
1098@@ -20,6 +20,8 @@
1099 #include "mir/graphics/buffer_id.h"
1100 #include "mir/graphics/buffer_properties.h"
1101 #include "mir/graphics/buffer_initializer.h"
1102+#include "mir/options/configuration.h"
1103+#include "mir/options/option.h"
1104 #include "mir_test_doubles/stub_buffer.h"
1105 #include "mir_test_doubles/stub_buffer_allocator.h"
1106 #include "mir_test_doubles/null_platform.h"
1107
1108=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
1109--- tests/mir_test_framework/stubbed_server_configuration.cpp 2014-02-13 07:19:39 +0000
1110+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2014-02-21 14:57:04 +0000
1111@@ -1,5 +1,5 @@
1112 /*
1113- * Copyright © 2013 Canonical Ltd.
1114+ * Copyright © 2013-2014 Canonical Ltd.
1115 *
1116 * This program is free software: you can redistribute it and/or modify it
1117 * under the terms of the GNU General Public License version 3,
1118@@ -18,6 +18,7 @@
1119
1120 #include "mir_test_framework/stubbed_server_configuration.h"
1121
1122+#include "mir/options/default_configuration.h"
1123 #include "mir/geometry/rectangle.h"
1124 #include "mir/graphics/buffer_ipc_packer.h"
1125 #include "mir/input/input_channel.h"
1126@@ -50,6 +51,7 @@
1127 namespace mc = mir::compositor;
1128 namespace mg = mir::graphics;
1129 namespace mi = mir::input;
1130+namespace mo = mir::options;
1131 namespace mtd = mir::test::doubles;
1132 namespace mtf = mir_test_framework;
1133
1134@@ -239,13 +241,19 @@
1135 }
1136
1137 mtf::StubbedServerConfiguration::StubbedServerConfiguration() :
1138- DefaultServerConfiguration(::argc, ::argv)
1139+ DefaultServerConfiguration([]
1140+ {
1141+ auto result = std::make_shared<mo::DefaultConfiguration>(::argc, ::argv);
1142+
1143+ namespace po = boost::program_options;
1144+
1145+ result->add_options()
1146+ ("tests-use-real-graphics", po::value<bool>()->default_value(false), "Use real graphics in tests.")
1147+ ("tests-use-real-input", po::value<bool>()->default_value(false), "Use real input in tests.");
1148+
1149+ return result;
1150+ }())
1151 {
1152- namespace po = boost::program_options;
1153-
1154- add_options()
1155- ("tests-use-real-graphics", po::value<bool>()->default_value(false), "Use real graphics in tests.")
1156- ("tests-use-real-input", po::value<bool>()->default_value(false), "Use real input in tests.");
1157 }
1158
1159 std::shared_ptr<mg::Platform> mtf::StubbedServerConfiguration::the_graphics_platform()

Subscribers

People subscribed via source and target branches