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
=== modified file 'tests/provider-AccountData/AccountData_test.cpp'
--- tests/provider-AccountData/AccountData_test.cpp 2016-12-20 02:31:23 +0000
+++ tests/provider-AccountData/AccountData_test.cpp 2017-01-12 06:03:31 +0000
@@ -175,5 +175,11 @@
175{175{
176 QCoreApplication app(argc, argv);176 QCoreApplication app(argc, argv);
177 ::testing::InitGoogleTest(&argc, argv);177 ::testing::InitGoogleTest(&argc, argv);
178 return RUN_ALL_TESTS();178 int rc = RUN_ALL_TESTS();
179
180 // Process any pending events to avoid bogus leak reports from valgrind.
181 QCoreApplication::sendPostedEvents();
182 QCoreApplication::processEvents();
183
184 return rc;
179}185}
180186
=== modified file 'tests/provider-ProviderInterface/ProviderInterface_test.cpp'
--- tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-11-03 02:43:43 +0000
+++ tests/provider-ProviderInterface/ProviderInterface_test.cpp 2017-01-12 06:03:31 +0000
@@ -788,5 +788,11 @@
788 qDBusRegisterMetaType<unity::storage::internal::ItemMetadata>();788 qDBusRegisterMetaType<unity::storage::internal::ItemMetadata>();
789 qDBusRegisterMetaType<QList<unity::storage::internal::ItemMetadata>>();789 qDBusRegisterMetaType<QList<unity::storage::internal::ItemMetadata>>();
790 ::testing::InitGoogleTest(&argc, argv);790 ::testing::InitGoogleTest(&argc, argv);
791 return RUN_ALL_TESTS();791 int rc = RUN_ALL_TESTS();
792
793 // Process any pending events to avoid bogus leak reports from valgrind.
794 QCoreApplication::sendPostedEvents();
795 QCoreApplication::processEvents();
796
797 return rc;
792}798}
793799
=== modified file 'tests/remote-client-v1/remote-client-v1_test.cpp'
--- tests/remote-client-v1/remote-client-v1_test.cpp 2016-11-15 05:48:12 +0000
+++ tests/remote-client-v1/remote-client-v1_test.cpp 2017-01-12 06:03:31 +0000
@@ -1142,5 +1142,11 @@
1142 QCoreApplication app(argc, argv);1142 QCoreApplication app(argc, argv);
11431143
1144 ::testing::InitGoogleTest(&argc, argv);1144 ::testing::InitGoogleTest(&argc, argv);
1145 return RUN_ALL_TESTS();1145 int rc = RUN_ALL_TESTS();
1146
1147 // Process any pending events to avoid bogus leak reports from valgrind.
1148 QCoreApplication::sendPostedEvents();
1149 QCoreApplication::processEvents();
1150
1151 return rc;
1146}1152}
11471153
=== modified file 'tests/remote-client/remote-client_test.cpp'
--- tests/remote-client/remote-client_test.cpp 2016-11-28 11:04:17 +0000
+++ tests/remote-client/remote-client_test.cpp 2017-01-12 06:03:31 +0000
@@ -376,7 +376,7 @@
376376
377 EXPECT_EQ(StorageError::Type::NoError, runtime_->shutdown().type()); // Destroy runtime.377 EXPECT_EQ(StorageError::Type::NoError, runtime_->shutdown().type()); // Destroy runtime.
378378
379 AccountsJob* j = runtime_->accounts();379 unique_ptr<AccountsJob> j(runtime_->accounts());
380 EXPECT_FALSE(j->isValid());380 EXPECT_FALSE(j->isValid());
381 EXPECT_EQ(AccountsJob::Status::Error, j->status());381 EXPECT_EQ(AccountsJob::Status::Error, j->status());
382 EXPECT_EQ(StorageError::Type::RuntimeDestroyed, j->error().type());382 EXPECT_EQ(StorageError::Type::RuntimeDestroyed, j->error().type());
@@ -384,7 +384,7 @@
384 EXPECT_EQ(QList<Account>(), j->accounts());384 EXPECT_EQ(QList<Account>(), j->accounts());
385385
386 // Signal must be received.386 // Signal must be received.
387 QSignalSpy spy(j, &AccountsJob::statusChanged);387 QSignalSpy spy(j.get(), &AccountsJob::statusChanged);
388 spy.wait(SIGNAL_WAIT_TIME);388 spy.wait(SIGNAL_WAIT_TIME);
389 ASSERT_EQ(1, spy.count());389 ASSERT_EQ(1, spy.count());
390 auto arg = spy.takeFirst();390 auto arg = spy.takeFirst();
@@ -3801,5 +3801,11 @@
3801 QCoreApplication app(argc, argv);3801 QCoreApplication app(argc, argv);
38023802
3803 ::testing::InitGoogleTest(&argc, argv);3803 ::testing::InitGoogleTest(&argc, argv);
3804 return RUN_ALL_TESTS();3804 int rc = RUN_ALL_TESTS();
3805
3806 // Process any pending events to avoid bogus leak reports from valgrind.
3807 QCoreApplication::sendPostedEvents();
3808 QCoreApplication::processEvents();
3809
3810 return rc;
3805}3811}
38063812
=== modified file 'tests/utils/ProviderFixture.cpp'
--- tests/utils/ProviderFixture.cpp 2016-09-26 02:37:03 +0000
+++ tests/utils/ProviderFixture.cpp 2017-01-12 06:03:31 +0000
@@ -46,6 +46,7 @@
46void ProviderFixture::TearDown()46void ProviderFixture::TearDown()
47{47{
48 test_server_.reset();48 test_server_.reset();
49 account_manager_.reset();
49 service_connection_.reset();50 service_connection_.reset();
50 QDBusConnection::disconnectFromBus(SERVICE_CONNECTION_NAME);51 QDBusConnection::disconnectFromBus(SERVICE_CONNECTION_NAME);
51 dbus_.reset();52 dbus_.reset();

Subscribers

People subscribed via source and target branches

to all changes: