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

Add support for xtest packages in Go Packages Driver #3750

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

JamyDev
Copy link
Contributor

@JamyDev JamyDev commented Nov 10, 2023

What type of PR is this?

Feature

What does this PR do? Why is it needed?

xtests, also named external tests, are test cases that validate the public facing API of a package, even though the files are still located in the same package.

A sample folder structure:

code.go -> package code -> has both public and private methods/interfaces of things
code_test.go -> package code -> tests the private logic
code_ext_test.go -> package code_test -> tests the public API

From what I gather, the go compiler is happy to handle this since the package names are different, but when the Go packages driver runs its aspect, we'll get all of this in one FlatPackage (since they're part of the go_test rule) with the same package ID. This causes Go internally to mark the package code_test as inconsistent with the package code of the other test files.

The solution:

  • Read the package id field from any file that has an _test.go suffix, if it doesn't match the package id provided by the FlatPackage, separate it out into a list of external test files.
  • If we see that we have more than 0 xtestfiles, we create a new xtest package to add to the registry.
  • Finally, we need to ensure that this xtest package gets added to the roots if we created one. We do this unconditionally, since if you're trying to resolve the tests of a package, you'd likely also want the external tests.

@fmeum fmeum merged commit e9363db into bazelbuild:master Nov 13, 2023
2 checks passed
@JamyDev JamyDev deleted the feature/gpd-xtest-packages branch November 13, 2023 21:13
renovate bot added a commit to kreempuff/rules_unreal_engine that referenced this pull request Nov 20, 2023
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.42.0` -> `v0.43.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.43.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.43.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.42.0...v0.43.0)

#### Breaking `x/tools` upgrade

