summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2020-10-29 17:09:13 -0700
committer Colin Cross <ccross@android.com> 2020-11-12 10:07:49 -0800
commitae8600b507416192f5134dfc068cd0eea4c4dc9e (patch)
tree3ab3ab614e28c71f461534f0969c39aa5c4edd8b /java/java_test.go
parent45e0c95f859d6ae3743a9971be8b43b91c3bd68f (diff)
Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 6c0a90856..2a27922d1 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -70,9 +70,9 @@ func testConfig(env map[string]string, bp string, fs map[string][]byte) android.
return config
}
-func testContext() *android.TestContext {
+func testContext(config android.Config) *android.TestContext {
- ctx := android.NewTestArchContext()
+ ctx := android.NewTestArchContext(config)
RegisterJavaBuildComponents(ctx)
RegisterAppBuildComponents(ctx)
RegisterAARBuildComponents(ctx)
@@ -115,7 +115,7 @@ func run(t *testing.T, ctx *android.TestContext, config android.Config) {
pathCtx := android.PathContextForTesting(config)
dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
- ctx.Register(config)
+ ctx.Register()
_, errs := ctx.ParseBlueprintsFiles("Android.bp")
android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)
@@ -129,12 +129,12 @@ func testJavaError(t *testing.T, pattern string, bp string) (*android.TestContex
func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config) (*android.TestContext, android.Config) {
t.Helper()
- ctx := testContext()
+ ctx := testContext(config)
pathCtx := android.PathContextForTesting(config)
dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
- ctx.Register(config)
+ ctx.Register()
_, errs := ctx.ParseBlueprintsFiles("Android.bp")
if len(errs) > 0 {
android.FailIfNoMatchingErrors(t, pattern, errs)
@@ -163,7 +163,7 @@ func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) {
func testJavaWithConfig(t *testing.T, config android.Config) (*android.TestContext, android.Config) {
t.Helper()
- ctx := testContext()
+ ctx := testContext(config)
run(t, ctx, config)
return ctx, config
@@ -1440,7 +1440,7 @@ func TestJavaLibrary(t *testing.T) {
}
`),
})
- ctx := testContext()
+ ctx := testContext(config)
run(t, ctx, config)
}
@@ -1458,7 +1458,7 @@ func TestJavaImport(t *testing.T) {
}
`),
})
- ctx := testContext()
+ ctx := testContext(config)
run(t, ctx, config)
}