Skip to content

Commit 12a7e77

Browse files
authored
Merge pull request #570 from artemcm/IntegratedSnake3
[Integrated Tests] Invoke `lit.py` using python3
2 parents 2ac054a + 8f60d0a commit 12a7e77

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,8 @@ extension Driver {
23472347
}
23482348

23492349
var appliesToFetchingTargetInfo: Bool {
2350-
return overridePath?.basename != "Python"
2350+
return overridePath?.basename != "Python" &&
2351+
overridePath?.basename != "python3"
23512352
}
23522353
func setUpForTargetInfo(_ toolchain: Toolchain) {
23532354
if !appliesToFetchingTargetInfo {

Tests/SwiftDriverTests/IntegrationTests.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ private func bundleRoot() -> AbsolutePath {
2323

2424
private let packageDirectory = AbsolutePath(#file).parentDirectory.parentDirectory.parentDirectory
2525

26+
// The "default" here means lit.py will be invoked as an executable, while otherwise let's use
27+
// python 3 explicitly.
28+
private let pythonExec = ProcessEnv.vars.keys.contains("SWIFT_DRIVER_INTEGRATION_TESTS_USE_PYTHON_DEFAULT") ? "" : "python3"
29+
2630
func makeDriverSymlinks(
2731
in tempDir: AbsolutePath,
2832
with swiftBuildDir: AbsolutePath? = nil
@@ -207,6 +211,7 @@ final class IntegrationTests: IntegrationTestCase {
207211
"--param", "swift_driver",
208212
testDir.pathString
209213
]
214+
let commandArgs = pythonExec.isEmpty ? args : [pythonExec] + args
210215

211216
let extraEnv = [
212217
"SWIFT": swift.pathString,
@@ -215,10 +220,10 @@ final class IntegrationTests: IntegrationTestCase {
215220
"LC_ALL": "en_US.UTF-8"
216221
]
217222

218-
printCommand(args: args, extraEnv: extraEnv)
223+
printCommand(args: commandArgs, extraEnv: extraEnv)
219224

220225
let process = TSCBasic.Process(
221-
arguments: args,
226+
arguments: commandArgs,
222227
environment: ProcessEnv.vars.merging(extraEnv) { $1 },
223228
outputRedirection: .none
224229
)

0 commit comments

Comments
 (0)