@@ -120,11 +120,14 @@ if lit_config.params.get("have-network"):
120
120
121
121
# Get the package path.
122
122
package_path = lit_config .params .get ("package-path" )
123
+ if package_path is None :
124
+ # If a package wasn't provided, use the current selected toolchain on Darwin.
125
+ if platform .system () == "Darwin" :
126
+ package_path = os .path .abspath (
127
+ os .path .join (subprocess .check_output (["xcrun" , "--find" , "swift" ]).strip (), "../../../" ))
123
128
if package_path is None :
124
129
lit_config .fatal ("'--param package-path=PATH' is required" )
125
130
package_path = os .path .abspath (package_path )
126
- # if platform.system() == "Darwin":
127
- # package_path = os.path.join(package_path, "Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
128
131
lit_config .note ("testing package: %r" % (package_path ,))
129
132
130
133
# Find the path to FileCheck. We just pick any one out of the build directory.
@@ -177,7 +180,10 @@ if not os.path.exists(swiftc_path):
177
180
if not os .path .exists (filecheck_path ):
178
181
lit_config .fatal ("filecheck does not exist!" )
179
182
if not os .path .exists (lldb_path ):
180
- lit_config .fatal ("lldb does not exist!" )
183
+ if platform .system () == "Darwin" :
184
+ lldb_path = subprocess .check_output (["xcrun" , "--find" , "lldb" ]).strip ()
185
+ else :
186
+ lit_config .fatal ("lldb does not exist!" )
181
187
182
188
# Define our supported substitutions.
183
189
config .substitutions .append ( ('%{not}' , os .path .join (srcroot , "not" )) )
@@ -186,13 +192,17 @@ config.substitutions.append( ('%{swift}', swift_path) )
186
192
config .substitutions .append ( ('%{swiftc}' , swiftc_path ) )
187
193
config .substitutions .append ( ('%{FileCheck}' , filecheck_path ) )
188
194
189
- # Add a substitution for swiftpm build directory. This is useful for
190
- # running the integration tests locally, for e.g. by changing:
191
- # %{swift} build -> %{swiftpm_build}/swift-build
195
+ # Add substitutions for swiftpm executables.
192
196
swiftpm_build = lit_config .params .get ("swiftpm-build" )
193
197
if swiftpm_build is not None :
194
- config .substitutions .append ( ('%{swiftpm_build}' , swiftpm_build ) )
195
198
lit_config .note ("testing using swiftpm build directory: {}" .format (swiftpm_build ))
199
+ config .substitutions .append ( ('%{swift-build}' , os .path .join (swiftpm_build , "swift-build" )) )
200
+ config .substitutions .append ( ('%{swift-test}' , os .path .join (swiftpm_build , "swift-test" )) )
201
+ config .substitutions .append ( ('%{swift-run}' , os .path .join (swiftpm_build , "swift-run" )) )
202
+ else :
203
+ config .substitutions .append ( ('%{swift-build}' , swift_path + ' build' ) )
204
+ config .substitutions .append ( ('%{swift-test}' , swift_path + ' test' ) )
205
+ config .substitutions .append ( ('%{swift-run}' , swift_path + ' run' ) )
196
206
197
207
###
198
208
0 commit comments