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

Commit ceed6be0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Pass Config to NewTestContext instead of ctx.Register"

parents 33e7f6a0 ae8600b5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -80,10 +80,10 @@ func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testin
	config := TestConfig(buildDir, nil, bp, nil)
	config.inMake = true // Enable androidmk Singleton

	ctx := NewTestContext()
	ctx := NewTestContext(config)
	ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
	ctx.RegisterModuleType("custom", customModuleFactory)
	ctx.Register(config)
	ctx.Register()

	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
	FailIfErrored(t, errs)
@@ -252,10 +252,10 @@ func TestGetDistForGoals(t *testing.T) {
		config := TestConfig(buildDir, nil, testCase.bp, nil)
		config.inMake = true // Enable androidmk Singleton

		ctx := NewTestContext()
		ctx := NewTestContext(config)
		ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
		ctx.RegisterModuleType("custom", customModuleFactory)
		ctx.Register(config)
		ctx.Register()

		_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
		FailIfErrored(t, errs)
+4 −4
Original line number Diff line number Diff line
@@ -353,9 +353,9 @@ func TestArchMutator(t *testing.T) {
		t.Run(tt.name, func(t *testing.T) {
			config := TestArchConfig(buildDir, nil, bp, nil)

			ctx := NewTestArchContext()
			ctx := NewTestArchContext(config)
			ctx.RegisterModuleType("module", archTestModuleFactory)
			ctx.Register(config)
			ctx.Register()
			if tt.config != nil {
				tt.config(config)
			}
@@ -442,9 +442,9 @@ func TestArchMutatorNativeBridge(t *testing.T) {
		t.Run(tt.name, func(t *testing.T) {
			config := TestArchConfigNativeBridge(buildDir, nil, bp, nil)

			ctx := NewTestArchContext()
			ctx := NewTestArchContext(config)
			ctx.RegisterModuleType("module", archTestModuleFactory)
			ctx.Register(config)
			ctx.Register()
			if tt.config != nil {
				tt.config(config)
			}
+2 −2
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ import (
func testCSuiteConfig(test *testing.T, bpFileContents string) *TestContext {
	config := TestArchConfig(buildDir, nil, bpFileContents, nil)

	ctx := NewTestArchContext()
	ctx := NewTestArchContext(config)
	ctx.RegisterModuleType("csuite_config", CSuiteConfigFactory)
	ctx.Register(config)
	ctx.Register()
	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
	FailIfErrored(test, errs)
	_, errs = ctx.PrepareBuildActions(config)
+4 −4
Original line number Diff line number Diff line
@@ -80,14 +80,14 @@ func TestDefaults(t *testing.T) {

	config := TestConfig(buildDir, nil, bp, nil)

	ctx := NewTestContext()
	ctx := NewTestContext(config)

	ctx.RegisterModuleType("test", defaultsTestModuleFactory)
	ctx.RegisterModuleType("defaults", defaultsTestDefaultsFactory)

	ctx.PreArchMutators(RegisterDefaultsPreArchMutators)

	ctx.Register(config)
	ctx.Register()

	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
	FailIfErrored(t, errs)
@@ -125,7 +125,7 @@ func TestDefaultsAllowMissingDependencies(t *testing.T) {
	config := TestConfig(buildDir, nil, bp, nil)
	config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true)

	ctx := NewTestContext()
	ctx := NewTestContext(config)
	ctx.SetAllowMissingDependencies(true)

	ctx.RegisterModuleType("test", defaultsTestModuleFactory)
@@ -133,7 +133,7 @@ func TestDefaultsAllowMissingDependencies(t *testing.T) {

	ctx.PreArchMutators(RegisterDefaultsPreArchMutators)

	ctx.Register(config)
	ctx.Register()

	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
	FailIfErrored(t, errs)
+3 −4
Original line number Diff line number Diff line
@@ -164,9 +164,6 @@ func depsModuleFactory() Module {
}

func TestErrorDependsOnDisabledModule(t *testing.T) {
	ctx := NewTestContext()
	ctx.RegisterModuleType("deps", depsModuleFactory)

	bp := `
		deps {
			name: "foo",
@@ -180,7 +177,9 @@ func TestErrorDependsOnDisabledModule(t *testing.T) {

	config := TestConfig(buildDir, nil, bp, nil)

	ctx.Register(config)
	ctx := NewTestContext(config)
	ctx.RegisterModuleType("deps", depsModuleFactory)
	ctx.Register()

	_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
	FailIfErrored(t, errs)
Loading