:program:`lit` provides various patterns that can be used with the RUN command.
These are defined in TestRunner.py. The base set of substitutions are:
- ======================= ==============
- Macro Substitution
- ======================= ==============
- %s source path (path to the file currently being run)
- %S source dir (directory of the file currently being run)
- %p same as %S
- %{pathsep} path separator
- %t temporary file name unique to the test
- %T temporary directory unique to the test
- %{shared_output(LABEL)} temporary file name, identified by "LABEL", shared across all tests
- %% %
- ======================= ==============
+ ========== ==============
+ Macro Substitution
+ ========== ==============
+ %s source path (path to the file currently being run)
+ %S source dir (directory of the file currently being run)
+ %p same as %S
+ %{pathsep} path separator
+ %t temporary file name unique to the test
+ %T temporary directory unique to the test
+ %% %
+ ========== ==============
Other substitutions are provided that are variations on this base set and
further substitution patterns can be defined by each test module. See the
Example: ``/home/user/llvm.build/test/MC/ELF/Output``
-``%{shared_output(LABEL)}``
- File path to a temporary file name shared across all tests, identified by
- LABEL. This is useful as a cache for generated resources.
-
- Example: ``/home/user/llvm.build/test/Output/Shared/LABEL.tmp``
-
``%{pathsep}``
Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
sourcepath = test.getSourcePath()
sourcedir = os.path.dirname(sourcepath)
- sharedOutputDir = os.path.join(test.suite.exec_root, 'Output', 'Shared')
- sharedOutputDir += os.path.sep
-
# Normalize slashes, if requested.
if normalize_slashes:
sourcepath = sourcepath.replace('\\', '/')
('%t', tmpName),
('%basename_t', baseName),
('%T', tmpDir),
- ('%{shared_output\(([-+=._a-zA-Z0-9]+)\)}',
- '%s\\1.tmp' % (sharedOutputDir,)),
('#_MARKER_#', '%')])
# "%/[STpst]" should be normalized.
import os
-import shutil
import sys
import threading
import time
return True
win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
- # Make fresh shared output directories.
- suites = set(test.suite for test in self.tests)
- for suite in suites:
- shared_dir = os.path.join(suite.exec_root, 'Output', 'Shared')
- shutil.rmtree(shared_dir, ignore_errors=True)
- lit.util.mkdir_p(shared_dir)
-
# Save the display object on the runner so that we can update it from
# our task completion callback.
self.display = display
+++ /dev/null
-import lit.formats
-config.name = 'shared-output'
-config.suffixes = ['.txt']
-config.test_format = lit.formats.ShTest()
-config.test_source_root = os.path.dirname(os.path.realpath(__file__))
+++ /dev/null
-RUN: echo "primary" >> %{shared_output(SHARED)}
-RUN: echo "other" >> %{shared_output(OTHER)}
+++ /dev/null
-RUN: echo "secondary" >> %{shared_output(SHARED)}
+++ /dev/null
-RUN: echo "sub" >> %{shared_output(SHARED)}
+++ /dev/null
-# XFAIL: windows
-# Still need to work out some path issues
-
-# RUN: rm -rf %t && mkdir -p %t
-# RUN: echo 'lit_config.load_config(config, os.path.join(r"%{inputs}", "shared-output", "lit.cfg"))' > %t/lit.site.cfg
-# RUN: %{lit} %t
-# RUN: FileCheck %s < %t/Output/Shared/SHARED.tmp
-# RUN: FileCheck -check-prefix=NEGATIVE %s < %t/Output/Shared/SHARED.tmp
-# RUN: FileCheck -check-prefix=OTHER %s < %t/Output/Shared/OTHER.tmp
-
-# CHECK-DAG: primary
-# CHECK-DAG: secondary
-# CHECK-DAG: sub
-
-# NEGATIVE-NOT: other
-# OTHER: other