Skip to content

Commit d88e003

Browse files
author
Dave Abrahams
authored
Merge pull request #4736 from apple/testing-fixes
Testing fixes
2 parents c4a37ce + 77d4f41 commit d88e003

File tree

7 files changed

+24
-9
lines changed

7 files changed

+24
-9
lines changed

test/Driver/driver-compile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// RUN: %swiftc_driver -driver-print-jobs -c -target x86_64-apple-macosx10.9 %s %S/../Inputs/empty.swift -module-name main -driver-use-filelists 2>&1 | %FileCheck -check-prefix=FILELIST %s
3939

4040
// RUN: rm -rf %t && mkdir -p %t/DISTINCTIVE-PATH/usr/bin/
41-
// RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
41+
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/DISTINCTIVE-PATH/usr/bin/swiftc)
4242
// RUN: ln -s "swiftc" %t/DISTINCTIVE-PATH/usr/bin/swift-update
4343
// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc -driver-print-jobs -update-code -c -target x86_64-apple-macosx10.9 -emit-module -emit-module-path %t.mod %s 2>&1 > %t.upd.txt
4444
// RUN: %FileCheck -check-prefix UPDATE-CODE %s < %t.upd.txt

test/Driver/linker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
// RUN: mkdir -p %t/DISTINCTIVE-PATH/usr/bin/
279279
// RUN: touch %t/DISTINCTIVE-PATH/usr/bin/ld
280280
// RUN: chmod +x %t/DISTINCTIVE-PATH/usr/bin/ld
281-
// RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
281+
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/DISTINCTIVE-PATH/usr/bin/swiftc)
282282
// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc %s -### | %FileCheck -check-prefix=RELATIVE-LINKER %s
283283

284284
// RELATIVE-LINKER: /DISTINCTIVE-PATH/usr/bin/swift

test/Driver/options-repl-darwin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// RUN: mkdir -p %t/usr/bin/
1212
// RUN: touch %t/usr/bin/lldb
1313
// RUN: chmod +x %t/usr/bin/lldb
14-
// RUN: ln %swift_driver_plain %t/usr/bin/swift
14+
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
1515
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
1616
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
1717

test/Driver/options-repl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
// RUN: mkdir -p %t/usr/bin/
4646
// RUN: touch %t/usr/bin/lldb
4747
// RUN: chmod +x %t/usr/bin/lldb
48-
// RUN: ln %swift_driver_plain %t/usr/bin/swift
48+
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
4949
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
5050
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s

test/lit.cfg

Lines changed: 9 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')
@@ -950,6 +951,10 @@ config.substitutions.append(('%target-ld', config.target_ld))
950951
if hasattr(config, 'target_cc_options'):
951952
config.substitutions.append(('%target-cc-options', config.target_cc_options))
952953

954+
config.substitutions.append(
955+
(r'%hardlink-or-copy\(from: *(.*), *to: *(.*)\)',
956+
r'ln \1 \2 || cp \1 \2'))
957+
953958
config.substitutions.append(('%utils', config.swift_utils))
954959
config.substitutions.append(('%line-directive', config.line_directive))
955960
config.substitutions.append(('%gyb', config.gyb))
@@ -1003,11 +1008,12 @@ config.substitutions.append(('%llvm-cov', config.llvm_cov))
10031008

10041009
config.substitutions.append(
10051010
('%FileCheck',
1006-
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\'' %
1011+
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\' --use-filecheck \'%s\'' %
10071012
(config.PathSanitizingFileCheck,
10081013
pipes.quote(swift_obj_root),
1009-
pipes.quote(config.swift_src_root))))
1010-
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)))
10111017

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

test/stdlib/POSIX.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift
1+
// RUN: %target-run-simple-swift %t
22
// REQUIRES: executable_test
33

44
// Android Bionic does not provide a working implementation of
@@ -12,6 +12,7 @@ import StdlibUnittest
1212
import Darwin
1313
#endif
1414

15+
chdir(CommandLine.arguments[1])
1516

1617
var POSIXTests = TestSuite("POSIXTests")
1718

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)