Skip to content

Testing fixes #4736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/Driver/driver-compile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// 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

// RUN: rm -rf %t && mkdir -p %t/DISTINCTIVE-PATH/usr/bin/
// RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/DISTINCTIVE-PATH/usr/bin/swiftc)
// RUN: ln -s "swiftc" %t/DISTINCTIVE-PATH/usr/bin/swift-update
// 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
// RUN: %FileCheck -check-prefix UPDATE-CODE %s < %t.upd.txt
Expand Down
2 changes: 1 addition & 1 deletion test/Driver/linker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
// RUN: mkdir -p %t/DISTINCTIVE-PATH/usr/bin/
// RUN: touch %t/DISTINCTIVE-PATH/usr/bin/ld
// RUN: chmod +x %t/DISTINCTIVE-PATH/usr/bin/ld
// RUN: ln %swift_driver_plain %t/DISTINCTIVE-PATH/usr/bin/swiftc
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/DISTINCTIVE-PATH/usr/bin/swiftc)
// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc %s -### | %FileCheck -check-prefix=RELATIVE-LINKER %s

// RELATIVE-LINKER: /DISTINCTIVE-PATH/usr/bin/swift
Expand Down
2 changes: 1 addition & 1 deletion test/Driver/options-repl-darwin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// RUN: mkdir -p %t/usr/bin/
// RUN: touch %t/usr/bin/lldb
// RUN: chmod +x %t/usr/bin/lldb
// RUN: ln %swift_driver_plain %t/usr/bin/swift
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s

Expand Down
2 changes: 1 addition & 1 deletion test/Driver/options-repl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
// RUN: mkdir -p %t/usr/bin/
// RUN: touch %t/usr/bin/lldb
// RUN: chmod +x %t/usr/bin/lldb
// RUN: ln %swift_driver_plain %t/usr/bin/swift
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
12 changes: 9 additions & 3 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ config.llvm_link = inferSwiftBinary('llvm-link')
config.swift_llvm_opt = inferSwiftBinary('swift-llvm-opt')
config.llvm_profdata = inferSwiftBinary('llvm-profdata')
config.llvm_cov = inferSwiftBinary('llvm-cov')
config.filecheck = inferSwiftBinary('FileCheck')

config.swift_utils = os.path.join(config.swift_src_root, 'utils')
config.line_directive = os.path.join(config.swift_utils, 'line-directive')
Expand Down Expand Up @@ -950,6 +951,10 @@ config.substitutions.append(('%target-ld', config.target_ld))
if hasattr(config, 'target_cc_options'):
config.substitutions.append(('%target-cc-options', config.target_cc_options))

config.substitutions.append(
(r'%hardlink-or-copy\(from: *(.*), *to: *(.*)\)',
r'ln \1 \2 || cp \1 \2'))

config.substitutions.append(('%utils', config.swift_utils))
config.substitutions.append(('%line-directive', config.line_directive))
config.substitutions.append(('%gyb', config.gyb))
Expand Down Expand Up @@ -1003,11 +1008,12 @@ config.substitutions.append(('%llvm-cov', config.llvm_cov))

config.substitutions.append(
('%FileCheck',
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\'' %
'%s --sanitize \'BUILD_DIR=%s\' --sanitize \'SOURCE_DIR=%s\' --use-filecheck \'%s\'' %
(config.PathSanitizingFileCheck,
pipes.quote(swift_obj_root),
pipes.quote(config.swift_src_root))))
config.substitutions.append(('%raw-FileCheck', 'FileCheck'))
pipes.quote(config.swift_src_root),
pipes.quote(config.filecheck))))
config.substitutions.append(('%raw-FileCheck', pipes.quote(config.filecheck)))

# If static stdlib is present, enable static stdlib tests
static_stdlib_path = os.path.join(os.path.join(config.swift_lib_dir,"swift_static"), config.target_sdk_name)
Expand Down
3 changes: 2 additions & 1 deletion test/stdlib/POSIX.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-run-simple-swift
// RUN: %target-run-simple-swift %t
// REQUIRES: executable_test

// Android Bionic does not provide a working implementation of
Expand All @@ -12,6 +12,7 @@ import StdlibUnittest
import Darwin
#endif

chdir(CommandLine.arguments[1])

var POSIXTests = TestSuite("POSIXTests")

Expand Down
10 changes: 9 additions & 1 deletion utils/PathSanitizingFileCheck
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ constants.""")
dest="sanitize_strings",
default=[])

parser.add_argument(
"--use-filecheck",
help="path to LLVM FileCheck executable",
metavar="PATH",
action="store",
dest="file_check_path",
default="FileCheck")

args, unknown_args = parser.parse_known_args()

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

p = subprocess.Popen(["FileCheck"] + unknown_args, stdin=subprocess.PIPE)
p = subprocess.Popen([args.file_check_path] + unknown_args, stdin=subprocess.PIPE)
stdout, stderr = p.communicate(stdin)
if stdout is not None:
print(stdout)
Expand Down