Skip to content

Commit

Permalink
Merge pull request #25 from aciidb0mb3r/elim-need-for-pkg
Browse files Browse the repository at this point in the history
Add test for blocks support
  • Loading branch information
aciidgh committed Oct 23, 2017
2 parents 751b73d + 12a8b11 commit 01eecd5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
24 changes: 17 additions & 7 deletions lit.cfg
Expand Up @@ -120,11 +120,14 @@ if lit_config.params.get("have-network"):

# Get the package path.
package_path = lit_config.params.get("package-path")
if package_path is None:
# If a package wasn't provided, use the current selected toolchain on Darwin.
if platform.system() == "Darwin":
package_path = os.path.abspath(
os.path.join(subprocess.check_output(["xcrun", "--find", "swift"]).strip(), "../../../"))
if package_path is None:
lit_config.fatal("'--param package-path=PATH' is required")
package_path = os.path.abspath(package_path)
# if platform.system() == "Darwin":
# package_path = os.path.join(package_path, "Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
lit_config.note("testing package: %r" % (package_path,))

# Find the path to FileCheck. We just pick any one out of the build directory.
Expand Down Expand Up @@ -177,7 +180,10 @@ if not os.path.exists(swiftc_path):
if not os.path.exists(filecheck_path):
lit_config.fatal("filecheck does not exist!")
if not os.path.exists(lldb_path):
lit_config.fatal("lldb does not exist!")
if platform.system() == "Darwin":
lldb_path = subprocess.check_output(["xcrun", "--find", "lldb"]).strip()
else:
lit_config.fatal("lldb does not exist!")

# Define our supported substitutions.
config.substitutions.append( ('%{not}', os.path.join(srcroot, "not")) )
Expand All @@ -186,13 +192,17 @@ config.substitutions.append( ('%{swift}', swift_path) )
config.substitutions.append( ('%{swiftc}', swiftc_path) )
config.substitutions.append( ('%{FileCheck}', filecheck_path) )

# Add a substitution for swiftpm build directory. This is useful for
# running the integration tests locally, for e.g. by changing:
# %{swift} build -> %{swiftpm_build}/swift-build
# Add substitutions for swiftpm executables.
swiftpm_build = lit_config.params.get("swiftpm-build")
if swiftpm_build is not None:
config.substitutions.append( ('%{swiftpm_build}', swiftpm_build) )
lit_config.note("testing using swiftpm build directory: {}".format(swiftpm_build))
config.substitutions.append( ('%{swift-build}', os.path.join(swiftpm_build, "swift-build")) )
config.substitutions.append( ('%{swift-test}', os.path.join(swiftpm_build, "swift-test")) )
config.substitutions.append( ('%{swift-run}', os.path.join(swiftpm_build, "swift-run")) )
else:
config.substitutions.append( ('%{swift-build}', swift_path + ' build') )
config.substitutions.append( ('%{swift-test}', swift_path + ' test') )
config.substitutions.append( ('%{swift-run}', swift_path + ' run') )

###

Expand Down
6 changes: 5 additions & 1 deletion test-complex-xctest-package/SwiftCMixed/Sources/see/see.c
@@ -1,5 +1,9 @@
#include "see.h"

int (^simpleBlock)(int) = ^(int a){
return a+1;
};

int foo() {
return 5;
return simpleBlock(4);
}
@@ -1,4 +1,5 @@
import see
import Dispatch

func swiftyFoo() -> Int {
return Int(foo())
Expand Down
2 changes: 1 addition & 1 deletion test-complex-xctest-package/test-xctest-package.txt
Expand Up @@ -4,7 +4,7 @@
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir
// RUN: cp -r %S/SwiftCMixed %t.dir/
// RUN: %{swift} test --package-path %t.dir/SwiftCMixed -v 2>&1 | tee %t.build-log
// RUN: %{swift-test} --package-path %t.dir/SwiftCMixed -v 2>&1 | tee %t.build-log
//
// Check the build log.
//
Expand Down

0 comments on commit 01eecd5

Please sign in to comment.