Mir

Merge lp:~afrantzis/mir/fix-1401364-death-test-leaks into lp:mir

Proposed by Alexandros Frantzis
Status: Merged
Merged at revision: 2150
Proposed branch: lp:~afrantzis/mir/fix-1401364-death-test-leaks
Merge into: lp:mir
Diff against target: 28 lines (+6/-0)
1 file modified
tests/acceptance-tests/test_client_library_errors.cpp (+6/-0)
To merge this branch: bzr merge lp:~afrantzis/mir/fix-1401364-death-test-leaks
Reviewer Review Type Date Requested Status
Alan Griffiths Abstain
Daniel van Vugt Abstain
Chris Halse Rogers Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Robert Carr (community) Approve
Cemil Azizoglu (community) Approve
Review via email: mp+244414@code.launchpad.net

Commit message

tests: Fix memory leaks in death tests that cause subsequent tests to fail
(LP: #1402160)

Description of the change

tests: Fix memory leaks in death tests that cause subsequent tests to fail

To reproduce problem and test fixes do (courtesy of Alan):

valgrind --error-exitcode=1 --trace-children=yes --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite bin/mir_acceptance_tests --gtest_filter=ClientLibraryErrorsDeathTest*:ClientLibraryThread*

The ClientLibraryThread tests should pass and not report any definite leaks. It's expected to get leaks from the DeathTests.

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ok

review: Approve
Revision history for this message
Robert Carr (robertcarr) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That doesn't sound right to me:

ASSERT_FALSE(mir_connection_is_valid(connection));
...
mir_connection_release(connection);

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If it is right then we need to fix our API. Because invalid objects should not be releasable.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Jenkins (above) shows the bug is not fixed:

8: [ FAILED ] ClientLibraryThread.handles_no_signals (732 ms)

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

As discovered, this branch doesn't fix the problem (https://code.launchpad.net/~raof/mir/fix-all-the-CI/+merge/244526 does).

It's still correct to land, though.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Also basic logic says no :)

ASSERT_FALSE(mir_connection_is_valid(connection));
// so connection is not valid, and then:
mir_connection_release(connection);

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

We guarantee that mir_*_release (on something that we return) is always
a valid call, and always necessary.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm we need to fix that (another day). It's quite mind-bending to say:
    ASSERT_FALSE(mir_connection_is_valid(connection));
    mir_connection_release(connection);
Because it looks like an obvious programming error.

P.S. Bug 1401364 is now fixed by a different branch.

review: Abstain
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Jenkins (above) shows the bug is not fixed:
>
> 8: [ FAILED ] ClientLibraryThread.handles_no_signals (732 ms)

That's reassuring - it didn't work for me locally either.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Releasing an "error object" is expected use of the API, but the linked bug isn't fixed.

I'm not against landing this - provided the bug is unlinked.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/acceptance-tests/test_client_library_errors.cpp'
2--- tests/acceptance-tests/test_client_library_errors.cpp 2014-12-11 02:43:01 +0000
3+++ tests/acceptance-tests/test_client_library_errors.cpp 2014-12-11 12:02:43 +0000
4@@ -245,6 +245,8 @@
5 ASSERT_FALSE(mir_connection_is_valid(connection));
6 EXPECT_DEATH(
7 mtf::make_any_surface(connection), "");
8+
9+ mir_connection_release(connection);
10 }
11
12
13@@ -256,6 +258,8 @@
14
15 ASSERT_FALSE(mir_connection_is_valid(connection));
16 EXPECT_DEATH(mtf::make_any_surface(connection), "");
17+
18+ mir_connection_release(connection);
19 }
20
21 TEST_F(ClientLibraryErrorsDeathTest, creating_surface_synchronosly_on_invalid_connection_is_fatal)
22@@ -266,4 +270,6 @@
23
24 ASSERT_FALSE(mir_connection_is_valid(connection));
25 EXPECT_DEATH(mtf::make_any_surface(connection), "");
26+
27+ mir_connection_release(connection);
28 }

Subscribers

People subscribed via source and target branches