Skip to content

[build-script] Only build XCTest once #1506

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
Mar 5, 2016

Conversation

modocache
Copy link
Contributor

What's in this pull request?

Prior to swiftlang/swift-corelibs-xctest#57 and swiftlang/swift-corelibs-xctest#58, the swift-corelibs-xctest build script did not provide a way for an already built XCTest.so to be tested or installed. As a result, the Swift build script would build XCTest several times.

For example, the following invocation would build XCTest three separate times:

$ utils/build-script --xctest --test -- --install-xctest

Modifications to the XCTest build script now allow a prebuilt XCTest to be tested (via the build_script.py test subcommmand) and installed (via the build_script.py install subcommand). Use these in the Swift build script to build XCTest only once, then test and install the built version.

This pull request also:

  • Explicitly disables XCTest installation on OS X. XCTest's build_script.py only supports non-Darwin platforms, so running utils/build-script --xctest -- --install-xctest on OS X used to cause the build script to fail because of how that script invokes swiftc. It now fails with an explicit error indicating --install-xctest is unsupported.
  • Explicitly requires --install-destdir, as --install-swiftpm does.

Resolved bug number: None


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration. Please note that the XCTest installation step is not tested as part of continuous integration, and needs to be tested manually. I have tested it locally on OS X and Ubuntu 15.10 and can confirm that it works as expected.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

@modocache modocache force-pushed the build-script-xctest-fixmes branch from 8fa7f8c to 0979b61 Compare March 2, 2016 08:40
@gribozavr
Copy link
Contributor

@swift-ci Please test

echo "--- Installing ${product} ---"
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
XCTEST_INSTALL_PREFIX="${INSTALL_DESTDIR}"/"${INSTALL_PREFIX}"/lib/swift/"${LIB_TARGET}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use just one pair of quotes here, from start to end of the path?

@gribozavr
Copy link
Contributor

LGTM, let's see what CI says.

@modocache modocache force-pushed the build-script-xctest-fixmes branch from 0979b61 to 162812b Compare March 2, 2016 08:48
@modocache
Copy link
Contributor Author

@gribozavr Great! I also addressed your comment.

Prior to swiftlang/swift-corelibs-xctest#57 and
swiftlang/swift-corelibs-xctest#58, the
swift-corelibs-xctest build script did not provide a way an already
built XCTest.so to be tested or installed. As a result, the Swift
build script would build XCTest several times.

For example, the following invocation would build XCTest three separate
times:

```
$ utils/build-script --xctest --test -- --install-xctest
```

Modifications to the XCTest build script now allow a prebuilt XCTest to
be tested (via the `build_script.py test` subcommmand) and installed
(via the `build_script.py install` subcommand). Use these in the Swift
build script to build XCTest only once, then test and install the built
version.

Also, explicitly disable XCTest installation on OS X. XCTest's
`build_script.py` only supports non-Darwin platforms, so running
`utils/build-script --xctest -- --install-xctest` on OS X used to cause
the build script to fail because of how that script invokes `swiftc`.
It now fails with an explicit error indicating `--install-xctest` is
unsupported.
@modocache modocache force-pushed the build-script-xctest-fixmes branch from 162812b to 729e54f Compare March 2, 2016 08:52
@gribozavr
Copy link
Contributor

@swift-ci Please test

@modocache
Copy link
Contributor Author

The failure on Linux is unrelated, but it prevented the XCTest tests from running. XCTest tests on OS X have not yet been enabled on CI, I think @shahmishal is working on it (as evidenced here).

Let's try running them again soon, when master is greener? 😇

@shahmishal
Copy link
Member

@swift-ci Please test

@modocache
Copy link
Contributor Author

@gribozavr Looks like CI passed, although the OS X tests don't actually test XCTest. Personally I think that's fine--we'll use the preset from #1533 to test XCTest on OS X from now on. Shall I merge?

gribozavr added a commit that referenced this pull request Mar 5, 2016
@gribozavr gribozavr merged commit 80db9fb into swiftlang:master Mar 5, 2016
@modocache modocache deleted the build-script-xctest-fixmes branch March 5, 2016 06:10
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