Skip to content

Commit

Permalink
unix: refresh test_embed patches to conditionally skip on BOLT (#469)
Browse files Browse the repository at this point in the history
Turns out there is a support function to check for BOLT optimization. So
we can conditionally skip tests on BOLT.

Closes #465.
  • Loading branch information
indygreg authored Jan 3, 2025
1 parent 8b019fb commit eed3a7f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ fi
# On 3.12 (minimum BOLT version), the segfault causes the test harness to
# abort and BOLT optimization uses the partial test results. On 3.13, the segfault
# is a fatal error.
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then
patch -p1 -i ${ROOT}/patch-test-embed-prevent-segfault.patch
fi

Expand Down
10 changes: 5 additions & 5 deletions cpython-unix/patch-test-embed-prevent-segfault-3.14.patch
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 7110fb889f3..61e4d0f6179 100644
index 7110fb889f3..1b55cd156d7 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -940,6 +940,7 @@ def check_all_configs(self, testname, expected_config=None,
self.check_global_config(configs)
return configs

+ @unittest.skip("segfaults on BOLT instrumented binaries")
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
def test_init_default_config(self):
self.check_all_configs("test_init_initialize_config", api=API_COMPAT)

@@ -1039,6 +1040,7 @@ def test_init_from_config(self):
self.check_all_configs("test_init_from_config", config, preconfig,
api=API_COMPAT)

+ @unittest.skip("segfaults on BOLT instrumented binaries")
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
def test_init_compat_env(self):
preconfig = {
'allocator': ALLOCATOR_FOR_CONFIG,
@@ -1074,6 +1076,7 @@ def test_init_compat_env(self):
self.check_all_configs("test_init_compat_env", config, preconfig,
api=API_COMPAT)

+ @unittest.skip("segfaults on BOLT instrumented binaries")
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
def test_init_python_env(self):
preconfig = {
'allocator': ALLOCATOR_FOR_CONFIG,
@@ -1772,6 +1775,7 @@ def test_init_set_config(self):
self.check_all_configs("test_init_set_config", config,
api=API_ISOLATED)

+ @unittest.skip("segfaults on BOLT instrumented binaries")
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
def test_initconfig_api(self):
preconfig = {
'configure_locale': True,
6 changes: 3 additions & 3 deletions cpython-unix/patch-test-embed-prevent-segfault.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 13713cf37b8..ba23880b15f 100644
index 13713cf37b8..40ee4837bfe 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1615,6 +1615,7 @@ def test_getpath_abspath_win32(self):
for (_, expected), result in zip(CASES, results):
self.assertEqual(result, expected)

+ @unittest.skip("segfaults on BOLT instrumented binaries")
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
def test_global_pathconfig(self):
# Test C API functions getting the path configuration:
#
@@ -1866,6 +1867,7 @@ def test_no_memleak(self):
self.assertEqual(blocks, 0, out)


+@unittest.skip("segfaults on BOLT instrumented binaries")
+@unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):
# Test PyStdPrinter_Type which is used by _PySys_SetPreliminaryStderr():
# "Set up a preliminary stderr printer until we have enough

0 comments on commit eed3a7f

Please sign in to comment.