Merge lp:~mardy/online-accounts-api/test-leaks-1617180 into lp:online-accounts-api

Proposed by Alberto Mardegan
Status: Merged
Approved by: Michi Henning
Approved revision: 44
Merged at revision: 43
Proposed branch: lp:~mardy/online-accounts-api/test-leaks-1617180
Merge into: lp:online-accounts-api
Diff against target: 53 lines (+18/-0)
2 files modified
tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp (+9/-0)
tests/lib/qml_module/tst_qml_module.cpp (+9/-0)
To merge this branch: bzr merge lp:~mardy/online-accounts-api/test-leaks-1617180
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
Online Accounts Pending
Review via email: mp+313671@code.launchpad.net

Commit message

Tests: run main loop to avoid memory leaks

Description of the change

Tests: run main loop to avoid memory leaks

To post a comment you must log in.
44. By Alberto Mardegan

same for QML tests

Revision history for this message
Michi Henning (michihenning) wrote :

That's a significant improvement, thank you! Together with the leak fix, that gets rid of the PendingCall related errors.

I'm still seeing other errors with valgrind in the tests. It would be good to chase these down as well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp'
--- tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp 2016-11-07 12:47:57 +0000
+++ tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp 2016-12-21 07:50:21 +0000
@@ -81,6 +81,7 @@
81 }81 }
8282
83private Q_SLOTS:83private Q_SLOTS:
84 void cleanup();
84 void testConstructor();85 void testConstructor();
85 void testManagerReady_data();86 void testManagerReady_data();
86 void testManagerReady();87 void testManagerReady();
@@ -116,6 +117,14 @@
116 m_dbus.startServices();117 m_dbus.startServices();
117}118}
118119
120void FunctionalTests::cleanup()
121{
122 /* Iterate the main loop in order to execute the delayed cleanup methods
123 * and avoid memory leaks.
124 */
125 QTest::qWait(10);
126}
127
119void FunctionalTests::testConstructor()128void FunctionalTests::testConstructor()
120{129{
121 // Standard constructor130 // Standard constructor
122131
=== modified file 'tests/lib/qml_module/tst_qml_module.cpp'
--- tests/lib/qml_module/tst_qml_module.cpp 2016-11-09 07:01:31 +0000
+++ tests/lib/qml_module/tst_qml_module.cpp 2016-12-21 07:50:21 +0000
@@ -92,6 +92,7 @@
9292
93private Q_SLOTS:93private Q_SLOTS:
94 void initTestCase();94 void initTestCase();
95 void cleanup();
95 void testModuleImport();96 void testModuleImport();
96 void testModelProperties();97 void testModelProperties();
97 void testServices_data();98 void testServices_data();
@@ -129,6 +130,14 @@
129 qputenv("QML2_IMPORT_PATH", TEST_QML_IMPORT_PATH);130 qputenv("QML2_IMPORT_PATH", TEST_QML_IMPORT_PATH);
130}131}
131132
133void ModuleTest::cleanup()
134{
135 /* Iterate the main loop in order to execute the delayed cleanup methods
136 * and avoid memory leaks.
137 */
138 QTest::qWait(10);
139}
140
132void ModuleTest::testModuleImport()141void ModuleTest::testModuleImport()
133{142{
134 QQmlEngine engine;143 QQmlEngine engine;

Subscribers

People subscribed via source and target branches