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
1=== modified file 'tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp'
2--- tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp 2016-11-07 12:47:57 +0000
3+++ tests/lib/OnlineAccounts/functional_tests/functional_tests.cpp 2016-12-21 07:50:21 +0000
4@@ -81,6 +81,7 @@
5 }
6
7 private Q_SLOTS:
8+ void cleanup();
9 void testConstructor();
10 void testManagerReady_data();
11 void testManagerReady();
12@@ -116,6 +117,14 @@
13 m_dbus.startServices();
14 }
15
16+void FunctionalTests::cleanup()
17+{
18+ /* Iterate the main loop in order to execute the delayed cleanup methods
19+ * and avoid memory leaks.
20+ */
21+ QTest::qWait(10);
22+}
23+
24 void FunctionalTests::testConstructor()
25 {
26 // Standard constructor
27
28=== modified file 'tests/lib/qml_module/tst_qml_module.cpp'
29--- tests/lib/qml_module/tst_qml_module.cpp 2016-11-09 07:01:31 +0000
30+++ tests/lib/qml_module/tst_qml_module.cpp 2016-12-21 07:50:21 +0000
31@@ -92,6 +92,7 @@
32
33 private Q_SLOTS:
34 void initTestCase();
35+ void cleanup();
36 void testModuleImport();
37 void testModelProperties();
38 void testServices_data();
39@@ -129,6 +130,14 @@
40 qputenv("QML2_IMPORT_PATH", TEST_QML_IMPORT_PATH);
41 }
42
43+void ModuleTest::cleanup()
44+{
45+ /* Iterate the main loop in order to execute the delayed cleanup methods
46+ * and avoid memory leaks.
47+ */
48+ QTest::qWait(10);
49+}
50+
51 void ModuleTest::testModuleImport()
52 {
53 QQmlEngine engine;

Subscribers

People subscribed via source and target branches