Merge lp:~marcustomlinson/unity-scopes-api/lp-1272147 into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Superseded
Proposed branch: lp:~marcustomlinson/unity-scopes-api/lp-1272147
Merge into: lp:unity-scopes-api/devel
Diff against target: 112 lines (+32/-10)
4 files modified
include/unity/scopes/internal/smartscopes/SSRegistryObject.h (+2/-1)
src/scopes/internal/smartscopes/SSRegistryObject.cpp (+4/-2)
test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp (+7/-5)
valgrind-suppress (+19/-2)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/lp-1272147
Reviewer Review Type Date Requested Status
Michi Henning Pending
Review via email: mp+204463@code.launchpad.net

Description of the change

Added valgrind suppressions to ignore false positives for memory leaks in Qt.
Fixed possible deadlock in smartscopesproxy_test.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/unity/scopes/internal/smartscopes/SSRegistryObject.h'
2--- include/unity/scopes/internal/smartscopes/SSRegistryObject.h 2014-01-30 05:45:52 +0000
3+++ include/unity/scopes/internal/smartscopes/SSRegistryObject.h 2014-02-03 11:42:22 +0000
4@@ -43,7 +43,8 @@
5 UNITY_DEFINES_PTRS(SSRegistryObject);
6
7 SSRegistryObject(MiddlewareBase::SPtr middleware, std::string const& ss_scope_endpoint,
8- uint max_http_sessions, uint no_reply_timeout, uint refresh_rate_in_min);
9+ uint max_http_sessions, uint no_reply_timeout, uint refresh_rate_in_min,
10+ std::string const& sss_url = "" /*detect url*/, uint sss_port = 80);
11 virtual ~SSRegistryObject() noexcept;
12
13 ScopeMetadata get_metadata(std::string const& scope_name) override;
14
15=== modified file 'src/scopes/internal/smartscopes/SSRegistryObject.cpp'
16--- src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-01-30 06:07:44 +0000
17+++ src/scopes/internal/smartscopes/SSRegistryObject.cpp 2014-02-03 11:42:22 +0000
18@@ -42,10 +42,12 @@
19 std::string const& ss_scope_endpoint,
20 uint max_http_sessions,
21 uint no_reply_timeout,
22- uint refresh_rate_in_min)
23+ uint refresh_rate_in_min,
24+ std::string const& sss_url,
25+ uint sss_port)
26 : ssclient_(std::make_shared<SmartScopesClient>(
27 std::make_shared<HttpClientQt>(max_http_sessions, no_reply_timeout),
28- std::make_shared<JsonCppNode>()))
29+ std::make_shared<JsonCppNode>(), sss_url, sss_port))
30 , refresh_stopped_(false)
31 , middleware_(middleware)
32 , ss_scope_endpoint_(ss_scope_endpoint)
33
34=== modified file 'test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp'
35--- test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-01-30 09:56:21 +0000
36+++ test/gtest/scopes/internal/smartscopes/smartscopesproxy/smartscopesproxy_test.cpp 2014-02-03 11:42:22 +0000
37@@ -52,9 +52,6 @@
38 , reg_id_("SSRegistry")
39 , scope_id_("SmartScope")
40 {
41- std::string server_env = "SMART_SCOPES_SERVER=http://127.0.0.1:" + std::to_string(server_.port_);
42- ::putenv((char*)server_env.c_str());
43-
44 // Instantiate SS registry and scopes runtimes
45 reg_rt_ = RuntimeImpl::create(reg_id_, SS_RUNTIME_PATH);
46 scope_rt_ = RuntimeImpl::create(scope_id_, SS_RUNTIME_PATH);
47@@ -69,7 +66,8 @@
48 scope_mw_ = scope_rt_->factory()->create(scope_id_, mw_kind, mw_configfile);
49
50 // Instantiate a SS registry and scope objects
51- reg_ = SSRegistryObject::SPtr(new SSRegistryObject(reg_mw_, scope_mw_->get_scope_endpoint(), 2, 2000, 60));
52+ reg_ = SSRegistryObject::SPtr(new SSRegistryObject(reg_mw_, scope_mw_->get_scope_endpoint(), 2, 2000, 60,
53+ "http://127.0.0.1", server_.port_));
54 scope_ = SSScopeObject::UPtr(new SSScopeObject(scope_id_, scope_mw_, reg_));
55
56 // Add objects to the middlewares
57@@ -199,8 +197,12 @@
58 auto reply = std::make_shared<Receiver>();
59
60 ScopeMetadata meta = reg_->get_metadata("Dummy Demo Scope");
61+
62+ auto wait_thread = std::thread([&reply](){reply->wait_until_finished();});
63+
64 meta.proxy()->create_query("search_string", VariantMap(), reply);
65- reply->wait_until_finished();
66+
67+ wait_thread.join();
68 }
69
70 } // namespace
71
72=== modified file 'valgrind-suppress'
73--- valgrind-suppress 2014-01-27 11:31:02 +0000
74+++ valgrind-suppress 2014-02-03 11:42:22 +0000
75@@ -76,7 +76,7 @@
76 # False positives for memory leaks in Qt
77
78 {
79- QNetworkConfigurationManagerInit
80+ QNetworkConfigurationManager
81 Memcheck:Leak
82 fun:*alloc
83 ...
84@@ -85,10 +85,27 @@
85 }
86
87 {
88- QCoreApplicationNotifyRealloc
89+ QCoreApplication
90 Memcheck:Leak
91 fun:realloc
92 ...
93 fun:_ZN7QObject5eventEP6QEvent
94 fun:_ZN16QCoreApplication6notifyEP7QObjectP6QEvent
95 }
96+
97+{
98+ QNetworkAccessManager
99+ Memcheck:Leak
100+ ...
101+ fun:_ZN21QNetworkAccessManager13createRequestENS_9OperationERK15QNetworkRequestP9QIODevice
102+ fun:_ZN21QNetworkAccessManager3getERK15QNetworkRequest
103+ fun:_ZN18HttpClientQtThread3runEv
104+}
105+
106+{
107+ QFactoryLoader
108+ Memcheck:Leak
109+ fun:*alloc
110+ ...
111+ fun:_ZNK14QFactoryLoader8instanceEi
112+}

Subscribers

People subscribed via source and target branches

to all changes: