Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Add Windows Support - #117

Merged
achew22 merged 15 commits into
masterfrom
add-windows-support
Mar 15, 2019
Merged

achew22 merged 15 commits into
masterfrom
add-windows-support

Conversation

@meteorcloudy

Copy link
Copy Markdown
Member

Inspired by #96, I also gave it a try.
I enabled all tests but BazelBaseTestCaseTest because it tries to run Bazel from a directory path longer than 260 characters, which caused the following error:

Executing tests from //:IntegrationTestSuiteTest/bazel0.23.2
-----------------------------------------------------------------------------
Error: Current working directory has a path longer than allowed for a
Win32 working directory.
Can't start native Windows application from here.

external/bazel_tools/tools/test/test-setup.sh: line 232: C:/src/tmp/l7b3czla/execroot/build_bazel_integration_testing/_tmp/b8fc8754c3be87e0fe08dc8ef9e1fd51/ajlaysar/execroot/build_bazel_integration_testing/bazel-out/x64_windows-fastbuild/bin/IntegrationTestSuiteTest/bazel0.23.2.exe: File name too long
/c/src/tmp/l7b3czla/execroot/build_bazel_integration_testing/_tmp/b8fc8754c3be87e0fe08dc8ef9e1fd51/ajlaysar/execroot/build_bazel_integration_testing/bazel-out/x64_windows-fastbuild/testlogs/IntegrationTestSuiteTest/bazel0.23.2/test.log (END)

@laszlocsomor Does the native test wrapper supports running Bazel from a long path? Maybe it could help fix this issue.

Another test case testRepositoryCacheIsFrozen in WorkspaceDriverIntegrationTest.java depends on the WorkspaceDriver.freeze(). The freeze() function doesn't work on Windows, and there is basically no way to prevent other process writing to a directory. So I cannot find any other way to freeze the cache. I worked around this by changing the url to a non-existing host which caused a "Unknown host" error to be caught. @ittaiz @hchauvin Is this ok with you?

@laszlocsomor

laszlocsomor commented Mar 13, 2019 •

Copy link
Copy Markdown

@laszlocsomor Does the native test wrapper supports running Bazel from a long path? Maybe it could help fix this issue.

No.

CreateProcessW fails with 206 (ERROR_FILENAME_EXCED_RANGE) if the program's path in lpCommandLine is long, or with 267 (ERROR_DIRECTORY) if the lpCurrentDirectory is long.

@meteorcloudy

Copy link
Copy Markdown
Member Author

@ittaiz @hchauvin This change is ready for review, the tests are passing on Windows.

One question, do we actually need the freeze function in WorkspaceDriver? Because I cannot find any way to implement that on Windows.

@meteorcloudy
meteorcloudy requested review from achew22 and philwo March 13, 2019 15:18

@achew22 achew22 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks really good! A couple of minor nits and then let's merge it

}
}
repositoryCache.freeze();
// repositoryCache.freeze();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rm?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm waiting @ittaiz 's comment on this. If repositoryCache.freeze() is only for testing testRepositoryCacheIsFrozen, I think we can just remove it. Because I changed the url in testRepositoryCacheIsFrozen to a unknown host, which would produce the expected error on all platform.

],
# We had to disable this test on Windows because it will fail due to running Bazel
# from a path longer than 256 charactors.
tags = ["no_windows"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you file an issue for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Better than that, I figured out a workaround ;)

],
# Ensure that there could be no network fetch in sandboxing. This tag is a Bazel
# built-in, it is important to keep it.
tags = ["block-network"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you need to remove this tag? Does this make it not hermetic?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because with newer version of Bazel, WorkspaceDriverIntegrationTest will fail with "unknown host" when it tries to access "mirror.bazel.build", I'm not sure how to deal with this without removing this "block-network" tag. @ittaiz Can you give some instructions?

@achew22

achew22 commented Mar 14, 2019

Copy link
Copy Markdown
Member

To me this is good to merge. I'm going to give @ittaiz 24 hours (March 15th at 1pm PDT, 4pm EDT) then I'll submit this. After that I'll update the iBazel binary to the latest version and push out a 0.10 release that theoretically works with windows 😄

GREAT work!

@achew22

achew22 commented Mar 15, 2019

Copy link
Copy Markdown
Member

Turns out I have a bunch of stuff going on that would prevent me from doing this until tomorrow afternoon unless I do it now and we are pretty close to the deadline I prescribed. If there is an issue with this then I think we should do a follow up pr. Thanks so much for sending this in! Merging

@achew22
achew22 merged commit bb9623b into master Mar 15, 2019
@achew22
achew22 deleted the add-windows-support branch March 15, 2019 19:11
@ittaiz

ittaiz commented Mar 15, 2019

Copy link
Copy Markdown
Member

Finally taking a look. I think we will have a few issues. I'll mention them here even though it's merged

@ittaiz

ittaiz commented Mar 15, 2019

Copy link
Copy Markdown
Member

Update- we have one main issue with the repositoryCache.freeze and the test.

@ittaiz

ittaiz commented Mar 15, 2019

Copy link
Copy Markdown
Member

another update- this PR introduced a significant issue in the form of downloading remote_jdk.
Since 0.21 Bazel will try by default to download a remote jdk unless instructed otherwise. When @meteorcloudy changed (and effectively removed) the frozen repository cache test they actually removed the one test that verified this library works with network isolation.

This issue happened because this PR did a couple of things since a PR that only updated the versions surfaced this issue PR, log.

I'm working on a solution but it's not baked in yet.
@cushon @lberki,
If I need to run bazel in a test with network isolation would you recommend passing JavaRuntimeInfo.java_home and then using --host_javabase=@bazel_tools//tools/jdk:absolute_javabase with a --define=ABSOLUTE_JAVABASE= which will point to the path I pass from the outside (dir in runfiles)?
Is there a simpler solution?
Thanks!

@meteorcloudy

Copy link
Copy Markdown
Member Author

@ittaiz Thanks for looking into the issues, sorry I didn't consider it in advance, please tell me if I can help with anything!

@ittaiz

ittaiz commented Mar 18, 2019 via email

Copy link
Copy Markdown
Member

@ittaiz ittaiz mentioned this pull request Apr 1, 2019
This was referenced Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants