diff options
author | Jaewoong Jung <jungjw@google.com> | 2019-07-18 12:17:26 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-07-18 12:17:26 -0700 |
commit | 29c01bf032bbecfb89e6dd3753ece7750a3ea7a9 (patch) | |
tree | d530b07d656984b04e221c00723aa59333f726b0 /java/java_test.go | |
parent | a363065b30e3f90d5739477f441fc557f2054602 (diff) | |
parent | 66bb414fb7aa8647828ee062bbc71322eec66147 (diff) |
Merge "Java test code clean-up"
am: 66bb414fb7
Change-Id: I69304bb2b589b5c415a5eb57cadc0833fd1be02e
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/java/java_test.go b/java/java_test.go index 96ecdb689..c22039fc7 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -57,8 +57,7 @@ func testConfig(env map[string]string) android.Config { return TestConfig(buildDir, env) } -func testContext(config android.Config, bp string, - fs map[string][]byte) *android.TestContext { +func testContext(bp string, fs map[string][]byte) *android.TestContext { ctx := android.NewTestArchContext() ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(AndroidAppFactory)) @@ -222,13 +221,13 @@ func run(t *testing.T, ctx *android.TestContext, config android.Config) { android.FailIfErrored(t, errs) } -func testJava(t *testing.T, bp string) *android.TestContext { +func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) { t.Helper() config := testConfig(nil) - ctx := testContext(config, bp, nil) + ctx := testContext(bp, nil) run(t, ctx, config) - return ctx + return ctx, config } func moduleToPath(name string) string { @@ -243,7 +242,7 @@ func moduleToPath(name string) string { } func TestSimple(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -287,7 +286,7 @@ func TestSimple(t *testing.T) { } func TestSdkVersion(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -313,7 +312,7 @@ func TestSdkVersion(t *testing.T) { } func TestArchSpecific(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -332,7 +331,7 @@ func TestArchSpecific(t *testing.T) { } func TestBinary(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library_host { name: "foo", srcs: ["a.java"], @@ -361,7 +360,7 @@ func TestBinary(t *testing.T) { } func TestPrebuilts(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -412,7 +411,7 @@ func TestPrebuilts(t *testing.T) { } func TestDefaults(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_defaults { name: "defaults", srcs: ["a.java"], @@ -558,7 +557,7 @@ func TestResources(t *testing.T) { for _, test := range table { t.Run(test.name, func(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: [ @@ -587,7 +586,7 @@ func TestResources(t *testing.T) { } func TestIncludeSrcs(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: [ @@ -650,7 +649,7 @@ func TestIncludeSrcs(t *testing.T) { } func TestGeneratedSources(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: [ @@ -683,7 +682,7 @@ func TestGeneratedSources(t *testing.T) { } func TestTurbine(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -732,7 +731,7 @@ func TestTurbine(t *testing.T) { } func TestSharding(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "bar", srcs: ["a.java","b.java","c.java"], @@ -750,7 +749,7 @@ func TestSharding(t *testing.T) { } func TestDroiddoc(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` droiddoc_template { name: "droiddoc-templates-sdk", path: ".", @@ -793,7 +792,7 @@ func TestDroiddoc(t *testing.T) { } func TestJarGenrules(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], @@ -847,7 +846,7 @@ func TestJarGenrules(t *testing.T) { } func TestExcludeFileGroupInSrcs(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` java_library { name: "foo", srcs: ["a.java", ":foo-srcs"], @@ -874,7 +873,7 @@ func TestExcludeFileGroupInSrcs(t *testing.T) { func TestJavaLibrary(t *testing.T) { config := testConfig(nil) - ctx := testContext(config, "", map[string][]byte{ + ctx := testContext("", map[string][]byte{ "libcore/Android.bp": []byte(` java_library { name: "core", @@ -886,7 +885,7 @@ func TestJavaLibrary(t *testing.T) { } func TestJavaSdkLibrary(t *testing.T) { - ctx := testJava(t, ` + ctx, _ := testJava(t, ` droiddoc_template { name: "droiddoc-templates-sdk", path: ".", @@ -1057,7 +1056,7 @@ func TestPatchModule(t *testing.T) { t.Run("Java language level 8", func(t *testing.T) { // Test default javac -source 1.8 -target 1.8 - ctx := testJava(t, bp) + ctx, _ := testJava(t, bp) checkPatchModuleFlag(t, ctx, "foo", "") checkPatchModuleFlag(t, ctx, "bar", "") @@ -1067,7 +1066,7 @@ func TestPatchModule(t *testing.T) { t.Run("Java language level 9", func(t *testing.T) { // Test again with javac -source 9 -target 9 config := testConfig(map[string]string{"EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9": "true"}) - ctx := testContext(config, bp, nil) + ctx := testContext(bp, nil) run(t, ctx, config) checkPatchModuleFlag(t, ctx, "foo", "") |