From 0ede0c4bcd1fe591299b2ec012fde2f26adddcc0 Mon Sep 17 00:00:00 2001 From: Brian Gesiak Date: Fri, 25 Dec 2015 20:24:20 -0500 Subject: [PATCH] [test] Run Python unit tests in validation tests This repository includes several Python modules, each with unit tests. Add a step to the validation tests to ensure these tests pass. --- docs/Testing.rst | 2 ++ test/lit.cfg | 2 ++ validation-test/Python/cmpcodesize.swift | 1 + 3 files changed, 5 insertions(+) create mode 100644 validation-test/Python/cmpcodesize.swift 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