aboutsummaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-02-13 22:21:45 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-02-13 22:21:45 +0000
commitc9f9ab89a98c9f551b5c1305315942a50f368139 (patch)
tree5a94bb68234ceec14c9496df69e37fd94d939289 /java/java_test.go
parent8744cdffebeb0ff58e48eebae5b82541b8c90307 (diff)
parent6d415273c04e5b5fd449b14094c0fe4431b94a43 (diff)
Merge changes from topic "dex2oat-soong-dep-2"
* changes: Do all dexpreoptDisabled checks before registering a dex2oat host dep. Pass dexpreopt config structs by reference. Reland: Get the dex2oat host tool path from module dependency on the binary module. Reland: Move the Once cache for dexpreopt.GlobalConfig into the dexpreopt package. Reland: Separate dexpreopt.GlobalSoongConfig to allow independent caching of it.
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 17921ca44..a2226b59e 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -57,7 +57,15 @@ func TestMain(m *testing.M) {
}
func testConfig(env map[string]string, bp string, fs map[string][]byte) android.Config {
- return TestConfig(buildDir, env, bp, fs)
+ bp += dexpreopt.BpToolModulesForTest()
+
+ config := TestConfig(buildDir, env, bp, fs)
+
+ // Set up the global Once cache used for dexpreopt.GlobalSoongConfig, so that
+ // it doesn't create a real one, which would fail.
+ _ = dexpreopt.GlobalSoongConfigForTests(config)
+
+ return config
}
func testContext() *android.TestContext {
@@ -86,6 +94,8 @@ func testContext() *android.TestContext {
cc.RegisterRequiredBuildComponentsForTest(ctx)
ctx.RegisterModuleType("ndk_prebuilt_shared_stl", cc.NdkPrebuiltSharedStlFactory)
+ dexpreopt.RegisterToolModulesForTest(ctx)
+
return ctx
}
@@ -93,7 +103,7 @@ func run(t *testing.T, ctx *android.TestContext, config android.Config) {
t.Helper()
pathCtx := android.PathContextForTesting(config)
- setDexpreoptTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
+ dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
ctx.Register(config)
_, errs := ctx.ParseBlueprintsFiles("Android.bp")
@@ -112,7 +122,7 @@ func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config
ctx := testContext()
pathCtx := android.PathContextForTesting(config)
- setDexpreoptTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
+ dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
ctx.Register(config)
_, errs := ctx.ParseBlueprintsFiles("Android.bp")