Skip to content

Tests: adjust tests for Darwin #1684

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 1 commit into from
Aug 21, 2024
Merged
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
13 changes: 10 additions & 3 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7932,11 +7932,14 @@ final class SwiftDriverTests: XCTestCase {

func testAndroidNDK() throws {
try withTemporaryDirectory { path in
var env = ProcessEnv.vars
env["SWIFT_DRIVER_SWIFT_AUTOLINK_EXTRACT_EXEC"] = "/garbage/swift-autolink-extract"

do {
let sysroot = path.appending(component: "sysroot")
var driver = try Driver(args: [
"swiftc", "-target", "aarch64-unknown-linux-android", "-sysroot", sysroot.pathString, #file
])
], env: env)
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
let frontend = try XCTUnwrap(jobs.first)
XCTAssertTrue(frontend.commandLine.contains(subsequence: [
Expand All @@ -7946,7 +7949,7 @@ final class SwiftDriverTests: XCTestCase {
}

do {
var env = ProcessEnv.vars
var env = env
env["ANDROID_NDK_ROOT"] = path.appending(component: "ndk").nativePathString(escaped: false)

let sysroot = path.appending(component: "sysroot")
Expand All @@ -7961,10 +7964,12 @@ final class SwiftDriverTests: XCTestCase {
]))
}

// The default NDK prebuilts are x86_64 hosts only currently as if r27.
#if arch(x86_64)
do {
let sysroot = path.appending(component: "ndk")

var env = ProcessEnv.vars
var env = env
env["ANDROID_NDK_ROOT"] = sysroot.nativePathString(escaped: false)

#if os(Windows)
Expand All @@ -7980,11 +7985,13 @@ final class SwiftDriverTests: XCTestCase {
], env: env)
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
let frontend = try XCTUnwrap(jobs.first)
print(frontend.commandLine)
XCTAssertTrue(frontend.commandLine.contains(subsequence: [
.flag("-sysroot"),
.path(.absolute(sysroot.appending(components: "toolchains", "llvm", "prebuilt", "\(os)-x86_64", "sysroot"))),
]))
}
#endif
}
}

Expand Down