llvm.org GIT mirror llvm / a17d200
Revert "lit.py: Add new %{shared_output(LABEL)} substitution" This reverts r315697 and my ill-fated attempts to fix it on Windows. I'll try again when I get access to a Windows machine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315793 91177308-0d34-0410-b5e6-96231b3b80d8 Jordan Rose 1 year, 10 months ago
9 changed file(s) with 11 addition(s) and 56 deletion(s). Raw diff Collapse all Expand all
394394 :program:`lit` provides various patterns that can be used with the RUN command.
395395 These are defined in TestRunner.py. The base set of substitutions are:
396396
397 ======================= ==============
398 Macro Substitution
399 ======================= ==============
400 %s source path (path to the file currently being run)
401 %S source dir (directory of the file currently being run)
402 %p same as %S
403 %{pathsep} path separator
404 %t temporary file name unique to the test
405 %T temporary directory unique to the test
406 %{shared_output(LABEL)} temporary file name, identified by "LABEL", shared across all tests
407 %% %
408 ======================= ==============
397 ========== ==============
398 Macro Substitution
399 ========== ==============
400 %s source path (path to the file currently being run)
401 %S source dir (directory of the file currently being run)
402 %p same as %S
403 %{pathsep} path separator
404 %t temporary file name unique to the test
405 %T temporary directory unique to the test
406 %% %
407 ========== ==============
409408
410409 Other substitutions are provided that are variations on this base set and
411410 further substitution patterns can be defined by each test module. See the
463463
464464 Example: ``/home/user/llvm.build/test/MC/ELF/Output``
465465
466 ``%{shared_output(LABEL)}``
467 File path to a temporary file name shared across all tests, identified by
468 LABEL. This is useful as a cache for generated resources.
469
470 Example: ``/home/user/llvm.build/test/Output/Shared/LABEL.tmp``
471
472466 ``%{pathsep}``
473467
474468 Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
828828 sourcepath = test.getSourcePath()
829829 sourcedir = os.path.dirname(sourcepath)
830830
831 sharedOutputDir = os.path.join(test.suite.exec_root, 'Output', 'Shared')
832 sharedOutputDir += os.path.sep
833
834831 # Normalize slashes, if requested.
835832 if normalize_slashes:
836833 sourcepath = sourcepath.replace('\\', '/')
851848 ('%t', tmpName),
852849 ('%basename_t', baseName),
853850 ('%T', tmpDir),
854 ('%{shared_output\(([-+=._a-zA-Z0-9]+)\)}',
855 '%s\\1.tmp' % (sharedOutputDir,)),
856851 ('#_MARKER_#', '%')])
857852
858853 # "%/[STpst]" should be normalized.
0 import os
1 import shutil
21 import sys
32 import threading
43 import time
135134 abort_now()
136135 return True
137136 win32api.SetConsoleCtrlHandler(console_ctrl_handler, True)
138
139 # Make fresh shared output directories.
140 suites = set(test.suite for test in self.tests)
141 for suite in suites:
142 shared_dir = os.path.join(suite.exec_root, 'Output', 'Shared')
143 shutil.rmtree(shared_dir, ignore_errors=True)
144 lit.util.mkdir_p(shared_dir)
145137
146138 # Save the display object on the runner so that we can update it from
147139 # our task completion callback.
+0
-5
utils/lit/tests/Inputs/shared-output/lit.cfg less more
None import lit.formats
1 config.name = 'shared-output'
2 config.suffixes = ['.txt']
3 config.test_format = lit.formats.ShTest()
4 config.test_source_root = os.path.dirname(os.path.realpath(__file__))
+0
-2
utils/lit/tests/Inputs/shared-output/primary.txt less more
None RUN: echo "primary" >> %{shared_output(SHARED)}
1 RUN: echo "other" >> %{shared_output(OTHER)}
+0
-1
utils/lit/tests/Inputs/shared-output/secondary.txt less more
None RUN: echo "secondary" >> %{shared_output(SHARED)}
+0
-1
utils/lit/tests/Inputs/shared-output/sub/sub.txt less more
None RUN: echo "sub" >> %{shared_output(SHARED)}
+0
-16
utils/lit/tests/shared-output.py less more
None # XFAIL: windows
1 # Still need to work out some path issues
2
3 # RUN: rm -rf %t && mkdir -p %t
4 # RUN: echo 'lit_config.load_config(config, os.path.join(r"%{inputs}", "shared-output", "lit.cfg"))' > %t/lit.site.cfg
5 # RUN: %{lit} %t
6 # RUN: FileCheck %s < %t/Output/Shared/SHARED.tmp
7 # RUN: FileCheck -check-prefix=NEGATIVE %s < %t/Output/Shared/SHARED.tmp
8 # RUN: FileCheck -check-prefix=OTHER %s < %t/Output/Shared/OTHER.tmp
9
10 # CHECK-DAG: primary
11 # CHECK-DAG: secondary
12 # CHECK-DAG: sub
13
14 # NEGATIVE-NOT: other
15 # OTHER: other