Add error handling to test fixtures

Adds support for customizing the error handling behavior of test
fixtures and converts a test to use it.

Bug: 181070625
Test: m nothing
Change-Id: I736c41311819d57d8688fc3b0e021dbb50c491c1
This commit is contained in:
Paul Duffin
2021-02-27 11:59:02 +00:00
parent 4416350471
commit cfd3374da0
5 changed files with 218 additions and 106 deletions

View File

@@ -202,6 +202,18 @@ type ExcludeFromVisibilityEnforcementTag interface {
ExcludeFromVisibilityEnforcement()
}
var PrepareForTestWithVisibilityRuleChecker = FixtureRegisterWithContext(func(ctx RegistrationContext) {
ctx.PreArchMutators(RegisterVisibilityRuleChecker)
})
var PrepareForTestWithVisibilityRuleGatherer = FixtureRegisterWithContext(func(ctx RegistrationContext) {
ctx.PreArchMutators(RegisterVisibilityRuleGatherer)
})
var PrepareForTestWithVisibilityRuleEnforcer = FixtureRegisterWithContext(func(ctx RegistrationContext) {
ctx.PostDepsMutators(RegisterVisibilityRuleEnforcer)
})
// The rule checker needs to be registered before defaults expansion to correctly check that
// //visibility:xxx isn't combined with other packages in the same list in any one module.
func RegisterVisibilityRuleChecker(ctx RegisterMutatorsContext) {