This change includes a breaking upgrade to
[golang.org/x/tools](https://pkg.go.dev/golang.org/x/tools)

Please make sure to upgrade `x/tools` to version `v0.15.0` to ensure
compatibility with rules_go's NoGo.

**If you need to use an older version of `x/tools` (`v0.13.0` or
earlier), apply the following patch to `rules_go`**:

[x-tools.patch](https://togithub.com/bazelbuild/rules_go/files/13417624/x-tools.patch)

#### What's Changed

- Test BCR test module on macos_arm64 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3715
- update documentation for `0.42.0` release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3716
- add netrc support to go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3718
- Temporarily disable Bzlmod explicitly by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3720
- Fix urls used to get auth in go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3724
- Include `go.env` in `//go` runfiles by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3722
- Update arm platform constraint to latest value in bazel. by
[@&#8203;BryanDClark](https://togithub.com/BryanDClark) in
[bazelbuild/rules_go#3734
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[bazelbuild/rules_go#3740
- upgrade tools by [@&#8203;hawkingrei](https://togithub.com/hawkingrei)
in
[bazelbuild/rules_go#3730
- Also take library deps like srcs into account in go context by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/rules_go#3725
- Add go_cross_binary to README by
[@&#8203;jfirebaugh](https://togithub.com/jfirebaugh) in
[bazelbuild/rules_go#3744
- Update `bazel_features` to v1.1.1 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3747
- builder: Make paths absolute for stdliblist
([#&#8203;1357](https://togithub.com/bazelbuild/rules_go/issues/1357))
by [@&#8203;zecke](https://togithub.com/zecke) in
[bazelbuild/rules_go#3748
- feat(gopackagesdriver): add base test case for go packages driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3743
- Fix bazel query scope not being used by
[@&#8203;rastenis](https://togithub.com/rastenis) in
[bazelbuild/rules_go#3688
- Add support for `xtest` packages in Go Packages Driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3750
- upgrade x/tools to 0.15.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3751
- bug fix: parse embeds in files that contain the double quote rune by
[@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/rules_go#3672
- prepare release 0.43.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3745

#### New Contributors

- [@&#8203;justinwon777](https://togithub.com/justinwon777) made their
first contribution in
[bazelbuild/rules_go#3718
- [@&#8203;BryanDClark](https://togithub.com/BryanDClark) made their
first contribution in
[bazelbuild/rules_go#3734
- [@&#8203;kotlaja](https://togithub.com/kotlaja) made their first
contribution in
[bazelbuild/rules_go#3740
- [@&#8203;rastenis](https://togithub.com/rastenis) made their first
contribution in
[bazelbuild/rules_go#3688
- [@&#8203;andyscott](https://togithub.com/andyscott) made their first
contribution in
[bazelbuild/rules_go#3672

**Full Changelog**:
bazelbuild/rules_go@v0.42.0...v0.43.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kreempuff/rules_unreal_engine).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
cgrindel-self-hosted-renovate bot added a commit to cgrindel/bazel-starlib that referenced this pull request Nov 20, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.42.0` -> `v0.43.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.43.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.43.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.42.0...v0.43.0)

#### Breaking `x/tools` upgrade

This change includes a breaking upgrade to
[golang.org/x/tools](https://pkg.go.dev/golang.org/x/tools)

Please make sure to upgrade `x/tools` to version `v0.15.0` to ensure
compatibility with rules_go's NoGo.

**If you need to use an older version of `x/tools` (`v0.13.0` or
earlier), apply the following patch to `rules_go`**:

[x-tools.patch](https://togithub.com/bazelbuild/rules_go/files/13417624/x-tools.patch)

#### What's Changed

- Test BCR test module on macos_arm64 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3715
- update documentation for `0.42.0` release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3716
- add netrc support to go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3718
- Temporarily disable Bzlmod explicitly by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3720
- Fix urls used to get auth in go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3724
- Include `go.env` in `//go` runfiles by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3722
- Update arm platform constraint to latest value in bazel. by
[@&#8203;BryanDClark](https://togithub.com/BryanDClark) in
[bazelbuild/rules_go#3734
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[bazelbuild/rules_go#3740
- upgrade tools by [@&#8203;hawkingrei](https://togithub.com/hawkingrei)
in
[bazelbuild/rules_go#3730
- Also take library deps like srcs into account in go context by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/rules_go#3725
- Add go_cross_binary to README by
[@&#8203;jfirebaugh](https://togithub.com/jfirebaugh) in
[bazelbuild/rules_go#3744
- Update `bazel_features` to v1.1.1 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3747
- builder: Make paths absolute for stdliblist
([#&#8203;1357](https://togithub.com/bazelbuild/rules_go/issues/1357))
by [@&#8203;zecke](https://togithub.com/zecke) in
[bazelbuild/rules_go#3748
- feat(gopackagesdriver): add base test case for go packages driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3743
- Fix bazel query scope not being used by
[@&#8203;rastenis](https://togithub.com/rastenis) in
[bazelbuild/rules_go#3688
- Add support for `xtest` packages in Go Packages Driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3750
- upgrade x/tools to 0.15.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3751
- bug fix: parse embeds in files that contain the double quote rune by
[@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/rules_go#3672
- prepare release 0.43.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3745

#### New Contributors

- [@&#8203;justinwon777](https://togithub.com/justinwon777) made their
first contribution in
[bazelbuild/rules_go#3718
- [@&#8203;BryanDClark](https://togithub.com/BryanDClark) made their
first contribution in
[bazelbuild/rules_go#3734
- [@&#8203;kotlaja](https://togithub.com/kotlaja) made their first
contribution in
[bazelbuild/rules_go#3740
- [@&#8203;rastenis](https://togithub.com/rastenis) made their first
contribution in
[bazelbuild/rules_go#3688
- [@&#8203;andyscott](https://togithub.com/andyscott) made their first
contribution in
[bazelbuild/rules_go#3672

**Full Changelog**:
bazelbuild/rules_go@v0.42.0...v0.43.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Nov 22, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io_bazel_rules_go](https://togithub.com/bazelbuild/rules_go) |
http_archive | minor | `v0.42.0` -> `v0.43.0` |

---

### Release Notes

<details>
<summary>bazelbuild/rules_go (io_bazel_rules_go)</summary>

###
[`v0.43.0`](https://togithub.com/bazelbuild/rules_go/releases/tag/v0.43.0)

[Compare
Source](https://togithub.com/bazelbuild/rules_go/compare/v0.42.0...v0.43.0)

#### Breaking `x/tools` upgrade

This change includes a breaking upgrade to
[golang.org/x/tools](https://pkg.go.dev/golang.org/x/tools)

Please make sure to upgrade `x/tools` to version `v0.15.0` to ensure
compatibility with rules_go's NoGo.

**If you need to use an older version of `x/tools` (`v0.13.0` or
earlier), apply the following patch to `rules_go`**:

[x-tools.patch](https://togithub.com/bazelbuild/rules_go/files/13417624/x-tools.patch)

#### What's Changed

- Test BCR test module on macos_arm64 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3715
- update documentation for `0.42.0` release by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3716
- add netrc support to go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3718
- Temporarily disable Bzlmod explicitly by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3720
- Fix urls used to get auth in go_download_sdk by
[@&#8203;justinwon777](https://togithub.com/justinwon777) in
[bazelbuild/rules_go#3724
- Include `go.env` in `//go` runfiles by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3722
- Update arm platform constraint to latest value in bazel. by
[@&#8203;BryanDClark](https://togithub.com/BryanDClark) in
[bazelbuild/rules_go#3734
- Add toolchain param to affected actions by
[@&#8203;kotlaja](https://togithub.com/kotlaja) in
[bazelbuild/rules_go#3740
- upgrade tools by [@&#8203;hawkingrei](https://togithub.com/hawkingrei)
in
[bazelbuild/rules_go#3730
- Also take library deps like srcs into account in go context by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/rules_go#3725
- Add go_cross_binary to README by
[@&#8203;jfirebaugh](https://togithub.com/jfirebaugh) in
[bazelbuild/rules_go#3744
- Update `bazel_features` to v1.1.1 by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/rules_go#3747
- builder: Make paths absolute for stdliblist
([#&#8203;1357](https://togithub.com/bazelbuild/rules_go/issues/1357))
by [@&#8203;zecke](https://togithub.com/zecke) in
[bazelbuild/rules_go#3748
- feat(gopackagesdriver): add base test case for go packages driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3743
- Fix bazel query scope not being used by
[@&#8203;rastenis](https://togithub.com/rastenis) in
[bazelbuild/rules_go#3688
- Add support for `xtest` packages in Go Packages Driver by
[@&#8203;JamyDev](https://togithub.com/JamyDev) in
[bazelbuild/rules_go#3750
- upgrade x/tools to 0.15.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3751
- bug fix: parse embeds in files that contain the double quote rune by
[@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/rules_go#3672
- prepare release 0.43.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/rules_go#3745

#### New Contributors

- [@&#8203;justinwon777](https://togithub.com/justinwon777) made their
first contribution in
[bazelbuild/rules_go#3718
- [@&#8203;BryanDClark](https://togithub.com/BryanDClark) made their
first contribution in
[bazelbuild/rules_go#3734
- [@&#8203;kotlaja](https://togithub.com/kotlaja) made their first
contribution in
[bazelbuild/rules_go#3740
- [@&#8203;rastenis](https://togithub.com/rastenis) made their first
contribution in
[bazelbuild/rules_go#3688
- [@&#8203;andyscott](https://togithub.com/andyscott) made their first
contribution in
[bazelbuild/rules_go#3672

**Full Changelog**:
bazelbuild/rules_go@v0.42.0...v0.43.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
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.

None yet

2 participants