Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-135904: Add tests for the JIT build process#136766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
brandtbucher wants to merge13 commits intopython:main
base:main
Choose a base branch
Loading
frombrandtbucher:jit-tests
Open
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Rework tests
  • Loading branch information
@brandtbucher
brandtbucher committedJul 17, 2025
commitc6fc7bd8a2d5c1982ad5bb290ec1356e9e90ded8
14 changes: 11 additions & 3 deletionsLib/test/test_jit_stencils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
import asyncio
import pathlib
import shlex
import sys
import sysconfig
import tempfile
import test.support
import test.test_tools
import test.support.script_helper
import unittest

Expand All@@ -13,11 +14,13 @@
_TOOLS_JIT_TEST_TEST_EXECUTOR_CASES_C_H = _TOOLS_JIT_TEST / "test_executor_cases.c.h"
_TOOLS_JIT_BUILD_PY = _TOOLS_JIT / "build.py"

test.test_tools.skip_if_missing("jit")
with test.test_tools.imports_under_tool("jit"):
import _llvm

@test.support.cpython_only
@unittest.skipIf(test.support.Py_DEBUG, "Debug stencils aren't tested.")
@unittest.skipIf(test.support.Py_GIL_DISABLED, "Free-threaded stencils aren't tested.")
@unittest.skipUnless(sysconfig.is_python_build(), "Requires a local Python build.")
class TestJITStencils(unittest.TestCase):

def _build_jit_stencils(self, target: str) -> str:
Expand All@@ -31,6 +34,9 @@ def _build_jit_stencils(self, target: str) -> str:
"--pyconfig-dir", pyconfig_h.parent,
target,
__isolated=False,
# Windows leaks temporary files on failure because the JIT build
# process is async. This forces it to be "sync" for this test:
PYTHON_CPU_COUNT="1",
)
if result.rc:
self.skipTest(f"Build failed: {shlex.join(map(str, args))}")
Expand All@@ -54,6 +60,8 @@ def _check_jit_stencils(
raise

def test_jit_stencils(self):
if not asyncio.run(_llvm._find_tool("clang")):
self.skipTest(f"LLVM {_llvm._LLVM_VERSION} isn't installed.")
self.maxDiff = None
found = False
for test_jit_stencils_h in _TOOLS_JIT_TEST.glob("test_jit_stencils-*.h"):
Expand All@@ -64,7 +72,7 @@ def test_jit_stencils(self):
found = True
self._check_jit_stencils(expected, actual, test_jit_stencils_h)
# This is a local build. If the JIT is available, at least one test should run:
assert found or not sys._jit.is_available(), "No JIT stencils built!"
assert found, "No JIT stencils built!"


if __name__ == "__main__":
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp