Skip to content

Commit eed3a7f

Browse files
authored
unix: refresh test_embed patches to conditionally skip on BOLT (#469)
Turns out there is a support function to check for BOLT optimization. So we can conditionally skip tests on BOLT. Closes #465.
1 parent 8b019fb commit eed3a7f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cpython-unix/build-cpython.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ fi
305305
# On 3.12 (minimum BOLT version), the segfault causes the test harness to
306306
# abort and BOLT optimization uses the partial test results. On 3.13, the segfault
307307
# is a fatal error.
308-
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_10}" ]; then
308+
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then
309309
patch -p1 -i ${ROOT}/patch-test-embed-prevent-segfault.patch
310310
fi
311311

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
2-
index 7110fb889f3..61e4d0f6179 100644
2+
index 7110fb889f3..1b55cd156d7 100644
33
--- a/Lib/test/test_embed.py
44
+++ b/Lib/test/test_embed.py
55
@@ -940,6 +940,7 @@ def check_all_configs(self, testname, expected_config=None,
66
self.check_global_config(configs)
77
return configs
88

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

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

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

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

33-
+ @unittest.skip("segfaults on BOLT instrumented binaries")
33+
+ @unittest.skipIf(support.check_bolt_optimized, "segfaults on BOLT instrumented binaries")
3434
def test_initconfig_api(self):
3535
preconfig = {
3636
'configure_locale': True,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
2-
index 13713cf37b8..ba23880b15f 100644
2+
index 13713cf37b8..40ee4837bfe 100644
33
--- a/Lib/test/test_embed.py
44
+++ b/Lib/test/test_embed.py
55
@@ -1615,6 +1615,7 @@ def test_getpath_abspath_win32(self):
66
for (_, expected), result in zip(CASES, results):
77
self.assertEqual(result, expected)
88

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

1616

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

0 commit comments

Comments
 (0)