-
Notifications
You must be signed in to change notification settings - Fork 205
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
Make compat tests work on windows #5732
Conversation
f57ba5d
to
63e1481
Compare
dca045c
to
827c4b2
Compare
827c4b2
to
06a18d8
Compare
This required some changes to the daml_sdk rule since the read-only installation by the assistant breaks Bazel completely. We could only apply those changes on Windows but I think I prefer the consistency across platforms here over trying to stay close to how the SDK is installed on user machines given that the SDK installation is not something we’ve had issues with. I’ve excluded the postgresql tests for now. I don’t expect them to be particularly hard to fix but I’ve already spent almost 2 days on this and having some tests run on Windows seems like a clear improvement over running no tests on Windows :) changelog_begin changelog_end
06a18d8
to
b01a6d0
Compare
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.
Thank you for making this work!
# Note (MK): This is a fun one: Let’s say $TEST_WORKSPACE is "compatibility" | ||
# and the argument points to a target from an external workspace, e.g., | ||
# @daml-sdk-0.0.0//:daml. Then the short path will point to | ||
# ../daml-sdk-0.0.0/daml. Putting things together we end up with | ||
# compatibility/../daml-sdk-0.0.0/daml. On Linux and MacOS this works | ||
# just fine. However, on windows we need to normalize the path | ||
# or rlocation will fail to find the path in the manifest file. | ||
rlocation $(realpath -L -s -m --relative-to=$PWD $TEST_WORKSPACE/$1) |
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.
Yes, this is a very unfortunate aspect of the runfiles mechanism. Another solution is to pass in the rootpath instead of the short path. Sadly that requires extra hoops to jump through. In this case it looks like all those are Target
s and have Label
s. So, you could call expand_location
to obtain the $(rootpath)
.
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.
I’ll leave it for now since this seems to work and I’m scared to touch it now 😨
stripPrefix = "sdk-{}".format(ctx.attr.version), | ||
) | ||
elif ctx.attr.sdk_sha256: | ||
ctx.download_and_extract( | ||
output = "extracted-sdk", | ||
output = out_dir, | ||
# TODO (MK) Make this work on other platforms. |
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.
Can that todo note be removed?
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.
🤦 removed
# The DAML assistant will mark the installed SDK read-only. | ||
# This breaks Bazel horribly on Windows to the point where | ||
# even `bazel clean --expunge` fails because it cannot remove | ||
# the installed SDK. Therefore, we do not use the assistant to | ||
# install the SDK but instead simply extract the SDK to the right | ||
# location and set the symlink ourselves. |
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.
Hmm, isn't there a risk of these tests testing something else than what users what experience? E.g. if the DAML assistant performs some configuration at installation at some point. Would it work to remove the read-only flag after install? Maybe in a trap to avoid leaving the bazel tree in a bad state if installation fails.
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.
Yes there is a small risk here but after having spend way too much time trying to make this work otherwise, this seemed like the most reasonable option to me. Testing the SDK installation isn’t really a compatibility thing anyway and we do still have the actual SDK integration tests for that (at least for now).
changelog_begin changelog_end
This required some changes to the daml_sdk rule since the read-only
installation by the assistant breaks Bazel completely. We could only
apply those changes on Windows but I think I prefer the consistency
across platforms here over trying to stay close to how the SDK is
installed on user machines given that the SDK installation is not
something we’ve had issues with.
I’ve excluded the postgresql tests for now. I don’t expect them to be
particularly hard to fix but I’ve already spent almost 2 days on this
and having some tests run on Windows seems like a clear improvement
over running no tests on Windows :)
changelog_begin
changelog_end
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.