Skip to content
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

Explicitly disable bzlmod for rust_analyzer tests #3124

Closed
wants to merge 1 commit into from

Conversation

sam-mccall
Copy link
Contributor

It already isn't using bzlmod (the runner creates WORKSPACE.bazel),
making this explicit allows the tests to be run under bazel 8.

(Some work would be required to make test/3rdparty work with bazelmod,
I don't understand what.)

It already isn't using bzlmod (the runner creates WORKSPACE.bazel),
making this explicit allows the tests to be run under bazel 8.

(Some work would be required to make test/3rdparty work with bazelmod,
I don't understand what.)
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

What failures do you see? I can take a stab at converting this.

@sam-mccall
Copy link
Contributor Author

Thanks! When trying to run gen_rust_project in the generated workspace: ERROR: Skipping '@rules_rust//tools/rust_analyzer:gen_rust_project': No repository visible as '@rules_rust' from main repository.

This seems to be because we're generating WORKSPACE.bazel, but --enable_workspace is off by default.

(Oops, this is in fact with bazel 7.4.1)

$ bazel --version

bazel 7.4.1

$ bazel run //test/rust_analyzer:rust_analyzer_test

Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Analyzing: target //test/rust_analyzer:rust_analyzer_test (0 packages loaded, 0 targets configured)
Analyzing: target //test/rust_analyzer:rust_analyzer_test (0 packages loaded, 0 targets configured)

INFO: Analyzed target //test/rust_analyzer:rust_analyzer_test (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //test/rust_analyzer:rust_analyzer_test up-to-date:
  bazel-bin/test/rust_analyzer/rust_analyzer_test
INFO: Elapsed time: 0.066s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/test/rust_analyzer/rust_analyzer_test test/rust_analyzer
Generated workspace: /tmp/rules_rust_test_rust_analyzer-gOTGz6p0Gr/rules_rust_test_rust_analyzer
Testing 'aspect_traversal_test'
Generating rust-project.json...
Starting local Bazel server and connecting to it...
Computing main repo mapping: 
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958.
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '@rules_rust//tools/rust_analyzer:gen_rust_project': No repository visible as '@rules_rust' from main repository
WARNING: No targets found to run. Will continue anyway
ERROR: Failed to parse target pattern even though it was previously parsed successfully: No repository visible as '@rules_rust' from main repository
INFO: Elapsed time: 4.569s, Critical Path: 0.00s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@UebelAndre
Copy link
Collaborator

Should be resolved by #3125. Let me know if that unblocks your testing!

@sam-mccall
Copy link
Contributor Author

sam-mccall commented Dec 19, 2024

Thanks, that works for me!

In fact one of the tests fails for me (the generated_srcs test), but I think it's showing a real bug, I'll try to fix it.

I'm a bit puzzled as to how this is all passing on CI (I'm using the same version as .bazelversion locally)...

@UebelAndre
Copy link
Collaborator

Thanks, that works for me!

In fact one of the tests fails for me (the generated_srcs test), but I think it's showing a real bug, I'll try to fix it.

I'm a bit puzzled as to how this is all passing on CI (I'm using the same version as .bazelversion locally)...

I just pushed another change to make sure the .bazelversion file is copied into the test workspace. But running this on MacOS it seems to pass as is. I also injected an intentional failure and that was raised appropriately so it seems the infra is at least minimally working.

@UebelAndre
Copy link
Collaborator

Closing in favor of #3125

@UebelAndre UebelAndre closed this Dec 20, 2024
@sam-mccall
Copy link
Contributor Author

sam-mccall commented Dec 20, 2024

Thanks, that works for me!
In fact one of the tests fails for me (the generated_srcs test), but I think it's showing a real bug, I'll try to fix it.

I've filed it as #3126, I know how to make the test pass but I don't know how to fix the bug :-(

I'm a bit puzzled as to how this is all passing on CI (I'm using the same version as .bazelversion locally)...

I just pushed another change to make sure the .bazelversion file is copied into the test workspace. But running this on MacOS it seems to pass as is. I also injected an intentional failure and that was raised appropriately so it seems the infra is at least minimally working.

It looks like it's nondeterministic in principle, but stable in practice on a given machine.
Based on the order that aquery returns its results, the test will pass or fail.
(I think the output is not really correct either way, but making it consistent would help!)

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