Mir

Merge lp:~alan-griffiths/mir/helptext-mentions-config-file into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2612
Proposed branch: lp:~alan-griffiths/mir/helptext-mentions-config-file
Merge into: lp:mir
Diff against target: 180 lines (+63/-33)
4 files modified
src/include/platform/mir/options/default_configuration.h (+10/-4)
src/platform/options/default_configuration.cpp (+48/-7)
src/server/server.cpp (+3/-21)
tests/mir_test_framework/command_line_server_configuration.cpp (+2/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/helptext-mentions-config-file
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Kevin DuBois (community) Approve
Review via email: mp+260439@code.launchpad.net

Commit message

options: incorporate the program name and any (optional) config file into the description text

Description of the change

options: incorporate the program name and any (optional) config file into the description text

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
Kevin DuBois (kdub) wrote :

88+ "The config file (" + config_file + ") is located via the XDG Base Directory Specification.\n\n";
Recommending $XDG_RUNTIME_DIR as the first place to look would be more helpful, but the changes lgtm overall.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

subprocess.CalledProcessError: Command 'phablet-network --skip-setup' returned non-zero exit status 124
SETTING UP SUDO
[sudo] password for phablet: Sorry, try again.
[sudo] password for phablet:
sudo: 1 incorrect password attempt

CI infrastructure

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 from a functionality perspective.

A couple of formatting issues:

13+ DefaultConfiguration(
14+ int argc, char const* argv[], std::function <void(
15+ int argc, char const* const* argv)> const& handler);

Clearer if std::function<> is on its own line (i.e. like it was before), instead of breaking after the parenthesis.

16+ DefaultConfiguration(
17+ int argc, char const* argv[], std::function <void(
18+ int argc, char const* const* argv)> const& handler,
19+ std::string const& config_file);

Clearer if std::function<> is on its own line, instead of breaking after the parenthesis.
Also, the indentation is too deep.

51+ DefaultConfiguration(argc, argv, [](int argc, char const* const* argv)
52 {

Clearer (IMO) if [](int argc, ...) is on its own line before the opening brace, to keep the lambda together (i.e. at the same indentation level).

review: Needs Fixing
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

[ RUN ] GLMark2Test.benchmark_fullscreen_default
[1433254279.005835] mirplatform: Found graphics driver: android
[1433254279.006018] mirplatform: Found graphics driver: dummy
[1433254279.006659] mirplatform: Found graphics driver: mesa
glmark2-es2-mir: relocation error: /usr/lib/arm-linux-gnueabihf/libmirclient.so.8: symbol _ZN3mir8dispatch20SimpleDispatchThreadC1ERKSt10shared_ptrINS0_12DispatchableEE, version MIR_COMMON_4 not defined in file libmircommon.so.4 with link time reference
/tmp/buildd/mir-0.14.0bzr2612pkg0wily2609+autopilot0/tests/performance-tests/test_glmark2-es2-mir.cpp:63: Failure
Value of: score
Expected: is >= 52
Actual: -1 (of type int)
[ FAILED ] GLMark2Test.benchmark_fullscreen_default (858 ms)
[----------] 1 test from GLMark2Test (860 ms total)

Oh! We've still got ABI issues. :(

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/include/platform/mir/options/default_configuration.h'
--- src/include/platform/mir/options/default_configuration.h 2015-03-31 02:35:42 +0000
+++ src/include/platform/mir/options/default_configuration.h 2015-06-02 09:07:30 +0000
@@ -32,10 +32,14 @@
32{32{
33public:33public:
34 DefaultConfiguration(int argc, char const* argv[]);34 DefaultConfiguration(int argc, char const* argv[]);
35 DefaultConfiguration(35 DefaultConfiguration(int argc, char const* argv[], std::string const& config_file);
36 int argc,36 DefaultConfiguration(
37 char const* argv[],37 int argc, char const* argv[],
38 std::function<void(int argc, char const* const* argv)> const& handler);38 std::function <void(int argc, char const* const* argv)> const& handler);
39 DefaultConfiguration(
40 int argc, char const* argv[],
41 std::function <void(int argc, char const* const* argv)> const& handler,
42 std::string const& config_file);
39 virtual ~DefaultConfiguration() = default;43 virtual ~DefaultConfiguration() = default;
4044
41 // add_options() allows users to add their own options. This MUST be called45 // add_options() allows users to add their own options. This MUST be called
@@ -47,6 +51,8 @@
47 // call destructors in DSOs we've unloaded.51 // call destructors in DSOs we've unloaded.
48 std::shared_ptr<SharedLibrary> platform_graphics_library;52 std::shared_ptr<SharedLibrary> platform_graphics_library;
4953
54 std::string const config_file;
55
50 void add_platform_options();56 void add_platform_options();
51 // accessed via the base interface, when access to add_options() has been "lost"57 // accessed via the base interface, when access to add_options() has been "lost"
52 std::shared_ptr<options::Option> the_options() const override;58 std::shared_ptr<options::Option> the_options() const override;
5359
=== modified file 'src/platform/options/default_configuration.cpp'
--- src/platform/options/default_configuration.cpp 2015-05-19 21:34:34 +0000
+++ src/platform/options/default_configuration.cpp 2015-06-02 09:07:30 +0000
@@ -65,8 +65,15 @@
65}65}
6666
67mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :67mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :
68 DefaultConfiguration(68 DefaultConfiguration(argc, argv, std::string{})
69 argc, argv,69{
70}
71
72mo::DefaultConfiguration::DefaultConfiguration(
73 int argc,
74 char const* argv[],
75 std::string const& config_file) :
76 DefaultConfiguration(argc, argv,
70 [](int argc, char const* const* argv)77 [](int argc, char const* const* argv)
71 {78 {
72 if (argc)79 if (argc)
@@ -77,7 +84,8 @@
77 help_text << ' ' << *opt;84 help_text << ' ' << *opt;
78 BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str()));85 BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str()));
79 }86 }
80 })87 },
88 config_file)
81{89{
82}90}
8391
@@ -85,12 +93,43 @@
85 int argc,93 int argc,
86 char const* argv[],94 char const* argv[],
87 std::function<void(int argc, char const* const* argv)> const& handler) :95 std::function<void(int argc, char const* const* argv)> const& handler) :
96 DefaultConfiguration(argc, argv, handler, std::string{})
97{
98}
99
100namespace
101{
102std::string description_text(char const* program, std::string const& config_file)
103{
104 std::string result{
105 "Command-line options (e.g. \"--host-socket=/tmp/mir_socket\").\n\n"
106 "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\".\n"
107 "(E.g. \"MIR_SERVER_HOST_SOCKET=/tmp/mir_socket\")\n\n"};
108
109 if (program)
110 result = std::string{"usage: "} + program + " [options]\n\n" + result;
111
112 if (!config_file.empty())
113 result +=
114 "Config file entries are long form (e.g. \"host-socket=/tmp/mir_socket\").\n"
115 "The config file (" + config_file + ") is located via the XDG Base Directory Specification.\n"
116 "($XDG_CONFIG_HOME or $HOME/.config followed by $XDG_CONFIG_DIRS)\n\n";
117
118 return result + "user options";
119}
120}
121
122mo::DefaultConfiguration::DefaultConfiguration(
123 int argc,
124 char const* argv[],
125 std::function<void(int argc, char const* const* argv)> const& handler,
126 std::string const& config_file) :
127 config_file{config_file},
88 argc(argc),128 argc(argc),
89 argv(argv),129 argv(argv),
90 unparsed_arguments_handler{handler},130 unparsed_arguments_handler{handler},
91 program_options(std::make_shared<boost::program_options::options_description>(131 program_options(std::make_shared<boost::program_options::options_description>(
92 "Command-line options.\n"132 description_text(argv[0], config_file)))
93 "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\""))
94{133{
95 using namespace options;134 using namespace options;
96 namespace po = boost::program_options;135 namespace po = boost::program_options;
@@ -268,7 +307,9 @@
268}307}
269308
270void mo::DefaultConfiguration::parse_config_file(309void mo::DefaultConfiguration::parse_config_file(
271 boost::program_options::options_description& /*desc*/,310 boost::program_options::options_description& desc,
272 mo::ProgramOption& /*options*/) const311 mo::ProgramOption& options) const
273{312{
313 if (!config_file.empty())
314 options.parse_file(desc, config_file);
274}315}
275316
=== modified file 'src/server/server.cpp'
--- src/server/server.cpp 2015-05-19 21:34:34 +0000
+++ src/server/server.cpp 2015-06-02 09:07:30 +0000
@@ -224,36 +224,18 @@
224224
225namespace225namespace
226{226{
227class ConfigurationOptions : public mo::DefaultConfiguration
228{
229public:
230 using mo::DefaultConfiguration::DefaultConfiguration;
231
232 std::string config_file;
233
234 void parse_config_file(
235 boost::program_options::options_description& options_description,
236 mo::ProgramOption& options) const override
237 {
238 if (!config_file.empty())
239 options.parse_file(options_description, config_file);
240 }
241};
242
243std::shared_ptr<mo::DefaultConfiguration> configuration_options(227std::shared_ptr<mo::DefaultConfiguration> configuration_options(
244 int argc,228 int argc,
245 char const** argv,229 char const** argv,
246 std::function<void(int argc, char const* const* argv)> const& command_line_hander,230 std::function<void(int argc, char const* const* argv)> const& command_line_hander,
247 std::string const& config_file)231 std::string const& config_file)
248{232{
249 std::shared_ptr<ConfigurationOptions> result;233 std::shared_ptr<mo::DefaultConfiguration> result;
250234
251 if (command_line_hander)235 if (command_line_hander)
252 result = std::make_shared<ConfigurationOptions>(argc, argv, command_line_hander);236 result = std::make_shared<mo::DefaultConfiguration>(argc, argv, command_line_hander, config_file);
253 else237 else
254 result = std::make_shared<ConfigurationOptions>(argc, argv);238 result = std::make_shared<mo::DefaultConfiguration>(argc, argv, config_file);
255
256 result->config_file = config_file;
257239
258 return result;240 return result;
259}241}
260242
=== modified file 'tests/mir_test_framework/command_line_server_configuration.cpp'
--- tests/mir_test_framework/command_line_server_configuration.cpp 2015-05-20 14:00:02 +0000
+++ tests/mir_test_framework/command_line_server_configuration.cpp 2015-06-02 09:07:30 +0000
@@ -28,8 +28,9 @@
2828
29namespace29namespace
30{30{
31char const* args[] = {nullptr};
31int argc;32int argc;
32char const** argv;33char const** argv = args;
33}34}
3435
35auto mir_test_framework::configuration_from_commandline()36auto mir_test_framework::configuration_from_commandline()

Subscribers

People subscribed via source and target branches