diff --git a/docs/Testing.rst b/docs/Testing.rst index 80a28dc5a48f6..8e5c39f8de1ed 100644 --- a/docs/Testing.rst +++ b/docs/Testing.rst @@ -313,6 +313,8 @@ Other substitutions: * ``%platform-sdk-overlay-dir``: absolute path of the directory where the SDK overlay module files for the target platform are stored. +* ``%{python}``: run the same Python interpreter that's being used to run the + current ``lit`` test. When writing a test where output (or IR, SIL) depends on the bitness of the target CPU, use this pattern:: diff --git a/test/lit.cfg b/test/lit.cfg index 5a741f3eb3d1e..de170d5bee183 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -22,6 +22,7 @@ import os import platform import re import subprocess +import sys import tempfile import lit.formats @@ -271,6 +272,7 @@ completion_cache_path = tempfile.mkdtemp(prefix="swift-testsuite-completion-cach ccp_opt = "-completion-cache-path %r" % completion_cache_path lit_config.note("Using code completion cache: " + completion_cache_path) +config.substitutions.append( ('%{python}', sys.executable) ) config.substitutions.append( ('%mcp_opt', mcp_opt) ) config.substitutions.append( ('%swift_driver_plain', "%r" % config.swift) ) config.substitutions.append( ('%swiftc_driver_plain', "%r" % config.swiftc) ) diff --git a/validation-test/Python/cmpcodesize.swift b/validation-test/Python/cmpcodesize.swift new file mode 100644 index 0000000000000..cbadc54ec121e --- /dev/null +++ b/validation-test/Python/cmpcodesize.swift @@ -0,0 +1 @@ +// RUN: %{python} -m unittest discover -s %S/../../utils/cmpcodesize