Skip to content

[swift_snapshot_tool] Add support for SWIFT_LIBRARY_PATH so scripts has access to the .dylib path so they can run tests. #77411

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
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct BisectToolchains: AsyncParsableCommand {
commandName: "bisect",
discussion: """
Bisects on exit status of attached script. Passes in name of swift as the
environment variabless SWIFTC and SWIFT_FRONTEND
environment variables \(environmentVariables).
""")

@Flag var platform: Platform = .osx
Expand All @@ -22,8 +22,9 @@ struct BisectToolchains: AsyncParsableCommand {

@Option(
help: """
The script that should be run. The environment variable
SWIFT_EXEC is used by the script to know where swift-frontend is
The script that should be run. It runs a specific swift compilation and
optionally program using the passed in environment variables
\(environmentVariables)
""")
var script: String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ func downloadToolchainAndRunTest(

let swiftcPath = "\(toolchainDir)/usr/bin/swiftc"
let swiftFrontendPath = "\(toolchainDir)/usr/bin/swift-frontend"
// Just for now just support macosx.
let platform = "macosx"
let swiftLibraryPath = "\(toolchainDir)/usr/lib/swift/\(platform)"
log(shell("\(swiftcPath) --version").stdout)
let exitCode = shell(
"\(script)", environment: ["SWIFTC": swiftcPath, "SWIFT_FRONTEND": swiftFrontendPath],
"\(script)", environment: ["SWIFTC": swiftcPath, "SWIFT_FRONTEND": swiftFrontendPath,
"SWIFT_LIBRARY_PATH": swiftLibraryPath],
mustSucceed: false,
verbose: verbose,
extraArgs: extraArgs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===--- misc_global_strings.swift ----------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

let environmentVariables = "SWIFTC, SWIFT_FRONTEND, and SWIFT_LIBRARY_PATH"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ struct RunToolchains: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "run",
discussion: """
Run a toolchain like bisect would. Passes in name of swift as the
environment variabless SWIFTC and SWIFT_FRONTEND
""")
Run a toolchain like bisect would. Passed the environment variables:
\(environmentVariables)
""")

@Flag var platform: Platform = .osx

Expand Down