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

Fixing pvalloc memleak test #4733

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/python/test_tools_memleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from unittest import main, skipUnless, TestCase
from utils import kernel_version_ge
import os
import platform
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -102,7 +103,13 @@ def test_memalign(self):
self.assertEqual(cfg.leaking_amount, self.run_leaker("memalign"))

def test_pvalloc(self):
self.assertEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))
# pvalloc's implementation for power invokes mmap(), which adjusts the
# allocated size to meet pvalloc's constraints. Actual leaked memory
# could be more than requested, hence assertLessEqual.
if platform.machine() == 'ppc64le':
self.assertLessEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))
else:
self.assertEqual(cfg.leaking_amount, self.run_leaker("pvalloc"))

def test_aligned_alloc(self):
self.assertEqual(cfg.leaking_amount, self.run_leaker("aligned_alloc"))
Expand Down
Loading