bazel-contrib / SIG-rules-authors

Governance and admin for the rules authors Special Interest Group
https://bazel-contrib.github.io/SIG-rules-authors/
Apache License 2.0
28 stars 12 forks source link

Provide a general facility for bazel-in-bazel integration testing #25

Closed alexeagle closed 2 years ago

alexeagle commented 2 years ago

Broken out from https://github.com/bazel-contrib/SIG-rules-authors/issues/11

Summary from that issue:

I'd love for the SIG to figure out what ought to be done, likely reviewing the recent implementation by @cgrindel

alexeagle commented 2 years ago

To avoid churn on developers and keep the ecosystem as simple as possible, my preference would be to make bazelbuild/bazel-integration-testing fit the current need, rather than make a new repo.

jsharpe commented 2 years ago

One thing that I've particularly found challenging to test is different spawn_strategies; in rules_foreign_cc we added a specific configuration to test this but abused the fact that building in -c dbg gives a different cache key as the spawn_strategy isn't factored into the cache key. This means a local spawn_strategy can pick up the build cache from a sandboxed execution run and so doesn't give confidence in the testing of the given strategy; a reliable way of testing this would be great.

aherrmann commented 2 years ago

We've recently reviewed the bazel-in-bazel testing options for rules_haskell.

Ideally, we'd have both the testing against multiple versions and the incremental tests. As far as I understand most of the setup of the persistent repository happens inside go_bazel_test's test runner. So, perhaps one could get the best of both worlds by using rules_bazel_integration_test with go_bazel_test's test runner.

That said, go_bazel_test currently always uses the same path for the persistent repository. It may be better to use separate directories for each Bazel version.

gravypod commented 2 years ago

Do either of the existing integration testing libraries have the ability to hook into a RBE environment? We may also want to be able to test permutations of (host_platform, build_platform, target_platform) to make sure cross compiling features work. This is something we need to be careful about in rules_docker.

cgrindel commented 2 years ago

The rules_bazel_integration_test does not have anything that explicitly supports RBE. My understanding is that selection of the various platforms is driven by the flags passed to Bazel or by defaults determined by the host system. So, with Bazel integration tests, are we talking about having the primary Bazel (i.e., the one driving the tests) being given the appropriate flags, or are we talking about executing the "test" Bazel with the appropriate flags (i.e., making the RBE calls)? If the latter, then we would need to pass along RBE configuration to the "test" Bazel. What do you think would need to be added to support this well?

ittaiz commented 2 years ago

Bazel-integration-testing works with RBE. Don't remember what I needed to get it done but it was hard :)

alexeagle commented 2 years ago

https://github.com/bazel-contrib/rules_bazel_integration_test is now in bazel-contrib, so this should solve the general case.