Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks (mostly) in tests #3922

Merged
merged 4 commits into from
Dec 21, 2019

Conversation

c4rlo
Copy link
Contributor

@c4rlo c4rlo commented Nov 23, 2019

This makes the tests run successfully with asan (AddressSanitizer).

Type of change

  • ✅ Bug fix (non-breaking change which fixes an issue)

Description and Context

The GUI tests still have a bunch of leaks, some from library code, and
some that look real but which I didn't manage to figure out so far.

Screenshots

N/A

Testing strategy

cmake --DWITH_DEV_BUILD=ON -DWITH_ASAN=ON -DWITH_GUI_TESTS=ON -DCMAKE_BUILD_TYPE=Debug .. &&
cmake --build . &&
ctest --output-on-failure

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]

Copy link
Member

@phoerious phoerious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. We generally run tests with leak check on exit disabled, because there are also plenty of leaks in third-party libs.

tests/TestGroup.cpp Show resolved Hide resolved
tests/TestOpVaultReader.cpp Outdated Show resolved Hide resolved
@phoerious
Copy link
Member

Please rebase to release/2.5.2.

@phoerious phoerious added bug pr: tests Pull requests that adds or modifies tests labels Nov 24, 2019
@phoerious phoerious added this to the v2.5.2 milestone Nov 24, 2019
@c4rlo
Copy link
Contributor Author

c4rlo commented Nov 24, 2019

Thanks. We generally run tests with leak check on exit disabled, because there are also plenty of leaks in third-party libs.

After this change, the only tests that still have leaks reported are testcli, testgui, testguipixmaps. Perhaps we could enable asan in CI for all the others at this point?

@c4rlo c4rlo changed the base branch from develop to release/2.5.2 November 24, 2019 10:27
This makes the tests run successfully with asan.

The GUI tests still have a bunch of leaks, some from library code, and
some that look real but which I didn't immediately manage to figure out.
@phoerious
Copy link
Member

ASAN is already enabled for everything.

@c4rlo
Copy link
Contributor Author

c4rlo commented Nov 24, 2019

ASAN is already enabled for everything.

Enabled perhaps, but it seems a failure doesn't block PR merges. Which I'm saying it should (excluding test{cli,gui,guipixmaps}).

@phoerious
Copy link
Member

phoerious commented Nov 24, 2019

We disabled leak checks on exit, because it's a useless test that fails as soon as some external library doesn't free all its memory before the application terminates. Real leaks that happen during runtime are reported and block PR merges.

@droidmonkey droidmonkey dismissed phoerious’s stale review December 21, 2019 14:24

Changes were made

@droidmonkey droidmonkey merged commit c70ebe6 into keepassxreboot:release/2.5.2 Dec 21, 2019
droidmonkey added a commit that referenced this pull request Jan 4, 2020
Added

- Browser: Show UI warning when entering invalid URLs [#3912]
- Browser: Option to use an entry only for HTTP auth [#3927]

Changed

- Disable the user interface when merging or saving the database [#3991]
- Ability to hide protected attribute after reveal [#3877]
- Remove mention of "snaps" in Windows and macOS [#3879]
- CLI: Merge parameter for source database key file (--key-file-from) [#3961]
- Improve GUI tests reliability on Hi-DPI displays [#4075]
- Disable deprecation warnings to allow building with Qt 5.14+ [#4075]
- OPVault: Use 'otp' attribute for TOTP field imports [#4075]

Fixed

- Fix crashes when saving a database to cloud storage [#3991]
- Fix crash when pressing enter twice while opening database [#3885]
- Fix handling of HTML when displayed in the entry preview panel [#3910]
- Fix start minimized to tray on Linux [#3899]
- Fix Auto Open with key file only databases [#4075]
- Fix escape key closing the standalone password generator [#3892]
- macOS: Fix monospace font usage in password field and notes [#4075]
- macOS: Fix building on macOS 10.9 to 10.11 [#3946]
- Fix TOTP setup dialog not closing on database lock [#4075]
- Browser: Fix condition where additional URLs are ignored [#4033]
- Browser: Fix subdomain matching to return only relevant site entries [#3854]
- Secret Service: Fix multiple crashes and incompatibilities [#3871, #4009, #4074]
- Secret Service: Fix searching of entries [#4008, #4036]
- Secret Service: Fix behavior when exposed group is recycled [#3914]
- CLI: Release the database instance before exiting interactive mode [#3889]
- Fix (most) memory leaks in tests [#3922]
@phoerious phoerious added pr: bugfix Pull request that fixes a bug and removed bug labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: bugfix Pull request that fixes a bug pr: tests Pull requests that adds or modifies tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants