Skip to content

Commit a6e29a2

Browse files
committed
Make sure that test_perfmaps.py test is not skipped on macOS
1 parent 40bc704 commit a6e29a2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Lib/test/test_perfmaps.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import os
2-
import sys
2+
import sysconfig
33
import unittest
44

55
try:
66
from _testinternalcapi import perf_map_state_teardown, write_perf_map_entry
77
except ImportError:
88
raise unittest.SkipTest("requires _testinternalcapi")
99

10+
def supports_trampoline_profiling():
11+
perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
12+
if not perf_trampoline:
13+
return False
14+
return int(perf_trampoline) == 1
1015

11-
if sys.platform != 'linux':
12-
raise unittest.SkipTest('Linux only')
13-
16+
if not supports_trampoline_profiling():
17+
raise unittest.SkipTest("perf trampoline profiling not supported")
1418

1519
class TestPerfMapWriting(unittest.TestCase):
1620
def test_write_perf_map_entry(self):

0 commit comments

Comments
 (0)