Merge lp:~alan-griffiths/mir/helptext-mentions-config-file into lp:mir
- helptext-mentions-config-file
- Merge into development-branch
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 |
Related bugs: |
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
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2608
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
88+ "The config file (" + config_file + ") is located via the XDG Base Directory Specification.
Recommending $XDG_RUNTIME_DIR as the first place to look would be more helpful, but the changes lgtm overall.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2609
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
subprocess.
SETTING UP SUDO
[sudo] password for phablet: Sorry, try again.
[sudo] password for phablet:
sudo: 1 incorrect password attempt
CI infrastructure
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2610
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good from a functionality perspective.
A couple of formatting issues:
13+ DefaultConfigur
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+ DefaultConfigur
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+ DefaultConfigur
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).
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2611
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Alan Griffiths (alan-griffiths) wrote : | # |
[0;32m[ RUN ] [mGLMark2Test.
[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/
/tmp/buildd/
Value of: score
Expected: is >= 52
Actual: -1 (of type int)
[0;31m[ FAILED ] [mGLMark2Test.
[0;32m[----------] [m1 test from GLMark2Test (860 ms total)
Oh! We've still got ABI issues. :(
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
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 | 32 | { | 32 | { |
6 | 33 | public: | 33 | public: |
7 | 34 | DefaultConfiguration(int argc, char const* argv[]); | 34 | DefaultConfiguration(int argc, char const* argv[]); |
12 | 35 | DefaultConfiguration( | 35 | DefaultConfiguration(int argc, char const* argv[], std::string const& config_file); |
13 | 36 | int argc, | 36 | DefaultConfiguration( |
14 | 37 | char const* argv[], | 37 | int argc, char const* argv[], |
15 | 38 | std::function<void(int argc, char const* const* argv)> const& handler); | 38 | std::function <void(int argc, char const* const* argv)> const& handler); |
16 | 39 | DefaultConfiguration( | ||
17 | 40 | int argc, char const* argv[], | ||
18 | 41 | std::function <void(int argc, char const* const* argv)> const& handler, | ||
19 | 42 | std::string const& config_file); | ||
20 | 39 | virtual ~DefaultConfiguration() = default; | 43 | virtual ~DefaultConfiguration() = default; |
21 | 40 | 44 | ||
22 | 41 | // add_options() allows users to add their own options. This MUST be called | 45 | // add_options() allows users to add their own options. This MUST be called |
23 | @@ -47,6 +51,8 @@ | |||
24 | 47 | // call destructors in DSOs we've unloaded. | 51 | // call destructors in DSOs we've unloaded. |
25 | 48 | std::shared_ptr<SharedLibrary> platform_graphics_library; | 52 | std::shared_ptr<SharedLibrary> platform_graphics_library; |
26 | 49 | 53 | ||
27 | 54 | std::string const config_file; | ||
28 | 55 | |||
29 | 50 | void add_platform_options(); | 56 | void add_platform_options(); |
30 | 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" |
31 | 52 | std::shared_ptr<options::Option> the_options() const override; | 58 | std::shared_ptr<options::Option> the_options() const override; |
32 | 53 | 59 | ||
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 | 65 | } | 65 | } |
38 | 66 | 66 | ||
39 | 67 | mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) : | 67 | mo::DefaultConfiguration::DefaultConfiguration(int argc, char const* argv[]) : |
42 | 68 | DefaultConfiguration( | 68 | DefaultConfiguration(argc, argv, std::string{}) |
43 | 69 | argc, argv, | 69 | { |
44 | 70 | } | ||
45 | 71 | |||
46 | 72 | mo::DefaultConfiguration::DefaultConfiguration( | ||
47 | 73 | int argc, | ||
48 | 74 | char const* argv[], | ||
49 | 75 | std::string const& config_file) : | ||
50 | 76 | DefaultConfiguration(argc, argv, | ||
51 | 70 | [](int argc, char const* const* argv) | 77 | [](int argc, char const* const* argv) |
52 | 71 | { | 78 | { |
53 | 72 | if (argc) | 79 | if (argc) |
54 | @@ -77,7 +84,8 @@ | |||
55 | 77 | help_text << ' ' << *opt; | 84 | help_text << ' ' << *opt; |
56 | 78 | BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str())); | 85 | BOOST_THROW_EXCEPTION(mir::AbnormalExit(help_text.str())); |
57 | 79 | } | 86 | } |
59 | 80 | }) | 87 | }, |
60 | 88 | config_file) | ||
61 | 81 | { | 89 | { |
62 | 82 | } | 90 | } |
63 | 83 | 91 | ||
64 | @@ -85,12 +93,43 @@ | |||
65 | 85 | int argc, | 93 | int argc, |
66 | 86 | char const* argv[], | 94 | char const* argv[], |
67 | 87 | std::function<void(int argc, char const* const* argv)> const& handler) : | 95 | std::function<void(int argc, char const* const* argv)> const& handler) : |
68 | 96 | DefaultConfiguration(argc, argv, handler, std::string{}) | ||
69 | 97 | { | ||
70 | 98 | } | ||
71 | 99 | |||
72 | 100 | namespace | ||
73 | 101 | { | ||
74 | 102 | std::string description_text(char const* program, std::string const& config_file) | ||
75 | 103 | { | ||
76 | 104 | std::string result{ | ||
77 | 105 | "Command-line options (e.g. \"--host-socket=/tmp/mir_socket\").\n\n" | ||
78 | 106 | "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\".\n" | ||
79 | 107 | "(E.g. \"MIR_SERVER_HOST_SOCKET=/tmp/mir_socket\")\n\n"}; | ||
80 | 108 | |||
81 | 109 | if (program) | ||
82 | 110 | result = std::string{"usage: "} + program + " [options]\n\n" + result; | ||
83 | 111 | |||
84 | 112 | if (!config_file.empty()) | ||
85 | 113 | result += | ||
86 | 114 | "Config file entries are long form (e.g. \"host-socket=/tmp/mir_socket\").\n" | ||
87 | 115 | "The config file (" + config_file + ") is located via the XDG Base Directory Specification.\n" | ||
88 | 116 | "($XDG_CONFIG_HOME or $HOME/.config followed by $XDG_CONFIG_DIRS)\n\n"; | ||
89 | 117 | |||
90 | 118 | return result + "user options"; | ||
91 | 119 | } | ||
92 | 120 | } | ||
93 | 121 | |||
94 | 122 | mo::DefaultConfiguration::DefaultConfiguration( | ||
95 | 123 | int argc, | ||
96 | 124 | char const* argv[], | ||
97 | 125 | std::function<void(int argc, char const* const* argv)> const& handler, | ||
98 | 126 | std::string const& config_file) : | ||
99 | 127 | config_file{config_file}, | ||
100 | 88 | argc(argc), | 128 | argc(argc), |
101 | 89 | argv(argv), | 129 | argv(argv), |
102 | 90 | unparsed_arguments_handler{handler}, | 130 | unparsed_arguments_handler{handler}, |
103 | 91 | program_options(std::make_shared<boost::program_options::options_description>( | 131 | program_options(std::make_shared<boost::program_options::options_description>( |
106 | 92 | "Command-line options.\n" | 132 | description_text(argv[0], config_file))) |
105 | 93 | "Environment variables capitalise long form with prefix \"MIR_SERVER_\" and \"_\" in place of \"-\"")) | ||
107 | 94 | { | 133 | { |
108 | 95 | using namespace options; | 134 | using namespace options; |
109 | 96 | namespace po = boost::program_options; | 135 | namespace po = boost::program_options; |
110 | @@ -268,7 +307,9 @@ | |||
111 | 268 | } | 307 | } |
112 | 269 | 308 | ||
113 | 270 | void mo::DefaultConfiguration::parse_config_file( | 309 | void mo::DefaultConfiguration::parse_config_file( |
116 | 271 | boost::program_options::options_description& /*desc*/, | 310 | boost::program_options::options_description& desc, |
117 | 272 | mo::ProgramOption& /*options*/) const | 311 | mo::ProgramOption& options) const |
118 | 273 | { | 312 | { |
119 | 313 | if (!config_file.empty()) | ||
120 | 314 | options.parse_file(desc, config_file); | ||
121 | 274 | } | 315 | } |
122 | 275 | 316 | ||
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 | 224 | 224 | ||
128 | 225 | namespace | 225 | namespace |
129 | 226 | { | 226 | { |
130 | 227 | class ConfigurationOptions : public mo::DefaultConfiguration | ||
131 | 228 | { | ||
132 | 229 | public: | ||
133 | 230 | using mo::DefaultConfiguration::DefaultConfiguration; | ||
134 | 231 | |||
135 | 232 | std::string config_file; | ||
136 | 233 | |||
137 | 234 | void parse_config_file( | ||
138 | 235 | boost::program_options::options_description& options_description, | ||
139 | 236 | mo::ProgramOption& options) const override | ||
140 | 237 | { | ||
141 | 238 | if (!config_file.empty()) | ||
142 | 239 | options.parse_file(options_description, config_file); | ||
143 | 240 | } | ||
144 | 241 | }; | ||
145 | 242 | |||
146 | 243 | std::shared_ptr<mo::DefaultConfiguration> configuration_options( | 227 | std::shared_ptr<mo::DefaultConfiguration> configuration_options( |
147 | 244 | int argc, | 228 | int argc, |
148 | 245 | char const** argv, | 229 | char const** argv, |
149 | 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, |
150 | 247 | std::string const& config_file) | 231 | std::string const& config_file) |
151 | 248 | { | 232 | { |
153 | 249 | std::shared_ptr<ConfigurationOptions> result; | 233 | std::shared_ptr<mo::DefaultConfiguration> result; |
154 | 250 | 234 | ||
155 | 251 | if (command_line_hander) | 235 | if (command_line_hander) |
157 | 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); |
158 | 253 | else | 237 | else |
162 | 254 | result = std::make_shared<ConfigurationOptions>(argc, argv); | 238 | result = std::make_shared<mo::DefaultConfiguration>(argc, argv, config_file); |
160 | 255 | |||
161 | 256 | result->config_file = config_file; | ||
163 | 257 | 239 | ||
164 | 258 | return result; | 240 | return result; |
165 | 259 | } | 241 | } |
166 | 260 | 242 | ||
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 | 28 | 28 | ||
172 | 29 | namespace | 29 | namespace |
173 | 30 | { | 30 | { |
174 | 31 | char const* args[] = {nullptr}; | ||
175 | 31 | int argc; | 32 | int argc; |
177 | 32 | char const** argv; | 33 | char const** argv = args; |
178 | 33 | } | 34 | } |
179 | 34 | 35 | ||
180 | 35 | auto mir_test_framework::configuration_from_commandline() | 36 | auto mir_test_framework::configuration_from_commandline() |
FAILED: Continuous integration, rev:2606 jenkins. qa.ubuntu. com/job/ mir-ci/ 3931/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/2612 jenkins. qa.ubuntu. com/job/ mir-clang- wily-amd64- build/123/ console jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/2560/ console jenkins. qa.ubuntu. com/job/ mir-wily- amd64-ci/ 87/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 2560 jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 2560/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mir-mediumtests -runner- mako/5414/ console s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 20812
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/3931/ rebuild
http://