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
1=== modified file 'src/include/platform/mir/options/default_configuration.h'
2--- src/include/platform/mir/options/default_configuration.h 2015-03-31 02:35:42 +0000
3+++ src/include/platform/mir/options/default_configuration.h 2015-06-02 09:07:30 +0000
4@@ -32,10 +32,14 @@
5 {
6 public:
7 DefaultConfiguration(int argc, char const* argv[]);
8- DefaultConfiguration(
9- int argc,
10- char const* argv[],
11- std::function<void(int argc, char const* const* argv)> const& handler);
12+ DefaultConfiguration(int argc, char const* argv[], std::string const& config_file);
13+ DefaultConfiguration(
14+ int argc, char const* argv[],
15+ std::function <void(int argc, char const* const* argv)> const& handler);
16+ DefaultConfiguration(
17+ int argc, char const* argv[],
18+ std::function <void(int argc, char const* const* argv)> const& handler,
19+ std::string const& config_file);
20 virtual ~DefaultConfiguration() = default;
21
22 // add_options() allows users to add their own options. This MUST be called
23@@ -47,6 +51,8 @@
24 // call destructors in DSOs we've unloaded.
25 std::shared_ptr<SharedLibrary> platform_graphics_library;
26
27+ std::string const config_file;
28+
29 void add_platform_options();
30 // accessed via the base interface, when access to add_options() has been "lost"
31 std::shared_ptr<options::Option> the_options() const override;
32
33=== modified file 'src/platform/options/default_configuration.cpp'
34--- src/platform/options/default_configuration.cpp 2015-05-19 21:34:34 +0000
35+++ src/platform/options/default_configuration.cpp 2015-06-02 09:07:30 +0000
36@@ -65,8 +65,15 @@
37 }
38
39 mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) :
40- DefaultConfiguration(
41- argc, argv,
42+ DefaultConfiguration(argc, argv, std::string{})
43+{
44+}
45+
46+mo::DefaultConfiguration::DefaultConfiguration(
47+ int argc,
48+ char const* argv[],
49+ std::string const& config_file) :
50+ DefaultConfiguration(argc, argv,
51 [](int argc, char const* const* argv)
52 {
53 if (argc)
54@@ -77,7 +84,8 @@
55 help_text << ' ' << *opt;
56 BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str()));
57 }
58- })
59+ },
60+ config_file)
61 {
62 }
63
64@@ -85,12 +93,43 @@
65 int argc,
66 char const* argv[],
67 std::function<void(int argc, char const* const* argv)> const& handler) :
68+ DefaultConfiguration(argc, argv, handler, std::string{})
69+{
70+}
71+
72+namespace
73+{
74+std::string description_text(char const* program, std::string const& config_file)
75+{
76+ std::string result{
77+ "Command-line options (e.g. \"--host-socket=/tmp/mir_socket\").\n\n"
78+ "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\".\n"
79+ "(E.g. \"MIR_SERVER_HOST_SOCKET=/tmp/mir_socket\")\n\n"};
80+
81+ if (program)
82+ result = std::string{"usage: "} + program + " [options]\n\n" + result;
83+
84+ if (!config_file.empty())
85+ result +=
86+ "Config file entries are long form (e.g. \"host-socket=/tmp/mir_socket\").\n"
87+ "The config file (" + config_file + ") is located via the XDG Base Directory Specification.\n"
88+ "($XDG_CONFIG_HOME or $HOME/.config followed by $XDG_CONFIG_DIRS)\n\n";
89+
90+ return result + "user options";
91+}
92+}
93+
94+mo::DefaultConfiguration::DefaultConfiguration(
95+ int argc,
96+ char const* argv[],
97+ std::function<void(int argc, char const* const* argv)> const& handler,
98+ std::string const& config_file) :
99+ config_file{config_file},
100 argc(argc),
101 argv(argv),
102 unparsed_arguments_handler{handler},
103 program_options(std::make_shared<boost::program_options::options_description>(
104- "Command-line options.\n"
105- "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\""))
106+ description_text(argv[0], config_file)))
107 {
108 using namespace options;
109 namespace po = boost::program_options;
110@@ -268,7 +307,9 @@
111 }
112
113 void mo::DefaultConfiguration::parse_config_file(
114- boost::program_options::options_description& /*desc*/,
115- mo::ProgramOption& /*options*/) const
116+ boost::program_options::options_description& desc,
117+ mo::ProgramOption& options) const
118 {
119+ if (!config_file.empty())
120+ options.parse_file(desc, config_file);
121 }
122
123=== modified file 'src/server/server.cpp'
124--- src/server/server.cpp 2015-05-19 21:34:34 +0000
125+++ src/server/server.cpp 2015-06-02 09:07:30 +0000
126@@ -224,36 +224,18 @@
127
128 namespace
129 {
130-class ConfigurationOptions : public mo::DefaultConfiguration
131-{
132-public:
133- using mo::DefaultConfiguration::DefaultConfiguration;
134-
135- std::string config_file;
136-
137- void parse_config_file(
138- boost::program_options::options_description& options_description,
139- mo::ProgramOption& options) const override
140- {
141- if (!config_file.empty())
142- options.parse_file(options_description, config_file);
143- }
144-};
145-
146 std::shared_ptr<mo::DefaultConfiguration> configuration_options(
147 int argc,
148 char const** argv,
149 std::function<void(int argc, char const* const* argv)> const& command_line_hander,
150 std::string const& config_file)
151 {
152- std::shared_ptr<ConfigurationOptions> result;
153+ std::shared_ptr<mo::DefaultConfiguration> result;
154
155 if (command_line_hander)
156- result = std::make_shared<ConfigurationOptions>(argc, argv, command_line_hander);
157+ result = std::make_shared<mo::DefaultConfiguration>(argc, argv, command_line_hander, config_file);
158 else
159- result = std::make_shared<ConfigurationOptions>(argc, argv);
160-
161- result->config_file = config_file;
162+ result = std::make_shared<mo::DefaultConfiguration>(argc, argv, config_file);
163
164 return result;
165 }
166
167=== modified file 'tests/mir_test_framework/command_line_server_configuration.cpp'
168--- tests/mir_test_framework/command_line_server_configuration.cpp 2015-05-20 14:00:02 +0000
169+++ tests/mir_test_framework/command_line_server_configuration.cpp 2015-06-02 09:07:30 +0000
170@@ -28,8 +28,9 @@
171
172 namespace
173 {
174+char const* args[] = {nullptr};
175 int argc;
176-char const** argv;
177+char const** argv = args;
178 }
179
180 auto mir_test_framework::configuration_from_commandline()

Subscribers

People subscribed via source and target branches