Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c3fec4c authored by Paul Duffin's avatar Paul Duffin
Browse files

Enable androidmk processing in sdk testing

Previously, while sdk tests would pass the sdk code would often fail
in androidmk processing. This change makes the tests more realistic
and will catch the errors earlier.

Bug: 142935992
Test: m nothing
Change-Id: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
parent 1ec3fce9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,11 @@ import (
)

func init() {
	RegisterSingletonType("androidmk", AndroidMkSingleton)
	RegisterAndroidMkBuildComponents(InitRegistrationContext)
}

func RegisterAndroidMkBuildComponents(ctx RegistrationContext) {
	ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
}

// Deprecated: consider using AndroidMkEntriesProvider instead, especially if you're not going to
+4 −0
Original line number Diff line number Diff line
@@ -410,6 +410,10 @@ func CheckErrorsAgainstExpectations(t *testing.T, errs []error, expectedErrorPat

}

func SetInMakeForTests(config Config) {
	config.inMake = true
}

func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) []AndroidMkEntries {
	var p AndroidMkEntriesProvider
	var ok bool
+10 −0
Original line number Diff line number Diff line
@@ -69,6 +69,16 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr

	ctx := android.NewTestArchContext()

	// Enable androidmk support.
	// * Register the singleton
	// * Configure that we are inside make
	// * Add CommonOS to ensure that androidmk processing works.
	android.RegisterAndroidMkBuildComponents(ctx)
	android.SetInMakeForTests(config)
	config.Targets[android.CommonOS] = []android.Target{
		{android.CommonOS, android.Arch{ArchType: android.Common}, android.NativeBridgeDisabled, "", ""},
	}

	// from android package
	android.RegisterPackageBuildComponents(ctx)
	ctx.PreArchMutators(android.RegisterVisibilityRuleChecker)