From ca4c20a8ffee035e5065655e44ee3f53e42c3114 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Sun, 16 Nov 2025 05:28:24 +0000 Subject: [PATCH 1/7] Tests: Add missing assertions to test_trampoline_works_with_forks --- Lib/test/test_perf_profiler.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index e6852c93e69830..708df85bec8341 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -154,12 +154,22 @@ def baz(): self.assertIn(f"py::foo:{script}", perf_file_contents) self.assertIn(f"py::bar:{script}", perf_file_contents) self.assertIn(f"py::baz:{script}", perf_file_contents) - + # The parent's map should not contain the child's symbols child_perf_file_contents = perf_child_file.read_text() self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) self.assertIn(f"py::baz_fork:{script}", child_perf_file_contents) + # The child's map should not contain the parent's symbols + self.assertNotIn(f"py::foo_fork:{script}", perf_file_contents) + self.assertNotIn(f"py::bar_fork:{script}", perf_file_contents) + self.assertNotIn(f"py::baz_fork:{script}", perf_file_contents) + # The child's map should not contain the parent's symbols + self.assertNotIn(f"py::foo:{script}", child_perf_file_contents) + self.assertNotIn(f"py::bar:{script}", child_perf_file_contents) + self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) + + @unittest.skipIf(support.check_bolt_optimized(), "fails on BOLT instrumented binaries") def test_sys_api(self): for define_eval_hook in (False, True): From 16774c4002fd7b429d81f112a11c1ffb70d6ef87 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Mon, 17 Nov 2025 13:52:56 +0530 Subject: [PATCH 2/7] Update Lib/test/test_perf_profiler.py Co-authored-by: Mikhail Efimov --- Lib/test/test_perf_profiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 708df85bec8341..3143478305cb5d 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -160,7 +160,7 @@ def baz(): self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) self.assertIn(f"py::baz_fork:{script}", child_perf_file_contents) - # The child's map should not contain the parent's symbols + # The parent's map should not contain the child's symbols self.assertNotIn(f"py::foo_fork:{script}", perf_file_contents) self.assertNotIn(f"py::bar_fork:{script}", perf_file_contents) self.assertNotIn(f"py::baz_fork:{script}", perf_file_contents) From fcf64ffe3e732fb1e67149a0e77a43738065c193 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Mon, 17 Nov 2025 13:53:07 +0530 Subject: [PATCH 3/7] Update Lib/test/test_perf_profiler.py Co-authored-by: Mikhail Efimov --- Lib/test/test_perf_profiler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 3143478305cb5d..f7e4638745e8ca 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -154,7 +154,6 @@ def baz(): self.assertIn(f"py::foo:{script}", perf_file_contents) self.assertIn(f"py::bar:{script}", perf_file_contents) self.assertIn(f"py::baz:{script}", perf_file_contents) - # The parent's map should not contain the child's symbols child_perf_file_contents = perf_child_file.read_text() self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) From d478e05bb3fe9269514250e1e75518a592398226 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Mon, 17 Nov 2025 14:36:28 +0530 Subject: [PATCH 4/7] Enhance performance profiler tests Add assertions for child performance file contents. --- Lib/test/test_perf_profiler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index f7e4638745e8ca..36fe820fb947a2 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -154,6 +154,7 @@ def baz(): self.assertIn(f"py::foo:{script}", perf_file_contents) self.assertIn(f"py::bar:{script}", perf_file_contents) self.assertIn(f"py::baz:{script}", perf_file_contents) + child_perf_file_contents = perf_child_file.read_text() self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) @@ -167,8 +168,6 @@ def baz(): self.assertNotIn(f"py::foo:{script}", child_perf_file_contents) self.assertNotIn(f"py::bar:{script}", child_perf_file_contents) self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) - - @unittest.skipIf(support.check_bolt_optimized(), "fails on BOLT instrumented binaries") def test_sys_api(self): for define_eval_hook in (False, True): From d1bb7e474a197f3d1402baddff1cdbbf55099904 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Mon, 17 Nov 2025 14:48:31 +0530 Subject: [PATCH 5/7] Minimize diff: remove negative assertions Ensure that the child performance file does not contain parent symbols. --- Lib/test/test_perf_profiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 36fe820fb947a2..3ae740e375f33b 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -159,7 +159,6 @@ def baz(): self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) self.assertIn(f"py::baz_fork:{script}", child_perf_file_contents) - # The parent's map should not contain the child's symbols self.assertNotIn(f"py::foo_fork:{script}", perf_file_contents) self.assertNotIn(f"py::bar_fork:{script}", perf_file_contents) @@ -167,7 +166,8 @@ def baz(): # The child's map should not contain the parent's symbols self.assertNotIn(f"py::foo:{script}", child_perf_file_contents) self.assertNotIn(f"py::bar:{script}", child_perf_file_contents) - self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) + self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) + @unittest.skipIf(support.check_bolt_optimized(), "fails on BOLT instrumented binaries") def test_sys_api(self): for define_eval_hook in (False, True): From 2e58457cb42052215feb1ac9aa6b0047e5b72fe9 Mon Sep 17 00:00:00 2001 From: Mikhail Efimov Date: Mon, 17 Nov 2025 12:18:40 +0300 Subject: [PATCH 6/7] Update Lib/test/test_perf_profiler.py --- Lib/test/test_perf_profiler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 3ae740e375f33b..a7a2a16543af64 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -154,7 +154,6 @@ def baz(): self.assertIn(f"py::foo:{script}", perf_file_contents) self.assertIn(f"py::bar:{script}", perf_file_contents) self.assertIn(f"py::baz:{script}", perf_file_contents) - child_perf_file_contents = perf_child_file.read_text() self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) From 399ea538dd8f5400a8fccdcbd0abc6eca00a4b12 Mon Sep 17 00:00:00 2001 From: Paresh Joshi Date: Mon, 17 Nov 2025 16:27:33 +0530 Subject: [PATCH 7/7] Fix formatting in test_perf_profiler.py --- Lib/test/test_perf_profiler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index a7a2a16543af64..7957cbb0c7fe4c 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -154,19 +154,22 @@ def baz(): self.assertIn(f"py::foo:{script}", perf_file_contents) self.assertIn(f"py::bar:{script}", perf_file_contents) self.assertIn(f"py::baz:{script}", perf_file_contents) + child_perf_file_contents = perf_child_file.read_text() self.assertIn(f"py::foo_fork:{script}", child_perf_file_contents) self.assertIn(f"py::bar_fork:{script}", child_perf_file_contents) self.assertIn(f"py::baz_fork:{script}", child_perf_file_contents) + # The parent's map should not contain the child's symbols self.assertNotIn(f"py::foo_fork:{script}", perf_file_contents) self.assertNotIn(f"py::bar_fork:{script}", perf_file_contents) self.assertNotIn(f"py::baz_fork:{script}", perf_file_contents) + # The child's map should not contain the parent's symbols self.assertNotIn(f"py::foo:{script}", child_perf_file_contents) self.assertNotIn(f"py::bar:{script}", child_perf_file_contents) - self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) - + self.assertNotIn(f"py::baz:{script}", child_perf_file_contents) + @unittest.skipIf(support.check_bolt_optimized(), "fails on BOLT instrumented binaries") def test_sys_api(self): for define_eval_hook in (False, True):