Skip to content

For testing on Android #200

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
Sep 14, 2017
Merged

For testing on Android #200

merged 1 commit into from
Sep 14, 2017

Conversation

johnno1962
Copy link
Contributor

Hi Apple,

These are the changes I’ve used to build XCTest for Android. I don’t know if you have other plans for Package.swift as it was but I figure since there are no version tags on this repo it cannot be used anyway.

Cheers.

@@ -59,7 +59,9 @@ internal class PrintObserver: XCTestObservation {

fileprivate func printAndFlush(_ message: String) {
print(message)
#if !os(Android)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the background for this? Is this function missing from Bionic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s the absense of stdout which causes the compilation error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Further discussion of this change here)

@briancroom
Copy link
Contributor

Hey @johnno1962, thanks for the PR!

I'd be interested in hearing more about the workflow you're using where you make use of this. In this situation, is XCTest is building against the copy of Foundation from the Swift toolchain? If so, why not take XCTest from the toolchain as well?

@johnno1962
Copy link
Contributor Author

Hi @briancroom, I’m having to roll my own XCTest as I’m preparing a toolchain for Android (http://johnholdsworth.com/bothworlds.html) and I don’t believe the build scripts have been adapted for a cross compile of XCTest (I could be wrong there.) Once it’s built I copy the shared lib and .swiftmodule into the toolchain manually and package it up. I’m using the swift-robot-environment scritps for the build - https://github.com/gonzalolarralde/swifty-robot-environment.

Copy link

@xwu xwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some drive-by style nits.

Package.swift Outdated
let package = Package(name: "XCTest")
let package = Package(
name: "XCTest",
products:[
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: missing space between : and [

Package.swift Outdated
.library(
name: "XCTest",
type: .dynamic,
targets:["XCTest"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: missing space between : and [

Package.swift Outdated
],
targets: [
.target(name: "XCTest", dependencies: [], path: "Sources"),
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: de-indent ] to match the lines above (see, for example, the closing bracket after dependencies)

@briancroom
Copy link
Contributor

@xwu's whitespace comments are fair, and it would be good to address them before merging this, but otherwise I am fine with adding this.

In the future, it would be cool if we could get the test suite to be runnable via swift test as well, possibly by bridging to lit in some way.

@briancroom
Copy link
Contributor

With #201 merged, the remaining change here is just adding the Package.swift file. There's no point in running CI on that since it isn't involved in that build anyway.

@briancroom briancroom merged commit 2514212 into swiftlang:master Sep 14, 2017
@johnno1962
Copy link
Contributor Author

Thanks Brian 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants