mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-13 15:47:23 +00:00
python3-objgraph: Fix intermittent test_at_addrs ptest failure
get_new_ids() keeps the ids it saw in earlier calls, including those of
objects freed since. When the list created by test_at_addrs reuses one
of those addresses it is not reported as new and the test fails, which
was seen on musl qemux86-64:
{'python3-objgraph': ['tests.py:AtAddrsTest.test_at_addrs']}
Refresh the baseline right before creating the list.
AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
2 files changed
+45
-1
No files matched your search
+42
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 28 Oct 2026 08:08:23 -0700
|
||||
Subject: [PATCH] Make test_at_addrs independent of earlier get_new_ids() calls
|
||||
|
||||
get_new_ids() keeps the ids it has seen in its _state and reports only
|
||||
ids that are not in there. Ids of objects that were freed after an
|
||||
earlier call stay in that set, so if the list created by test_at_addrs
|
||||
reuses the address of one of them it is not reported as new and the
|
||||
test fails:
|
||||
|
||||
self.assertIn(a, new_lists)
|
||||
AssertionError: [0, 1, 2] not found in [...]
|
||||
|
||||
Whether that happens depends on the allocator and on what ran before;
|
||||
it was seen intermittently with musl, and a slight change in what the
|
||||
test allocates makes it fail every time.
|
||||
|
||||
Call get_new_ids() once more right before creating the list, as the
|
||||
example in its docstring does, so the baseline only holds live objects.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
---
|
||||
tests.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/tests.py b/tests.py
|
||||
index 0c7aa1f..1dab8c1 100755
|
||||
--- a/tests.py
|
||||
+++ b/tests.py
|
||||
@@ -361,6 +361,10 @@ class ByTypeTest(GarbageCollectedMixin, unittest.TestCase):
|
||||
class AtAddrsTest(unittest.TestCase):
|
||||
|
||||
def test_at_addrs(self):
|
||||
+ # get_new_ids() remembers the ids seen by earlier calls, including
|
||||
+ # ones of objects that have been freed since; refresh that state so
|
||||
+ # that a list reusing such an address still counts as new.
|
||||
+ objgraph.get_new_ids(limit=0)
|
||||
a = [0, 1, 2]
|
||||
new_ids = objgraph.get_new_ids(limit=0)
|
||||
new_lists = objgraph.at_addrs(new_ids['list'])
|
||||
@@ -3,7 +3,9 @@ HOMEPAGE = "https://mg.pov.lt/objgraph/"
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=e48a556235f55ad7d4234475657f68a7"
|
||||
|
||||
SRC_URI:append = " file://run-ptest"
|
||||
SRC_URI:append = " file://run-ptest \
|
||||
file://0001-Make-test_at_addrs-independent-of-earlier-get_new_id.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "b6ef4b244217410509b257970413b01a979d54df48d2d4055b6941e8679ddbbb"
|
||||
|
||||
inherit pypi setuptools3 ptest-python-pytest
|
||||
|
||||
Reference in new issue
Block a user