Merge lp:~marcustomlinson/unity-scopes-api/fix-clang-warnings into lp:unity-scopes-api/devel
- fix-clang-warnings
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Michi Henning |
Approved revision: | 648 |
Merged at revision: | 645 |
Proposed branch: | lp:~marcustomlinson/unity-scopes-api/fix-clang-warnings |
Merge into: | lp:unity-scopes-api/devel |
Diff against target: |
604 lines (+53/-84) 22 files modified
include/unity/scopes/internal/ScopeImpl.h (+1/-1) include/unity/scopes/internal/SettingsDB.h (+4/-14) src/scopes/internal/CannedQueryImpl.cpp (+1/-1) src/scopes/internal/Executor.cpp (+0/-2) src/scopes/internal/IniSettingsSchema.cpp (+2/-4) src/scopes/internal/OnlineAccountClientImpl.cpp (+1/-1) src/scopes/internal/PreviewReplyImpl.cpp (+1/-1) src/scopes/internal/PreviewReplyObject.cpp (+1/-1) src/scopes/internal/ReplyImpl.cpp (+1/-1) src/scopes/internal/RuntimeConfig.cpp (+5/-5) src/scopes/internal/RuntimeImpl.cpp (+3/-4) src/scopes/internal/SearchMetadataImpl.cpp (+2/-2) src/scopes/internal/SearchReplyImpl.cpp (+2/-2) src/scopes/internal/SettingsDB.cpp (+13/-22) src/scopes/internal/Utils.cpp (+1/-1) src/scopes/internal/smartscopes/SSRegistryObject.cpp (+1/-3) src/scopes/internal/smartscopes/SmartScope.cpp (+1/-1) src/scopes/internal/smartscopes/SmartScopesClient.cpp (+2/-2) src/scopes/internal/zmq_middleware/ZmqObject.cpp (+0/-2) test/gtest/scopes/StandAloneScope/SimpleScope.cpp (+0/-1) test/gtest/scopes/ThrowingClient/ThrowingClient_test.cpp (+1/-1) test/gtest/scopes/internal/SettingsDB/SettingsDB_test.cpp (+10/-12) |
To merge this branch: | bzr merge lp:~marcustomlinson/unity-scopes-api/fix-clang-warnings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michi Henning (community) | Approve | ||
Review via email: mp+278555@code.launchpad.net |
Commit message
Fixed Clang compiler warnings such as: missing "override" specifier, unused variables and functions, and other small bits of suspicious logic.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Michi Henning (michihenning) wrote : | # |
+1, thanks for that!
It's amazing how line 150 of the diff slipped through. My left arm for a language with a sane type system… :-(
Line 191 of the diff needs to read:
make_directorie
We want to create the directories for the entire path, not just the top-level dir.
Unfortunately, it appears that all of this is a lost labour of love now, at least on Wily. I just tried compiling with clang 3.6.2 on Wily. It came up with a bunch more warnings, which I started to fix. Unfortunately, our code no longer links due to unresolved references to symbols in libjson and libunity-api. It looks like the inlining algorithms for gcc and clang have gone out of sync. gcc inlines things that clang doesn't and then the clang-compiled client code looks for a external symbols in these libraries that don't exist :-(
Still, building with clang is still useful on Vivid (while it lasts).
I'me also attaching a diff that fixes a bunch more warnings from clang 3.6.0 on Vivid+overlay. Could you apply that diff too please?
It's awfully easy to miss warnings with ccache enabled because a warning is emitted only once when a file is first compiled. If the file has no errors, all future builds are warning-free because the object file is taken from the cache…
Michi Henning (michihenning) wrote : | # |
Hmmm... Looks like it's impossible to add an attachment to an MR. I've uploaded the diff here:
https:/
Michi Henning (michihenning) wrote : | # |
Actually, it's not inlining, it's the abi tags in gcc. See here: https:/
The name mangling differs between clang and gcc, so the symbols are in the library, but with a different mangled name :(
- 647. By Marcus Tomlinson
-
Applied patch with further warning fixes
- 648. By Marcus Tomlinson
-
make_directorie
s(cache_ dir_ -> make_directorie s(dir
Marcus Tomlinson (marcustomlinson) wrote : | # |
> +1, thanks for that!
>
> It's amazing how line 150 of the diff slipped through. My left arm for a
> language with a sane type system… :-(
>
> Line 191 of the diff needs to read:
>
> make_directorie
done (line 251)
>
> We want to create the directories for the entire path, not just the top-level
> dir.
>
> Unfortunately, it appears that all of this is a lost labour of love now, at
> least on Wily. I just tried compiling with clang 3.6.2 on Wily. It came up
> with a bunch more warnings, which I started to fix. Unfortunately, our code no
> longer links due to unresolved references to symbols in libjson and libunity-
> api. It looks like the inlining algorithms for gcc and clang have gone out of
> sync. gcc inlines things that clang doesn't and then the clang-compiled client
> code looks for a external symbols in these libraries that don't exist :-(
>
> Still, building with clang is still useful on Vivid (while it lasts).
>
> I'me also attaching a diff that fixes a bunch more warnings from clang 3.6.0
> on Vivid+overlay. Could you apply that diff too please?
done.
>
> It's awfully easy to miss warnings with ccache enabled because a warning is
> emitted only once when a file is first compiled. If the file has no errors,
> all future builds are warning-free because the object file is taken from the
> cache…
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:648
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michi Henning (michihenning) wrote : | # |
Looks good!
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:648
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'include/unity/scopes/internal/ScopeImpl.h' | |||
2 | --- include/unity/scopes/internal/ScopeImpl.h 2015-05-29 10:17:42 +0000 | |||
3 | +++ include/unity/scopes/internal/ScopeImpl.h 2015-11-26 05:49:23 +0000 | |||
4 | @@ -103,7 +103,7 @@ | |||
5 | 103 | virtual QueryCtrlProxy activate_result_action(Result const& result, | 103 | virtual QueryCtrlProxy activate_result_action(Result const& result, |
6 | 104 | ActionMetadata const& metadata, | 104 | ActionMetadata const& metadata, |
7 | 105 | std::string const& action_id, | 105 | std::string const& action_id, |
9 | 106 | ActivationListenerBase::SPtr const& reply); | 106 | ActivationListenerBase::SPtr const& reply) override; |
10 | 107 | 107 | ||
11 | 108 | virtual ChildScopeList child_scopes() override; | 108 | virtual ChildScopeList child_scopes() override; |
12 | 109 | virtual bool set_child_scopes(ChildScopeList const& child_scopes) override; | 109 | virtual bool set_child_scopes(ChildScopeList const& child_scopes) override; |
13 | 110 | 110 | ||
14 | === modified file 'include/unity/scopes/internal/SettingsDB.h' | |||
15 | --- include/unity/scopes/internal/SettingsDB.h 2015-07-13 14:28:15 +0000 | |||
16 | +++ include/unity/scopes/internal/SettingsDB.h 2015-11-26 05:49:23 +0000 | |||
17 | @@ -18,7 +18,6 @@ | |||
18 | 18 | 18 | ||
19 | 19 | #pragma once | 19 | #pragma once |
20 | 20 | 20 | ||
21 | 21 | #include <unity/scopes/internal/Logger.h> | ||
22 | 22 | #include <unity/scopes/internal/SettingsSchema.h> | 21 | #include <unity/scopes/internal/SettingsSchema.h> |
23 | 23 | #include <unity/scopes/Variant.h> | 22 | #include <unity/scopes/Variant.h> |
24 | 24 | #include <unity/util/DefinesPtrs.h> | 23 | #include <unity/util/DefinesPtrs.h> |
25 | @@ -47,15 +46,9 @@ | |||
26 | 47 | NONCOPYABLE(SettingsDB); | 46 | NONCOPYABLE(SettingsDB); |
27 | 48 | UNITY_DEFINES_PTRS(SettingsDB); | 47 | UNITY_DEFINES_PTRS(SettingsDB); |
28 | 49 | 48 | ||
38 | 50 | static UPtr create_from_ini_file(std::string const& db_path, | 49 | static UPtr create_from_ini_file(std::string const& db_path, std::string const& ini_file_path); |
39 | 51 | std::string const& ini_file_path, | 50 | static UPtr create_from_json_string(std::string const& db_path, std::string const& json_string); |
40 | 52 | boost::log::sources::severity_channel_logger_mt<>& logger); | 51 | static UPtr create_from_schema(std::string const& db_path, unity::scopes::internal::SettingsSchema const& schema); |
32 | 53 | static UPtr create_from_json_string(std::string const& db_path, | ||
33 | 54 | std::string const& json_string, | ||
34 | 55 | boost::log::sources::severity_channel_logger_mt<>& logger); | ||
35 | 56 | static UPtr create_from_schema(std::string const& db_path, | ||
36 | 57 | unity::scopes::internal::SettingsSchema const& schema, | ||
37 | 58 | boost::log::sources::severity_channel_logger_mt<>& logger); | ||
41 | 59 | 52 | ||
42 | 60 | ~SettingsDB() = default; | 53 | ~SettingsDB() = default; |
43 | 61 | 54 | ||
44 | @@ -65,9 +58,7 @@ | |||
45 | 65 | VariantMap settings(); // Returns the current settings (checking the DB each time). | 58 | VariantMap settings(); // Returns the current settings (checking the DB each time). |
46 | 66 | 59 | ||
47 | 67 | private: | 60 | private: |
51 | 68 | SettingsDB(std::string const& db_path, | 61 | SettingsDB(std::string const& db_path, unity::scopes::internal::SettingsSchema const& schema); |
49 | 69 | unity::scopes::internal::SettingsSchema const& schema, | ||
50 | 70 | boost::log::sources::severity_channel_logger_mt<>& logger); | ||
52 | 71 | 62 | ||
53 | 72 | void process_doc_(std::string const& id, unity::util::IniParser const& parer); | 63 | void process_doc_(std::string const& id, unity::util::IniParser const& parer); |
54 | 73 | void process_all_docs(); | 64 | void process_all_docs(); |
55 | @@ -80,7 +71,6 @@ | |||
56 | 80 | VariantArray definitions_; // Returned by SettingsSchema | 71 | VariantArray definitions_; // Returned by SettingsSchema |
57 | 81 | std::map<std::string, Variant> def_map_; // Allows fast access to the Variants in definitions_ | 72 | std::map<std::string, Variant> def_map_; // Allows fast access to the Variants in definitions_ |
58 | 82 | unity::scopes::VariantMap values_; | 73 | unity::scopes::VariantMap values_; |
59 | 83 | boost::log::sources::severity_channel_logger_mt<>& logger_; | ||
60 | 84 | }; | 74 | }; |
61 | 85 | 75 | ||
62 | 86 | } // namespace internal | 76 | } // namespace internal |
63 | 87 | 77 | ||
64 | === modified file 'src/scopes/internal/CannedQueryImpl.cpp' | |||
65 | --- src/scopes/internal/CannedQueryImpl.cpp 2015-02-26 12:47:37 +0000 | |||
66 | +++ src/scopes/internal/CannedQueryImpl.cpp 2015-11-26 05:49:23 +0000 | |||
67 | @@ -232,7 +232,7 @@ | |||
68 | 232 | { | 232 | { |
69 | 233 | return from_percent_encoding(value); | 233 | return from_percent_encoding(value); |
70 | 234 | } | 234 | } |
72 | 235 | catch (InvalidArgumentException const& e) | 235 | catch (InvalidArgumentException const&) |
73 | 236 | { | 236 | { |
74 | 237 | std::stringstream err; | 237 | std::stringstream err; |
75 | 238 | err << "Failed to decode key '" << key_name << "' of uri '" << uri << "'"; | 238 | err << "Failed to decode key '" << key_name << "' of uri '" << uri << "'"; |
76 | 239 | 239 | ||
77 | === modified file 'src/scopes/internal/Executor.cpp' | |||
78 | --- src/scopes/internal/Executor.cpp 2014-08-08 08:35:09 +0000 | |||
79 | +++ src/scopes/internal/Executor.cpp 2015-11-26 05:49:23 +0000 | |||
80 | @@ -49,10 +49,8 @@ | |||
81 | 49 | case ENOENT: | 49 | case ENOENT: |
82 | 50 | case EACCES: | 50 | case EACCES: |
83 | 51 | throw std::runtime_error("AppArmor profile does not exist"); | 51 | throw std::runtime_error("AppArmor profile does not exist"); |
84 | 52 | break; | ||
85 | 53 | case EINVAL: | 52 | case EINVAL: |
86 | 54 | throw std::runtime_error("AppArmor interface not available"); | 53 | throw std::runtime_error("AppArmor interface not available"); |
87 | 55 | break; | ||
88 | 56 | default: | 54 | default: |
89 | 57 | throw std::runtime_error("Unknown AppArmor error"); | 55 | throw std::runtime_error("Unknown AppArmor error"); |
90 | 58 | } | 56 | } |
91 | 59 | 57 | ||
92 | === modified file 'src/scopes/internal/IniSettingsSchema.cpp' | |||
93 | --- src/scopes/internal/IniSettingsSchema.cpp 2015-03-02 03:59:01 +0000 | |||
94 | +++ src/scopes/internal/IniSettingsSchema.cpp 2015-11-26 05:49:23 +0000 | |||
95 | @@ -56,8 +56,6 @@ | |||
96 | 56 | Variant const& default_value); | 56 | Variant const& default_value); |
97 | 57 | ~Setting() = default; | 57 | ~Setting() = default; |
98 | 58 | 58 | ||
99 | 59 | string id() const; | ||
100 | 60 | |||
101 | 61 | enum Type { BooleanT, ListT, NumberT, StringT }; | 59 | enum Type { BooleanT, ListT, NumberT, StringT }; |
102 | 62 | 60 | ||
103 | 63 | Variant to_schema_definition(); | 61 | Variant to_schema_definition(); |
104 | @@ -240,7 +238,7 @@ | |||
105 | 240 | } | 238 | } |
106 | 241 | } | 239 | } |
107 | 242 | } | 240 | } |
109 | 243 | catch (LogicException const& e) | 241 | catch (LogicException const&) |
110 | 244 | { | 242 | { |
111 | 245 | throw ResourceException(string("IniSettingsSchema(): invalid value type for \"") + dflt_val_key + "\" definition, " | 243 | throw ResourceException(string("IniSettingsSchema(): invalid value type for \"") + dflt_val_key + "\" definition, " |
112 | 246 | "setting = \"" + id_ + "\""); | 244 | "setting = \"" + id_ + "\""); |
113 | @@ -276,7 +274,7 @@ | |||
114 | 276 | definitions_.push_back(s.to_schema_definition()); | 274 | definitions_.push_back(s.to_schema_definition()); |
115 | 277 | } | 275 | } |
116 | 278 | } | 276 | } |
118 | 279 | catch (std::exception const& e) | 277 | catch (std::exception const&) |
119 | 280 | { | 278 | { |
120 | 281 | throw ResourceException("IniSettingsSchema(): cannot parse settings file \"" + ini_file + "\""); | 279 | throw ResourceException("IniSettingsSchema(): cannot parse settings file \"" + ini_file + "\""); |
121 | 282 | } | 280 | } |
122 | 283 | 281 | ||
123 | === modified file 'src/scopes/internal/OnlineAccountClientImpl.cpp' | |||
124 | --- src/scopes/internal/OnlineAccountClientImpl.cpp 2015-01-26 06:02:10 +0000 | |||
125 | +++ src/scopes/internal/OnlineAccountClientImpl.cpp 2015-11-26 05:49:23 +0000 | |||
126 | @@ -653,7 +653,7 @@ | |||
127 | 653 | g_main_loop_run(main_loop_.get()); | 653 | g_main_loop_run(main_loop_.get()); |
128 | 654 | } | 654 | } |
129 | 655 | // LCOV_EXCL_START | 655 | // LCOV_EXCL_START |
131 | 656 | catch (std::exception const& e) | 656 | catch (std::exception const&) |
132 | 657 | { | 657 | { |
133 | 658 | std::lock_guard<std::mutex> lock(mutex_); | 658 | std::lock_guard<std::mutex> lock(mutex_); |
134 | 659 | thread_exception_ = std::current_exception(); | 659 | thread_exception_ = std::current_exception(); |
135 | 660 | 660 | ||
136 | === modified file 'src/scopes/internal/PreviewReplyImpl.cpp' | |||
137 | --- src/scopes/internal/PreviewReplyImpl.cpp 2015-01-09 03:16:51 +0000 | |||
138 | +++ src/scopes/internal/PreviewReplyImpl.cpp 2015-11-26 05:49:23 +0000 | |||
139 | @@ -52,7 +52,7 @@ | |||
140 | 52 | { | 52 | { |
141 | 53 | ColumnLayoutImpl::validate_layouts(layouts); | 53 | ColumnLayoutImpl::validate_layouts(layouts); |
142 | 54 | } | 54 | } |
144 | 55 | catch (unity::LogicException const &e) | 55 | catch (unity::LogicException const&) |
145 | 56 | { | 56 | { |
146 | 57 | throw unity::LogicException("PreviewReplyImpl::register_layout(): Failed to validate layouts"); | 57 | throw unity::LogicException("PreviewReplyImpl::register_layout(): Failed to validate layouts"); |
147 | 58 | } | 58 | } |
148 | 59 | 59 | ||
149 | === modified file 'src/scopes/internal/PreviewReplyObject.cpp' | |||
150 | --- src/scopes/internal/PreviewReplyObject.cpp 2014-11-18 07:04:04 +0000 | |||
151 | +++ src/scopes/internal/PreviewReplyObject.cpp 2015-11-26 05:49:23 +0000 | |||
152 | @@ -67,7 +67,7 @@ | |||
153 | 67 | { | 67 | { |
154 | 68 | ColumnLayoutImpl::validate_layouts(list); | 68 | ColumnLayoutImpl::validate_layouts(list); |
155 | 69 | } | 69 | } |
157 | 70 | catch (unity::LogicException const &e) | 70 | catch (unity::LogicException const&) |
158 | 71 | { | 71 | { |
159 | 72 | throw unity::LogicException("PreviewReplyObject::process_data(): Failed to validate layouts"); | 72 | throw unity::LogicException("PreviewReplyObject::process_data(): Failed to validate layouts"); |
160 | 73 | } | 73 | } |
161 | 74 | 74 | ||
162 | === modified file 'src/scopes/internal/ReplyImpl.cpp' | |||
163 | --- src/scopes/internal/ReplyImpl.cpp 2015-02-04 06:07:15 +0000 | |||
164 | +++ src/scopes/internal/ReplyImpl.cpp 2015-11-26 05:49:23 +0000 | |||
165 | @@ -127,7 +127,7 @@ | |||
166 | 127 | { | 127 | { |
167 | 128 | fwd()->finished(CompletionDetails(CompletionDetails::Error, error_message)); // Oneway, can't block | 128 | fwd()->finished(CompletionDetails(CompletionDetails::Error, error_message)); // Oneway, can't block |
168 | 129 | } | 129 | } |
170 | 130 | catch (std::exception const& e) | 130 | catch (std::exception const&) |
171 | 131 | { | 131 | { |
172 | 132 | BOOST_LOG(mw_proxy_->mw_base()->runtime()->logger()) | 132 | BOOST_LOG(mw_proxy_->mw_base()->runtime()->logger()) |
173 | 133 | << "ReplyImpl::error(): exception from finished(): " << error_message; | 133 | << "ReplyImpl::error(): exception from finished(): " << error_message; |
174 | 134 | 134 | ||
175 | === modified file 'src/scopes/internal/RuntimeConfig.cpp' | |||
176 | --- src/scopes/internal/RuntimeConfig.cpp 2015-06-11 07:17:56 +0000 | |||
177 | +++ src/scopes/internal/RuntimeConfig.cpp 2015-11-26 05:49:23 +0000 | |||
178 | @@ -108,7 +108,7 @@ | |||
179 | 108 | { | 108 | { |
180 | 109 | cache_directory_ = default_cache_directory(); | 109 | cache_directory_ = default_cache_directory(); |
181 | 110 | } | 110 | } |
183 | 111 | catch (ResourceException const& e) | 111 | catch (ResourceException const&) |
184 | 112 | { | 112 | { |
185 | 113 | throw_ex("No " + cache_dir_key + " configured and failed to get default"); | 113 | throw_ex("No " + cache_dir_key + " configured and failed to get default"); |
186 | 114 | } | 114 | } |
187 | @@ -121,7 +121,7 @@ | |||
188 | 121 | { | 121 | { |
189 | 122 | app_directory_ = default_app_directory(); | 122 | app_directory_ = default_app_directory(); |
190 | 123 | } | 123 | } |
192 | 124 | catch (ResourceException const& e) | 124 | catch (ResourceException const&) |
193 | 125 | { | 125 | { |
194 | 126 | throw_ex("No " + app_dir_key + " configured and failed to get default"); | 126 | throw_ex("No " + app_dir_key + " configured and failed to get default"); |
195 | 127 | } | 127 | } |
196 | @@ -129,7 +129,7 @@ | |||
197 | 129 | 129 | ||
198 | 130 | // UNITY_SCOPES_CONFIG_DIR env var can be used to override the value of ConfigDir key of Runtime.ini | 130 | // UNITY_SCOPES_CONFIG_DIR env var can be used to override the value of ConfigDir key of Runtime.ini |
199 | 131 | char const* scopes_cfg_dir_override = getenv("UNITY_SCOPES_CONFIG_DIR"); | 131 | char const* scopes_cfg_dir_override = getenv("UNITY_SCOPES_CONFIG_DIR"); |
201 | 132 | config_directory_ = (scopes_cfg_dir_override != nullptr && scopes_cfg_dir_override != '\0') ? | 132 | config_directory_ = (scopes_cfg_dir_override != nullptr && *scopes_cfg_dir_override != '\0') ? |
202 | 133 | string(scopes_cfg_dir_override) : get_optional_string(runtime_config_group, config_dir_key); | 133 | string(scopes_cfg_dir_override) : get_optional_string(runtime_config_group, config_dir_key); |
203 | 134 | if (config_directory_.empty()) | 134 | if (config_directory_.empty()) |
204 | 135 | { | 135 | { |
205 | @@ -137,7 +137,7 @@ | |||
206 | 137 | { | 137 | { |
207 | 138 | config_directory_ = default_config_directory(); | 138 | config_directory_ = default_config_directory(); |
208 | 139 | } | 139 | } |
210 | 140 | catch (ResourceException const& e) | 140 | catch (ResourceException const&) |
211 | 141 | { | 141 | { |
212 | 142 | throw_ex("No " + config_dir_key + " configured and failed to get default"); | 142 | throw_ex("No " + config_dir_key + " configured and failed to get default"); |
213 | 143 | } | 143 | } |
214 | @@ -155,7 +155,7 @@ | |||
215 | 155 | { | 155 | { |
216 | 156 | log_directory_ = default_log_directory(); | 156 | log_directory_ = default_log_directory(); |
217 | 157 | } | 157 | } |
219 | 158 | catch (ResourceException const& e) | 158 | catch (ResourceException const&) |
220 | 159 | { | 159 | { |
221 | 160 | throw_ex("No " + log_dir_key + " configured and failed to get default"); | 160 | throw_ex("No " + log_dir_key + " configured and failed to get default"); |
222 | 161 | } | 161 | } |
223 | 162 | 162 | ||
224 | === modified file 'src/scopes/internal/RuntimeImpl.cpp' | |||
225 | --- src/scopes/internal/RuntimeImpl.cpp 2015-11-23 07:29:31 +0000 | |||
226 | +++ src/scopes/internal/RuntimeImpl.cpp 2015-11-26 05:49:23 +0000 | |||
227 | @@ -136,7 +136,7 @@ | |||
228 | 136 | app_dir_ = config.app_directory(); | 136 | app_dir_ = config.app_directory(); |
229 | 137 | config_dir_ = config.config_directory(); | 137 | config_dir_ = config.config_directory(); |
230 | 138 | } | 138 | } |
232 | 139 | catch (unity::Exception const& e) | 139 | catch (unity::Exception const&) |
233 | 140 | { | 140 | { |
234 | 141 | destroy(); | 141 | destroy(); |
235 | 142 | string msg = "Cannot instantiate run time for " + (scope_id.empty() ? "client" : scope_id) + | 142 | string msg = "Cannot instantiate run time for " + (scope_id.empty() ? "client" : scope_id) + |
236 | @@ -382,7 +382,7 @@ | |||
237 | 382 | boost::system::error_code ec; | 382 | boost::system::error_code ec; |
238 | 383 | if (boost::filesystem::exists(settings_schema, ec)) | 383 | if (boost::filesystem::exists(settings_schema, ec)) |
239 | 384 | { | 384 | { |
241 | 385 | shared_ptr<SettingsDB> db(SettingsDB::create_from_ini_file(settings_db, settings_schema, logger())); | 385 | shared_ptr<SettingsDB> db(SettingsDB::create_from_ini_file(settings_db, settings_schema)); |
242 | 386 | scope_base->p->set_settings_db(db); | 386 | scope_base->p->set_settings_db(db); |
243 | 387 | } | 387 | } |
244 | 388 | else | 388 | else |
245 | @@ -594,8 +594,7 @@ | |||
246 | 594 | string dir = cache_dir_ + "/" + confinement_type(); | 594 | string dir = cache_dir_ + "/" + confinement_type(); |
247 | 595 | if (!confined()) // Avoid apparmor noise | 595 | if (!confined()) // Avoid apparmor noise |
248 | 596 | { | 596 | { |
251 | 597 | string dir = cache_dir_ + "/" + confinement_type(); | 597 | make_directories(dir, 0700); |
250 | 598 | make_directories(cache_dir_, 0700); | ||
252 | 599 | } | 598 | } |
253 | 600 | // A confined scope is allowed to create this dir. | 599 | // A confined scope is allowed to create this dir. |
254 | 601 | dir += "/" + demangled_id(scope_id_); | 600 | dir += "/" + demangled_id(scope_id_); |
255 | 602 | 601 | ||
256 | === modified file 'src/scopes/internal/SearchMetadataImpl.cpp' | |||
257 | --- src/scopes/internal/SearchMetadataImpl.cpp 2015-04-09 15:59:17 +0000 | |||
258 | +++ src/scopes/internal/SearchMetadataImpl.cpp 2015-11-26 05:49:23 +0000 | |||
259 | @@ -56,7 +56,7 @@ | |||
260 | 56 | it = find_or_throw("SearchMetadataImpl()", var, "location"); | 56 | it = find_or_throw("SearchMetadataImpl()", var, "location"); |
261 | 57 | location_ = Location(it->second.get_dict()); | 57 | location_ = Location(it->second.get_dict()); |
262 | 58 | } | 58 | } |
264 | 59 | catch (std::exception &e) | 59 | catch (std::exception const&) |
265 | 60 | { | 60 | { |
266 | 61 | } | 61 | } |
267 | 62 | 62 | ||
268 | @@ -71,7 +71,7 @@ | |||
269 | 71 | } | 71 | } |
270 | 72 | aggregated_keywords_ = keywords_s; | 72 | aggregated_keywords_ = keywords_s; |
271 | 73 | } | 73 | } |
273 | 74 | catch (std::exception &e) | 74 | catch (std::exception const&) |
274 | 75 | { | 75 | { |
275 | 76 | } | 76 | } |
276 | 77 | } | 77 | } |
277 | 78 | 78 | ||
278 | === modified file 'src/scopes/internal/SearchReplyImpl.cpp' | |||
279 | --- src/scopes/internal/SearchReplyImpl.cpp 2015-07-27 10:45:03 +0000 | |||
280 | +++ src/scopes/internal/SearchReplyImpl.cpp 2015-11-26 05:49:23 +0000 | |||
281 | @@ -72,7 +72,7 @@ | |||
282 | 72 | { | 72 | { |
283 | 73 | DepartmentImpl::validate_departments(parent, current_department_); | 73 | DepartmentImpl::validate_departments(parent, current_department_); |
284 | 74 | } | 74 | } |
286 | 75 | catch (unity::LogicException const &e) | 75 | catch (unity::LogicException const&) |
287 | 76 | { | 76 | { |
288 | 77 | throw unity::LogicException("SearchReplyImpl::register_departments(): Failed to validate departments"); | 77 | throw unity::LogicException("SearchReplyImpl::register_departments(): Failed to validate departments"); |
289 | 78 | } | 78 | } |
290 | @@ -172,7 +172,7 @@ | |||
291 | 172 | { | 172 | { |
292 | 173 | internal::FilterBaseImpl::validate_filters(filters); | 173 | internal::FilterBaseImpl::validate_filters(filters); |
293 | 174 | } | 174 | } |
295 | 175 | catch (unity::LogicException const &e) | 175 | catch (unity::LogicException const&) |
296 | 176 | { | 176 | { |
297 | 177 | throw unity::LogicException("SearchReplyImpl::push(): Failed to validate filters"); | 177 | throw unity::LogicException("SearchReplyImpl::push(): Failed to validate filters"); |
298 | 178 | } | 178 | } |
299 | 179 | 179 | ||
300 | === modified file 'src/scopes/internal/SettingsDB.cpp' | |||
301 | --- src/scopes/internal/SettingsDB.cpp 2015-07-13 14:28:15 +0000 | |||
302 | +++ src/scopes/internal/SettingsDB.cpp 2015-11-26 05:49:23 +0000 | |||
303 | @@ -82,53 +82,44 @@ | |||
304 | 82 | 82 | ||
305 | 83 | } // namespace | 83 | } // namespace |
306 | 84 | 84 | ||
310 | 85 | SettingsDB::UPtr SettingsDB::create_from_ini_file(string const& db_path, | 85 | SettingsDB::UPtr SettingsDB::create_from_ini_file(string const& db_path, string const& ini_file_path) |
308 | 86 | string const& ini_file_path, | ||
309 | 87 | boost::log::sources::severity_channel_logger_mt<>& logger) | ||
311 | 88 | { | 86 | { |
312 | 89 | // Parse schema | 87 | // Parse schema |
313 | 90 | try | 88 | try |
314 | 91 | { | 89 | { |
315 | 92 | SettingsSchema::UPtr schema = IniSettingsSchema::create(ini_file_path); | 90 | SettingsSchema::UPtr schema = IniSettingsSchema::create(ini_file_path); |
317 | 93 | return create_from_schema(db_path, *schema, logger); | 91 | return create_from_schema(db_path, *schema); |
318 | 94 | } | 92 | } |
320 | 95 | catch (exception const& e) | 93 | catch (exception const&) |
321 | 96 | { | 94 | { |
322 | 97 | throw ResourceException("SettingsDB::create_from_ini_file(): schema = " + ini_file_path + ", db = " + db_path); | 95 | throw ResourceException("SettingsDB::create_from_ini_file(): schema = " + ini_file_path + ", db = " + db_path); |
323 | 98 | } | 96 | } |
324 | 99 | } | 97 | } |
325 | 100 | 98 | ||
329 | 101 | SettingsDB::UPtr SettingsDB::create_from_json_string(string const& db_path, | 99 | SettingsDB::UPtr SettingsDB::create_from_json_string(string const& db_path, string const& json_string) |
327 | 102 | string const& json_string, | ||
328 | 103 | boost::log::sources::severity_channel_logger_mt<>& logger) | ||
330 | 104 | { | 100 | { |
331 | 105 | // Parse schema | 101 | // Parse schema |
332 | 106 | try | 102 | try |
333 | 107 | { | 103 | { |
334 | 108 | auto schema = JsonSettingsSchema::create(json_string); | 104 | auto schema = JsonSettingsSchema::create(json_string); |
336 | 109 | return create_from_schema(db_path, *schema, logger); | 105 | return create_from_schema(db_path, *schema); |
337 | 110 | } | 106 | } |
339 | 111 | catch (exception const& e) | 107 | catch (exception const&) |
340 | 112 | { | 108 | { |
341 | 113 | throw ResourceException("SettingsDB::create_from_json_string(): cannot parse schema, db = " + db_path); | 109 | throw ResourceException("SettingsDB::create_from_json_string(): cannot parse schema, db = " + db_path); |
342 | 114 | } | 110 | } |
343 | 115 | } | 111 | } |
344 | 116 | 112 | ||
348 | 117 | SettingsDB::UPtr SettingsDB::create_from_schema(string const& db_path, | 113 | SettingsDB::UPtr SettingsDB::create_from_schema(string const& db_path, SettingsSchema const& schema) |
346 | 118 | SettingsSchema const& schema, | ||
347 | 119 | boost::log::sources::severity_channel_logger_mt<>& logger) | ||
349 | 120 | { | 114 | { |
351 | 121 | return UPtr(new SettingsDB(db_path, move(schema), logger)); | 115 | return UPtr(new SettingsDB(db_path, move(schema))); |
352 | 122 | } | 116 | } |
353 | 123 | 117 | ||
357 | 124 | SettingsDB::SettingsDB(string const& db_path, | 118 | SettingsDB::SettingsDB(string const& db_path, SettingsSchema const& schema) |
355 | 125 | SettingsSchema const& schema, | ||
356 | 126 | boost::log::sources::severity_channel_logger_mt<>& logger) | ||
358 | 127 | : db_path_(db_path) | 119 | : db_path_(db_path) |
359 | 128 | , last_write_time_nsec_(-1) | 120 | , last_write_time_nsec_(-1) |
360 | 129 | , last_write_time_sec_(-1) | 121 | , last_write_time_sec_(-1) |
361 | 130 | , last_write_inode_(0) | 122 | , last_write_inode_(0) |
362 | 131 | , logger_(logger) | ||
363 | 132 | { | 123 | { |
364 | 133 | // Initialize the def_map_ so we can look things | 124 | // Initialize the def_map_ so we can look things |
365 | 134 | // up quickly. | 125 | // up quickly. |
366 | @@ -173,7 +164,7 @@ | |||
367 | 173 | { | 164 | { |
368 | 174 | values_[id] = Variant(stod(value)); | 165 | values_[id] = Variant(stod(value)); |
369 | 175 | } | 166 | } |
371 | 176 | catch (invalid_argument & e) | 167 | catch (invalid_argument const&) |
372 | 177 | { | 168 | { |
373 | 178 | } | 169 | } |
374 | 179 | } | 170 | } |
375 | @@ -182,7 +173,7 @@ | |||
376 | 182 | values_[id] = Variant(p.get_string(GROUP_NAME, id)); | 173 | values_[id] = Variant(p.get_string(GROUP_NAME, id)); |
377 | 183 | } | 174 | } |
378 | 184 | } | 175 | } |
380 | 185 | catch (LogicException & e) | 176 | catch (LogicException const&) |
381 | 186 | { | 177 | { |
382 | 187 | } | 178 | } |
383 | 188 | } | 179 | } |
384 | @@ -222,7 +213,7 @@ | |||
385 | 222 | { | 213 | { |
386 | 223 | if (e.error() == EACCES) // very unlikely; only if permissions changed after we acquired the lock | 214 | if (e.error() == EACCES) // very unlikely; only if permissions changed after we acquired the lock |
387 | 224 | { | 215 | { |
389 | 225 | throw e; | 216 | throw; |
390 | 226 | } | 217 | } |
391 | 227 | throw ResourceException(e.what()); | 218 | throw ResourceException(e.what()); |
392 | 228 | } | 219 | } |
393 | @@ -244,7 +235,7 @@ | |||
394 | 244 | { | 235 | { |
395 | 245 | if (e.error() == EACCES) | 236 | if (e.error() == EACCES) |
396 | 246 | { | 237 | { |
398 | 247 | throw e; | 238 | throw; |
399 | 248 | } | 239 | } |
400 | 249 | 240 | ||
401 | 250 | // Failure in obtaining the lock shouldn't be reported to the scope, it's not fatal; | 241 | // Failure in obtaining the lock shouldn't be reported to the scope, it's not fatal; |
402 | 251 | 242 | ||
403 | === modified file 'src/scopes/internal/Utils.cpp' | |||
404 | --- src/scopes/internal/Utils.cpp 2015-09-15 07:36:09 +0000 | |||
405 | +++ src/scopes/internal/Utils.cpp 2015-11-26 05:49:23 +0000 | |||
406 | @@ -90,7 +90,7 @@ | |||
407 | 90 | result << static_cast<char>(k); | 90 | result << static_cast<char>(k); |
408 | 91 | valid = true; | 91 | valid = true; |
409 | 92 | } | 92 | } |
411 | 93 | catch (logic_error const& e) // covers both invalid_argument and out_of_range | 93 | catch (logic_error const&) // covers both invalid_argument and out_of_range |
412 | 94 | { | 94 | { |
413 | 95 | stringstream err; | 95 | stringstream err; |
414 | 96 | err << "from_percent_encoding(): unsupported conversion of '" << hexnum << "'"; | 96 | err << "from_percent_encoding(): unsupported conversion of '" << hexnum << "'"; |
415 | 97 | 97 | ||
416 | === modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp' | |||
417 | --- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2015-01-20 08:25:39 +0000 | |||
418 | +++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2015-11-26 05:49:23 +0000 | |||
419 | @@ -324,9 +324,7 @@ | |||
420 | 324 | // Store both JSON (for internal comparison) and DB (for external use) | 324 | // Store both JSON (for internal comparison) and DB (for external use) |
421 | 325 | changed = true; | 325 | changed = true; |
422 | 326 | std::string settings_db = RuntimeConfig::default_config_directory() + "/" + scope.id + "/settings.ini"; | 326 | std::string settings_db = RuntimeConfig::default_config_directory() + "/" + scope.id + "/settings.ini"; |
426 | 327 | SettingsDB::SPtr db(SettingsDB::create_from_schema(settings_db, | 327 | SettingsDB::SPtr db(SettingsDB::create_from_schema(settings_db, *schema)); |
424 | 328 | *schema, | ||
425 | 329 | middleware_->runtime()->logger())); | ||
427 | 330 | settings_defs_[scope.id] = SSSettingsDef{settings, db, needs_location_data}; | 328 | settings_defs_[scope.id] = SSSettingsDef{settings, db, needs_location_data}; |
428 | 331 | } | 329 | } |
429 | 332 | } | 330 | } |
430 | 333 | 331 | ||
431 | === modified file 'src/scopes/internal/smartscopes/SmartScope.cpp' | |||
432 | --- src/scopes/internal/smartscopes/SmartScope.cpp 2015-06-01 10:23:00 +0000 | |||
433 | +++ src/scopes/internal/smartscopes/SmartScope.cpp 2015-11-26 05:49:23 +0000 | |||
434 | @@ -117,7 +117,7 @@ | |||
435 | 117 | { | 117 | { |
436 | 118 | reply->register_category(category->id, category->title, category->icon, rdr); | 118 | reply->register_category(category->id, category->title, category->icon, rdr); |
437 | 119 | } | 119 | } |
439 | 120 | catch (std::exception const& e) | 120 | catch (std::exception const&) |
440 | 121 | { | 121 | { |
441 | 122 | BOOST_LOG(this->ss_client_->logger()) | 122 | BOOST_LOG(this->ss_client_->logger()) |
442 | 123 | << "SmartScope: failed to register category: \"" << category->id | 123 | << "SmartScope: failed to register category: \"" << category->id |
443 | 124 | 124 | ||
444 | === modified file 'src/scopes/internal/smartscopes/SmartScopesClient.cpp' | |||
445 | --- src/scopes/internal/smartscopes/SmartScopesClient.cpp 2015-11-02 05:24:35 +0000 | |||
446 | +++ src/scopes/internal/smartscopes/SmartScopesClient.cpp 2015-11-26 05:49:23 +0000 | |||
447 | @@ -339,7 +339,7 @@ | |||
448 | 339 | { | 339 | { |
449 | 340 | scope.keywords.emplace(keyword.get_string()); | 340 | scope.keywords.emplace(keyword.get_string()); |
450 | 341 | } | 341 | } |
452 | 342 | catch (unity::LogicException const& e) | 342 | catch (unity::LogicException const&) |
453 | 343 | { | 343 | { |
454 | 344 | BOOST_LOG(logger_) | 344 | BOOST_LOG(logger_) |
455 | 345 | << "SmartScopesClient.get_remote_scopes(): Scope: \"" << scope.id | 345 | << "SmartScopesClient.get_remote_scopes(): Scope: \"" << scope.id |
456 | @@ -854,7 +854,7 @@ | |||
457 | 854 | query_result->wait(); | 854 | query_result->wait(); |
458 | 855 | query_result->get(); // may throw on error | 855 | query_result->get(); // may throw on error |
459 | 856 | } | 856 | } |
461 | 857 | catch (std::exception const& e) | 857 | catch (std::exception const&) |
462 | 858 | { | 858 | { |
463 | 859 | BOOST_LOG(logger_) | 859 | BOOST_LOG(logger_) |
464 | 860 | << "SmartScopesClient.get_preview_results(): Failed to retrieve preview results for query " | 860 | << "SmartScopesClient.get_preview_results(): Failed to retrieve preview results for query " |
465 | 861 | 861 | ||
466 | === modified file 'src/scopes/internal/zmq_middleware/ZmqObject.cpp' | |||
467 | --- src/scopes/internal/zmq_middleware/ZmqObject.cpp 2015-09-08 02:58:39 +0000 | |||
468 | +++ src/scopes/internal/zmq_middleware/ZmqObject.cpp 2015-11-26 05:49:23 +0000 | |||
469 | @@ -50,8 +50,6 @@ | |||
470 | 50 | std::mutex shared_mutex; | 50 | std::mutex shared_mutex; |
471 | 51 | } | 51 | } |
472 | 52 | 52 | ||
473 | 53 | #define MONITOR_ENDPOINT "ipc:///tmp/scopes-monitor" | ||
474 | 54 | |||
475 | 55 | ZmqObjectProxy::ZmqObjectProxy(ZmqMiddleware* mw_base, | 53 | ZmqObjectProxy::ZmqObjectProxy(ZmqMiddleware* mw_base, |
476 | 56 | string const& endpoint, | 54 | string const& endpoint, |
477 | 57 | string const& identity, | 55 | string const& identity, |
478 | 58 | 56 | ||
479 | === modified file 'test/gtest/scopes/StandAloneScope/SimpleScope.cpp' | |||
480 | --- test/gtest/scopes/StandAloneScope/SimpleScope.cpp 2015-08-05 05:14:14 +0000 | |||
481 | +++ test/gtest/scopes/StandAloneScope/SimpleScope.cpp 2015-11-26 05:49:23 +0000 | |||
482 | @@ -77,7 +77,6 @@ | |||
483 | 77 | PreviewQueryBase::UPtr EchoScope::preview(Result const& /* result */, ActionMetadata const& /* metadata */) | 77 | PreviewQueryBase::UPtr EchoScope::preview(Result const& /* result */, ActionMetadata const& /* metadata */) |
484 | 78 | { | 78 | { |
485 | 79 | abort(); | 79 | abort(); |
486 | 80 | return nullptr; | ||
487 | 81 | } | 80 | } |
488 | 82 | 81 | ||
489 | 83 | extern "C" | 82 | extern "C" |
490 | 84 | 83 | ||
491 | === modified file 'test/gtest/scopes/ThrowingClient/ThrowingClient_test.cpp' | |||
492 | --- test/gtest/scopes/ThrowingClient/ThrowingClient_test.cpp 2015-02-06 06:33:23 +0000 | |||
493 | +++ test/gtest/scopes/ThrowingClient/ThrowingClient_test.cpp 2015-11-26 05:49:23 +0000 | |||
494 | @@ -100,7 +100,7 @@ | |||
495 | 100 | } | 100 | } |
496 | 101 | } | 101 | } |
497 | 102 | 102 | ||
499 | 103 | virtual void info(OperationInfo const& /* op_info */) | 103 | virtual void info(OperationInfo const& /* op_info */) override |
500 | 104 | { | 104 | { |
501 | 105 | lock_guard<mutex> lock(mutex_); | 105 | lock_guard<mutex> lock(mutex_); |
502 | 106 | 106 | ||
503 | 107 | 107 | ||
504 | === modified file 'test/gtest/scopes/internal/SettingsDB/SettingsDB_test.cpp' | |||
505 | --- test/gtest/scopes/internal/SettingsDB/SettingsDB_test.cpp 2015-09-09 04:50:11 +0000 | |||
506 | +++ test/gtest/scopes/internal/SettingsDB/SettingsDB_test.cpp 2015-11-26 05:49:23 +0000 | |||
507 | @@ -81,15 +81,13 @@ | |||
508 | 81 | ::close(fd); | 81 | ::close(fd); |
509 | 82 | } | 82 | } |
510 | 83 | 83 | ||
511 | 84 | BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(test_logger, boost::log::sources::severity_channel_logger_mt<>) | ||
512 | 85 | |||
513 | 86 | TEST(SettingsDB, basic) | 84 | TEST(SettingsDB, basic) |
514 | 87 | { | 85 | { |
515 | 88 | auto schema = TEST_SRC_DIR "/schema.ini"; | 86 | auto schema = TEST_SRC_DIR "/schema.ini"; |
516 | 89 | 87 | ||
517 | 90 | { | 88 | { |
518 | 91 | unlink(db_name.c_str()); | 89 | unlink(db_name.c_str()); |
520 | 92 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 90 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
521 | 93 | 91 | ||
522 | 94 | // If db doesn't exist, default values are returned. | 92 | // If db doesn't exist, default values are returned. |
523 | 95 | EXPECT_EQ(4, db->settings().size()); | 93 | EXPECT_EQ(4, db->settings().size()); |
524 | @@ -165,7 +163,7 @@ | |||
525 | 165 | 163 | ||
526 | 166 | // This schema does not specify a default value for location and unit. | 164 | // This schema does not specify a default value for location and unit. |
527 | 167 | auto schema = TEST_SRC_DIR "/no_default_schema.ini"; | 165 | auto schema = TEST_SRC_DIR "/no_default_schema.ini"; |
529 | 168 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 166 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
530 | 169 | 167 | ||
531 | 170 | // Check that we now can see only the other two values. (DB doesn't exist yet.) | 168 | // Check that we now can see only the other two values. (DB doesn't exist yet.) |
532 | 171 | EXPECT_EQ(2, db->settings().size()); | 169 | EXPECT_EQ(2, db->settings().size()); |
533 | @@ -188,7 +186,7 @@ | |||
534 | 188 | 186 | ||
535 | 189 | // This schema does not specify a default value for location and unit. | 187 | // This schema does not specify a default value for location and unit. |
536 | 190 | auto schema = TEST_SRC_DIR "/no_default_schema.ini"; | 188 | auto schema = TEST_SRC_DIR "/no_default_schema.ini"; |
538 | 191 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 189 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
539 | 192 | 190 | ||
540 | 193 | // Add records to supply the values. | 191 | // Add records to supply the values. |
541 | 194 | write_db("db_loctemp.ini"); | 192 | write_db("db_loctemp.ini"); |
542 | @@ -218,7 +216,7 @@ | |||
543 | 218 | 216 | ||
544 | 219 | { | 217 | { |
545 | 220 | unlink(db_name.c_str()); | 218 | unlink(db_name.c_str()); |
547 | 221 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 219 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
548 | 222 | 220 | ||
549 | 223 | // If db doesn't exist, default values are returned. | 221 | // If db doesn't exist, default values are returned. |
550 | 224 | EXPECT_EQ(1, db->settings().size()); | 222 | EXPECT_EQ(1, db->settings().size()); |
551 | @@ -237,7 +235,7 @@ | |||
552 | 237 | 235 | ||
553 | 238 | { | 236 | { |
554 | 239 | unlink(db_name.c_str()); | 237 | unlink(db_name.c_str()); |
556 | 240 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 238 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
557 | 241 | 239 | ||
558 | 242 | // If db doesn't exist, default values are returned. | 240 | // If db doesn't exist, default values are returned. |
559 | 243 | EXPECT_EQ(4, db->settings().size()); | 241 | EXPECT_EQ(4, db->settings().size()); |
560 | @@ -288,7 +286,7 @@ | |||
561 | 288 | 286 | ||
562 | 289 | { | 287 | { |
563 | 290 | unlink(db_name.c_str()); | 288 | unlink(db_name.c_str()); |
565 | 291 | auto db = SettingsDB::create_from_json_string(db_name, ok_schema, test_logger::get()); | 289 | auto db = SettingsDB::create_from_json_string(db_name, ok_schema); |
566 | 292 | 290 | ||
567 | 293 | // If db doesn't exist, default values are returned. | 291 | // If db doesn't exist, default values are returned. |
568 | 294 | EXPECT_EQ(1, db->settings().size()); | 292 | EXPECT_EQ(1, db->settings().size()); |
569 | @@ -305,7 +303,7 @@ | |||
570 | 305 | { | 303 | { |
571 | 306 | try | 304 | try |
572 | 307 | { | 305 | { |
574 | 308 | auto db = SettingsDB::create_from_ini_file("unused", "no_such_file", test_logger::get()); | 306 | auto db = SettingsDB::create_from_ini_file("unused", "no_such_file"); |
575 | 309 | FAIL(); | 307 | FAIL(); |
576 | 310 | } | 308 | } |
577 | 311 | catch (ResourceException const& e) | 309 | catch (ResourceException const& e) |
578 | @@ -318,7 +316,7 @@ | |||
579 | 318 | 316 | ||
580 | 319 | try | 317 | try |
581 | 320 | { | 318 | { |
583 | 321 | auto db = SettingsDB::create_from_json_string("unused", "syntax error", test_logger::get()); | 319 | auto db = SettingsDB::create_from_json_string("unused", "syntax error"); |
584 | 322 | FAIL(); | 320 | FAIL(); |
585 | 323 | } | 321 | } |
586 | 324 | catch (ResourceException const& e) | 322 | catch (ResourceException const& e) |
587 | @@ -334,7 +332,7 @@ | |||
588 | 334 | // Open DB that doesn't exist yet. | 332 | // Open DB that doesn't exist yet. |
589 | 335 | unlink(db_name.c_str()); | 333 | unlink(db_name.c_str()); |
590 | 336 | auto schema = TEST_SRC_DIR "/schema.ini"; | 334 | auto schema = TEST_SRC_DIR "/schema.ini"; |
592 | 337 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 335 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
593 | 338 | 336 | ||
594 | 339 | // Add a record, which creates the DB | 337 | // Add a record, which creates the DB |
595 | 340 | write_db("db_location.ini"); | 338 | write_db("db_location.ini"); |
596 | @@ -363,7 +361,7 @@ | |||
597 | 363 | write_db("db_location_munich.ini"); | 361 | write_db("db_location_munich.ini"); |
598 | 364 | 362 | ||
599 | 365 | auto schema = TEST_SRC_DIR "/schema.ini"; | 363 | auto schema = TEST_SRC_DIR "/schema.ini"; |
601 | 366 | auto db = SettingsDB::create_from_ini_file(db_name, schema, test_logger::get()); | 364 | auto db = SettingsDB::create_from_ini_file(db_name, schema); |
602 | 367 | 365 | ||
603 | 368 | EXPECT_EQ(4, db->settings().size()); | 366 | EXPECT_EQ(4, db->settings().size()); |
604 | 369 | EXPECT_EQ("Munich", db->settings()["locationSetting"].get_string()); | 367 | EXPECT_EQ("Munich", db->settings()["locationSetting"].get_string()); |
PASSED: Continuous integration, rev:646 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- ci/1583/ jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- vivid-amd64- ci/192 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- vivid-armhf- ci/192 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- vivid-armhf- ci/192/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- vivid-i386- ci/192 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- xenial- amd64-ci/ 15 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- xenial- armhf-ci/ 15 jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- xenial- armhf-ci/ 15/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-scopes- api-devel- xenial- i386-ci/ 15
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- scopes- api-devel- ci/1583/ rebuild
http://