Index: docs/TestingGuide.rst =================================================================== --- docs/TestingGuide.rst +++ docs/TestingGuide.rst @@ -129,6 +129,18 @@ to enable testing with valgrind and with leak checking enabled. +Some tests write their outputs directly to the console and the outputs cannot +be redirected to a file. These tests are disabled by default. In order to run +the tests which output to console, please include ``--enable-console`` in the +``LIT_ARGS`` make variable. For example, you can use: + +.. code-block:: bash + + % make check LIT_ARGS="-v --enable-console" + +to enable testing that output to the console. On the RUN line of the test body, +you can use ``/dev/tty`` to refer to the console. + To run individual tests or subsets of tests, you can use the ``llvm-lit`` script which is built as part of LLVM. For example, to run the ``Integer/BitPacked.ll`` test by itself you can run: Index: utils/lit/lit/LitConfig.py =================================================================== --- utils/lit/lit/LitConfig.py +++ utils/lit/lit/LitConfig.py @@ -21,7 +21,7 @@ def __init__(self, progname, path, quiet, useValgrind, valgrindLeakCheck, valgrindArgs, - noExecute, debug, isWindows, + noExecute, debug, enableConsole, isWindows, params, config_prefix = None, maxIndividualTestTime = 0): # The name of the test runner. @@ -34,6 +34,7 @@ self.valgrindUserArgs = list(valgrindArgs) self.noExecute = noExecute self.debug = debug + self.enableConsole = enableConsole self.isWindows = bool(isWindows) self.params = dict(params) self.bashPath = None Index: utils/lit/lit/TestRunner.py =================================================================== --- utils/lit/lit/TestRunner.py +++ utils/lit/lit/TestRunner.py @@ -245,6 +245,10 @@ if r[2] is None: if kAvoidDevNull and r[0] == '/dev/null': r[2] = tempfile.TemporaryFile(mode=r[1]) + elif kIsWindows and r[0] == '/dev/tty': + # Simulate /dev/tty on Windows. + # "CON" is a special filename for the console. + r[2] = open("CON", r[1]) else: # Make sure relative paths are relative to the cwd. redir_filename = os.path.join(cmd_shenv.cwd, r[0]) Index: utils/lit/lit/TestingConfig.py =================================================================== --- utils/lit/lit/TestingConfig.py +++ utils/lit/lit/TestingConfig.py @@ -57,6 +57,8 @@ available_features.append('valgrind') if litConfig.valgrindLeakCheck: available_features.append('vg_leak') + if litConfig.enableConsole: + available_features.append('console') return TestingConfig(None, name = '', Index: utils/lit/lit/discovery.py =================================================================== --- utils/lit/lit/discovery.py +++ utils/lit/lit/discovery.py @@ -244,6 +244,7 @@ valgrindArgs = [], noExecute = False, debug = False, + enableConsole = False, isWindows = (platform.system()=='Windows'), params = {}) Index: utils/lit/lit/main.py =================================================================== --- utils/lit/lit/main.py +++ utils/lit/lit/main.py @@ -229,6 +229,9 @@ help=("Only run tests with paths matching the given " "regular expression"), action="store", default=None) + group.add_option("", "--enable-console", dest="enableConsole", + help=("Enable tests that output to the console"), + action="store_true", default=None) parser.add_option_group(group) group = OptionGroup(parser, "Debug and Experimental Options") @@ -297,6 +300,7 @@ valgrindArgs = opts.valgrindArgs, noExecute = opts.noExecute, debug = opts.debug, + enableConsole = opts.enableConsole, isWindows = isWindows, params = userParams, config_prefix = opts.configPrefix,