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

tests dont work on mac os #194

Closed
abrams27 opened this issue Sep 5, 2023 · 15 comments · Fixed by #202
Closed

tests dont work on mac os #194

abrams27 opened this issue Sep 5, 2023 · 15 comments · Fixed by #202
Assignees
Labels
bug Something isn't working

Comments

@abrams27
Copy link

abrams27 commented Sep 5, 2023

hi, recently we bumped the version of the rules (0.15.1 -> 0.16.0) and our tests started failing on mac os

I think #181 (comment) might be relevant

even ProcessBuilder().command(bazelBinary, "info") returns exit code 1

how to reproduce:

  1. clone https://github.com/JetBrains/bazel-bsp
  2. run bazel test //e2e:sample_repo_test_bazel_5_3_2
  3. on linux is should pass, on mac should fail
@cgrindel cgrindel added the bug Something isn't working label Sep 5, 2023
@cgrindel cgrindel self-assigned this Sep 5, 2023
@cgrindel
Copy link
Member

cgrindel commented Sep 5, 2023

I forked the bazel-bsp repo, cloned it on my Macbook Pro (x86_64) running MacOS 13.5.1, and ran bazel test //e2e:sample_repo_test_bazel_5_3_2. The test succeeded. What version of MacOS are you running?

@cgrindel
Copy link
Member

cgrindel commented Sep 5, 2023

I just ran the test on a GitHub MacOS runner. It worked there, as well.

@abrams27
Copy link
Author

abrams27 commented Sep 6, 2023

im using mac m2, so maybe it's arm thing?

@cgrindel
Copy link
Member

cgrindel commented Sep 6, 2023

Can you provide the error message that you are seeing?

@abrams27
Copy link
Author

abrams27 commented Sep 6, 2023

so for a runner:

#!/usr/bin/env bash

"$BIT_BAZEL_BINARY" info

it prints:

<path>/e2e/lol_bazel_6_3_2.runfiles/bazel_bsp/external/build_bazel_bazel_6_3_2/bazel_binary: line 23: <path>/e2e/lol_bazel_6_3_2.runfiles/bazel_binaries_bazelisk/bazelisk: cannot execute binary file
<path>/e2e/lol_bazel_6_3_2.runfiles/bazel_bsp/external/build_bazel_bazel_6_3_2/bazel_binary: line 23: <path>/e2e/lol_bazel_6_3_2.runfiles/bazel_binaries_bazelisk/bazelisk: Undefined error: 0

and apparently the tests dont work on fedora on arm as well

@tpasternak
Copy link

I don't know how does it look on Mac OS, but on Linux on Apple Sillicon the repository_ctx.os.arch is "aarch64" not "arm64"

https://github.com/bazel-contrib/rules_bazel_integration_test/blob/8988973cd583b5f944f5f753e7c0d9b8bc04d1a3/bazel_integration_test/private/bazel_binaries.bzl#L18C16-L18C16

@katre
Copy link
Collaborator

katre commented Sep 7, 2023

I just ran into the same problem on Mac ARM silicon, so I suspect the check in _download_bazelisk_binary is wrong.

This is tricky for me to reproduce, I don't have an intel or arm mac handy. It'd be nice if we had a canonical list of what repository_ctx.os could return.

@cgrindel
Copy link
Member

cgrindel commented Sep 7, 2023

I just pushed a PR and a branch that checks for aarch64 for MacOS. Could someone with an arm Mac give it a whirl?

@abrams27
Copy link
Author

abrams27 commented Sep 8, 2023

works on mac os m2, @tpasternak can you confirm on fedora?

@tpasternak
Copy link

No, because the PR changes only the mac os branch. It worked for me with this patch

--- a/bazel_integration_test/private/bazel_binaries.bzl
+++ b/bazel_integration_test/private/bazel_binaries.bzl
@@ -15,7 +15,7 @@ def _download_bazelisk_binary(repository_ctx, version):
 
     if os_name.startswith("linux") and arch_name.startswith("x86_64"):
         suffix = "linux-amd64"
-    elif os_name.startswith("linux") and arch_name.startswith("arm"):
+    elif os_name.startswith("linux") and arch_name.startswith("aarch64"):
         suffix = "linux-arm64"
     elif os_name.startswith("mac os") and arch_name.startswith("x86_64"):
         suffix = "darwin-amd64"

@tpasternak
Copy link

but I don't know about other devices. Maybe there are non-apple arm devices on which the combination linux/arm is valid

@katre
Copy link
Collaborator

katre commented Sep 8, 2023

We should probably just add helpers like _is_linux, _is_mac, _is_arm, etc.

Also, the default fallthrough to linux/x86_64 is probably wrong, and should just be a build failure (we'd want to add the capability from #184 so people can deal with this without submitting patches to this repo).

@cgrindel
Copy link
Member

cgrindel commented Sep 8, 2023

I added the helpers and change the fallthrough to a failure. Please take a look.

@tpasternak
Copy link

For me it's ok now

@abrams27
Copy link
Author

same here, thanks a lot!

cgrindel added a commit that referenced this issue Sep 12, 2023
- Refactor the checks to helper functions.
- Reliably identify arm and amd64 arches.

Related to #194.
cgrindel added a commit to k1nkreet/rules_bazel_integration_test that referenced this issue Sep 27, 2023
…ntrib#202)

- Refactor the checks to helper functions.
- Reliably identify arm and amd64 arches.

Related to bazel-contrib#194.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants