Skip to content

Commit 77d4f41

Browse files
author
Dave Abrahams
committed
[testing] run FileCheck with complete path
Otherwise, unless you happen to have FileCheck in your PATH, when you copy/paste a test invocation to reproduce it, it fails.
1 parent a073d4a commit 77d4f41

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/lit.cfg

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ config.llvm_link = inferSwiftBinary('llvm-link')
285285
config.swift_llvm_opt = inferSwiftBinary('swift-llvm-opt')
286286
config.llvm_profdata = inferSwiftBinary('llvm-profdata')
287287
config.llvm_cov = inferSwiftBinary('llvm-cov')
288+
config.filecheck = inferSwiftBinary('FileCheck')
288289

289290
config.swift_utils = os.path.join(config.swift_src_root, 'utils')
290291
config.line_directive = os.path.join(config.swift_utils, 'line-directive')
@@ -1007,11 +1008,12 @@ config.substitutions.append(('%llvm-cov', config.llvm_cov))
10071008

10081009
config.substitutions.append(
10091010
('%FileCheck',
1010-
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\'' %
1011+
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\' --use-filecheck \'%s\'' %
10111012
(config.PathSanitizingFileCheck,
10121013
pipes.quote(swift_obj_root),
1013-
pipes.quote(config.swift_src_root))))
1014-
config.substitutions.append(('%raw-FileCheck', 'FileCheck'))
1014+
pipes.quote(config.swift_src_root),
1015+
pipes.quote(config.filecheck))))
1016+
config.substitutions.append(('%raw-FileCheck', pipes.quote(config.filecheck)))
10151017

10161018
# If static stdlib is present, enable static stdlib tests
10171019
static_stdlib_path = os.path.join(os.path.join(config.swift_lib_dir,"swift_static"), config.target_sdk_name)

utils/PathSanitizingFileCheck

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@ constants.""")
3333
dest="sanitize_strings",
3434
default=[])
3535

36+
parser.add_argument(
37+
"--use-filecheck",
38+
help="path to LLVM FileCheck executable",
39+
metavar="PATH",
40+
action="store",
41+
dest="file_check_path",
42+
default="FileCheck")
43+
3644
args, unknown_args = parser.parse_known_args()
3745

3846
stdin = sys.stdin.read()
3947
for s in args.sanitize_strings:
4048
replacement, pattern = s.split('=', 1)
4149
stdin = stdin.replace(pattern, replacement)
4250

43-
p = subprocess.Popen(["FileCheck"] + unknown_args, stdin=subprocess.PIPE)
51+
p = subprocess.Popen([args.file_check_path] + unknown_args, stdin=subprocess.PIPE)
4452
stdout, stderr = p.communicate(stdin)
4553
if stdout is not None:
4654
print(stdout)

0 commit comments

Comments
 (0)