Skip to content

Fix functional build tests for swiftpm target #24

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

Closed
wants to merge 1 commit into from

Conversation

onevcat
Copy link
Contributor

@onevcat onevcat commented Dec 4, 2015

Problem

All of the FunctionalBuildTests is now failing when testing in Xcode with Cmd+U.

It seems that the executable file swift-build is placed under .build/.bootstrap/bin. At the same time, the Resources.computeResourcesPaths() is using "SPM_INSTALL_PATH" environment variable to search the built product. However, the install path is set to $(PROJECT_DIR)/../.build. This leads the correct executable could not be found and the default swift-build is returned.

So invoking of executeSwiftBuild(_:) will always fail if the swift-build could not be found in system search path. Even it is there, the executable might be an older one instead of newly built file. This might not be the expected behavior.

snip20151205_5

Fix

Simply changing the "SPM_INSTALL_PATH" from $(PROJECT_DIR)/../.build to $(PROJECT_DIR)/../.build/.bootstrap would solve it and make all tests green.

snip20151205_4

P.S.

Everything goes well when using bootstrap script.

./Utilities/bootstrap --build-tests test

Since the sandbox_path is set correctly.

sandbox_path = os.path.join(build_path, ".bootstrap")
# ...
env_cmd = ["env",
                   "SWIFTC=" + opts.swiftc_path,
                   "SWIFT_BUILD_TOOL=" + opts.sbt_path,
                   "SPM_INSTALL_PATH=" + sandbox_path]

@mxcl
Copy link
Contributor

mxcl commented Dec 4, 2015

/cc @ddunbar

@mxcl
Copy link
Contributor

mxcl commented Dec 4, 2015

Thanks, we have decided to instead add a symlink to debug as part of those dep’s test script phases because we want the second phase swift-build to run these tests rather than the bootstrapped swift-build.

mxcl added a commit that referenced this pull request Dec 4, 2015
To avoid a hack in the source code (checking for the build-time directory) we added a hack to the dep-tests target.

Refs #24
@mxcl mxcl closed this Dec 4, 2015
@mxcl
Copy link
Contributor

mxcl commented Dec 4, 2015

But thank you for the detailed report and the time you spent fixing it.

@onevcat onevcat deleted the fix/install-path-for-test branch December 8, 2015 09:43
aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
[swift-binding] Update bindings to swift 3
sergiocampama pushed a commit that referenced this pull request Apr 20, 2020
Introduce a new HashAlgorithm protocol and make SHA256 conform to it
MaxDesiatov pushed a commit to MaxDesiatov/swift-package-manager that referenced this pull request Jul 6, 2020
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.

2 participants