-
Notifications
You must be signed in to change notification settings - Fork 205
Get Android to parity with upstream driver and enable remaining tests #720
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1689,13 +1689,13 @@ final class SwiftDriverTests: XCTestCase { | |
} | ||
|
||
func testSanitizerArgs() throws { | ||
// FIXME: This doesn't work on Linux. | ||
#if os(macOS) | ||
let commonArgs = [ | ||
"swiftc", "foo.swift", "bar.swift", | ||
"-emit-executable", "-target", "x86_64-apple-macosx10.9", | ||
"-module-name", "Test" | ||
] | ||
// FIXME: This doesn't work on Linux. | ||
#if os(macOS) | ||
do { | ||
// address sanitizer | ||
var driver = try Driver(args: commonArgs + ["-sanitize=address"]) | ||
|
@@ -1808,6 +1808,31 @@ final class SwiftDriverTests: XCTestCase { | |
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These linux tests above are disabled on linux, mistake or deliberate decision? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like they are enabled, only on Linux? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the enclosing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see. Hmm :/ |
||
#endif | ||
|
||
// FIXME: This test will fail when not run on Android, because the driver uses | ||
// the existence of the runtime support libraries to determine if | ||
// a sanitizer is supported. Until we allow cross-compiling with | ||
// sanitizers, this test is disabled outside Android. | ||
#if os(Android) | ||
do { | ||
var driver = try Driver( | ||
args: commonArgs + [ | ||
"-target", "aarch64-unknown-linux-android", "-sanitize=address" | ||
] | ||
) | ||
let plannedJobs = try driver.planBuild() | ||
|
||
XCTAssertEqual(plannedJobs.count, 4) | ||
|
||
let compileJob = plannedJobs[0] | ||
let compileCmd = compileJob.commandLine | ||
XCTAssertTrue(compileCmd.contains(.flag("-sanitize=address"))) | ||
|
||
let linkJob = plannedJobs[3] | ||
let linkCmd = linkJob.commandLine | ||
XCTAssertTrue(linkCmd.contains(.flag("-fsanitize=address"))) | ||
} | ||
#endif | ||
} | ||
|
||
func testSanitizerCoverageArgs() throws { | ||
|
@@ -2202,7 +2227,7 @@ final class SwiftDriverTests: XCTestCase { | |
func testModuleWrapJob() throws { | ||
// FIXME: These tests will fail when run on macOS, because | ||
// swift-autolink-extract is not present | ||
#if os(Linux) | ||
#if os(Linux) || os(Android) | ||
do { | ||
var driver = try Driver(args: ["swiftc", "-target", "x86_64-unknown-linux-gnu", "-g", "foo.swift"]) | ||
let plannedJobs = try driver.planBuild() | ||
|
@@ -2384,7 +2409,7 @@ final class SwiftDriverTests: XCTestCase { | |
let expectedDefaultContents: String | ||
#if os(macOS) | ||
expectedDefaultContents = "-apple-macosx" | ||
#elseif os(Linux) | ||
#elseif os(Linux) || os(Android) | ||
expectedDefaultContents = "-unknown-linux" | ||
#else | ||
expectedDefaultContents = "-" | ||
|
@@ -2670,7 +2695,7 @@ final class SwiftDriverTests: XCTestCase { | |
|
||
// FIXME: This will fail when run on macOS, because | ||
// swift-autolink-extract is not present | ||
#if os(Linux) | ||
#if os(Linux) || os(Android) | ||
do { | ||
var driver = try Driver(args: ["swiftc", "-profile-generate", "-target", "x86_64-unknown-linux-gnu", "test.swift"]) | ||
let plannedJobs = try driver.planBuild().removingAutolinkExtractJobs() | ||
|
@@ -3314,7 +3339,7 @@ final class SwiftDriverTests: XCTestCase { | |
serializer.writeDOT(to: &output) | ||
|
||
let dynamicLinker = driver.targetTriple.isDarwin ? "ld" : "clang" | ||
#if os(Linux) | ||
#if os(Linux) || os(Android) | ||
XCTAssertEqual(output, | ||
""" | ||
digraph Jobs { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a port of my earlier patch for the C++ driver.