Merge lp:~michihenning/storage-framework/valgrind-fixes into lp:storage-framework/devel

Proposed by Michi Henning
Status: Merged
Approved by: Michi Henning
Approved revision: 104
Merged at revision: 103
Proposed branch: lp:~michihenning/storage-framework/valgrind-fixes
Merge into: lp:storage-framework/devel
Diff against target: 97 lines (+31/-6)
5 files modified
tests/provider-AccountData/AccountData_test.cpp (+7/-1)
tests/provider-ProviderInterface/ProviderInterface_test.cpp (+7/-1)
tests/remote-client-v1/remote-client-v1_test.cpp (+7/-1)
tests/remote-client/remote-client_test.cpp (+9/-3)
tests/utils/ProviderFixture.cpp (+1/-0)
To merge this branch: bzr merge lp:~michihenning/storage-framework/valgrind-fixes
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Approve
James Henstridge Approve
Review via email: mp+313587@code.launchpad.net

Commit message

Fixed memory leak in remote_client-test and ProviderFixture.
Process pending events at end of tests to avoid bogus leak reports from valgrind.

Description of the change

Fixed memory leak in remote_client-test and ProviderFixture.
Process pending events at end of tests to avoid bogus leak reports from valgrind.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:101
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/232/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1284
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1291
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1072/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1072/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1072/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1072/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1072/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1072
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1072/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/232/rebuild

review: Approve (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:102
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/233/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1285
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1292
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1073/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1073/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1073/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1073/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1073/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1073
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1073/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/233/rebuild

review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good, although it'd be good to work out why we can't do this from TearDown() rather than main(). That can come later though.

review: Approve
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-autoland/79/
Executed test runs:

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:104
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/235/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1358
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1365
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1143/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1143/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1143/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1143/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1143/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1143
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1143/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/235/rebuild

review: Approve (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:101
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/236/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1360
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1367
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1145/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1145/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1145/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1145/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1145/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1145
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1145/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/236/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/provider-AccountData/AccountData_test.cpp'
2--- tests/provider-AccountData/AccountData_test.cpp 2016-12-20 02:31:23 +0000
3+++ tests/provider-AccountData/AccountData_test.cpp 2017-01-12 06:03:31 +0000
4@@ -175,5 +175,11 @@
5 {
6 QCoreApplication app(argc, argv);
7 ::testing::InitGoogleTest(&argc, argv);
8- return RUN_ALL_TESTS();
9+ int rc = RUN_ALL_TESTS();
10+
11+ // Process any pending events to avoid bogus leak reports from valgrind.
12+ QCoreApplication::sendPostedEvents();
13+ QCoreApplication::processEvents();
14+
15+ return rc;
16 }
17
18=== modified file 'tests/provider-ProviderInterface/ProviderInterface_test.cpp'
19--- tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-11-03 02:43:43 +0000
20+++ tests/provider-ProviderInterface/ProviderInterface_test.cpp 2017-01-12 06:03:31 +0000
21@@ -788,5 +788,11 @@
22 qDBusRegisterMetaType<unity::storage::internal::ItemMetadata>();
23 qDBusRegisterMetaType<QList<unity::storage::internal::ItemMetadata>>();
24 ::testing::InitGoogleTest(&argc, argv);
25- return RUN_ALL_TESTS();
26+ int rc = RUN_ALL_TESTS();
27+
28+ // Process any pending events to avoid bogus leak reports from valgrind.
29+ QCoreApplication::sendPostedEvents();
30+ QCoreApplication::processEvents();
31+
32+ return rc;
33 }
34
35=== modified file 'tests/remote-client-v1/remote-client-v1_test.cpp'
36--- tests/remote-client-v1/remote-client-v1_test.cpp 2016-11-15 05:48:12 +0000
37+++ tests/remote-client-v1/remote-client-v1_test.cpp 2017-01-12 06:03:31 +0000
38@@ -1142,5 +1142,11 @@
39 QCoreApplication app(argc, argv);
40
41 ::testing::InitGoogleTest(&argc, argv);
42- return RUN_ALL_TESTS();
43+ int rc = RUN_ALL_TESTS();
44+
45+ // Process any pending events to avoid bogus leak reports from valgrind.
46+ QCoreApplication::sendPostedEvents();
47+ QCoreApplication::processEvents();
48+
49+ return rc;
50 }
51
52=== modified file 'tests/remote-client/remote-client_test.cpp'
53--- tests/remote-client/remote-client_test.cpp 2016-11-28 11:04:17 +0000
54+++ tests/remote-client/remote-client_test.cpp 2017-01-12 06:03:31 +0000
55@@ -376,7 +376,7 @@
56
57 EXPECT_EQ(StorageError::Type::NoError, runtime_->shutdown().type()); // Destroy runtime.
58
59- AccountsJob* j = runtime_->accounts();
60+ unique_ptr<AccountsJob> j(runtime_->accounts());
61 EXPECT_FALSE(j->isValid());
62 EXPECT_EQ(AccountsJob::Status::Error, j->status());
63 EXPECT_EQ(StorageError::Type::RuntimeDestroyed, j->error().type());
64@@ -384,7 +384,7 @@
65 EXPECT_EQ(QList<Account>(), j->accounts());
66
67 // Signal must be received.
68- QSignalSpy spy(j, &AccountsJob::statusChanged);
69+ QSignalSpy spy(j.get(), &AccountsJob::statusChanged);
70 spy.wait(SIGNAL_WAIT_TIME);
71 ASSERT_EQ(1, spy.count());
72 auto arg = spy.takeFirst();
73@@ -3801,5 +3801,11 @@
74 QCoreApplication app(argc, argv);
75
76 ::testing::InitGoogleTest(&argc, argv);
77- return RUN_ALL_TESTS();
78+ int rc = RUN_ALL_TESTS();
79+
80+ // Process any pending events to avoid bogus leak reports from valgrind.
81+ QCoreApplication::sendPostedEvents();
82+ QCoreApplication::processEvents();
83+
84+ return rc;
85 }
86
87=== modified file 'tests/utils/ProviderFixture.cpp'
88--- tests/utils/ProviderFixture.cpp 2016-09-26 02:37:03 +0000
89+++ tests/utils/ProviderFixture.cpp 2017-01-12 06:03:31 +0000
90@@ -46,6 +46,7 @@
91 void ProviderFixture::TearDown()
92 {
93 test_server_.reset();
94+ account_manager_.reset();
95 service_connection_.reset();
96 QDBusConnection::disconnectFromBus(SERVICE_CONNECTION_NAME);
97 dbus_.reset();

Subscribers

People subscribed via source and target branches

to all changes: