Loading java/androidmk_test.go +11 −17 Original line number Diff line number Diff line Loading @@ -15,18 +15,20 @@ package java import ( "android/soong/android" "bytes" "io" "io/ioutil" "strings" "testing" "android/soong/android" ) type testAndroidMk struct { *testing.T body []byte } type testAndroidMkModule struct { *testing.T props map[string]string Loading Loading @@ -115,30 +117,26 @@ func getAndroidMk(t *testing.T, ctx *android.TestContext, config android.Config, } func TestRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], required: ["libfoo"], } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasRequired("libfoo") } func TestHostdex(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], hostdex: true, } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo") Loading @@ -146,16 +144,14 @@ func TestHostdex(t *testing.T) { } func TestHostdexRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], hostdex: true, required: ["libfoo"], } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasRequired("libfoo") Loading @@ -163,8 +159,7 @@ func TestHostdexRequired(t *testing.T) { } func TestHostdexSpecificRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], Loading @@ -175,8 +170,7 @@ func TestHostdexSpecificRequired(t *testing.T) { }, }, } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasNoRequired("libfoo") Loading java/app_test.go +21 −21 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ var ( } ) func testAppContext(config android.Config, bp string, fs map[string][]byte) *android.TestContext { func testAppContext(bp string, fs map[string][]byte) *android.TestContext { appFS := map[string][]byte{} for k, v := range fs { appFS[k] = v Loading @@ -53,13 +53,13 @@ func testAppContext(config android.Config, bp string, fs map[string][]byte) *and appFS[file] = nil } return testContext(config, bp, appFS) return testContext(bp, appFS) } func testApp(t *testing.T, bp string) *android.TestContext { config := testConfig(nil) ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -176,7 +176,7 @@ func TestResourceDirs(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { config := testConfig(nil) ctx := testContext(config, fmt.Sprintf(bp, testCase.prop), fs) ctx := testContext(fmt.Sprintf(bp, testCase.prop), fs) run(t, ctx, config) module := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -388,7 +388,7 @@ func TestAndroidResources(t *testing.T) { config.TestProductVariables.EnforceRROExcludedOverlays = testCase.enforceRROExcludedOverlays } ctx := testAppContext(config, bp, fs) ctx := testAppContext(bp, fs) run(t, ctx, config) resourceListToFiles := func(module android.TestingModule, list []string) (files []string) { Loading Loading @@ -515,7 +515,7 @@ func TestAppSdkVersion(t *testing.T) { config.TestProductVariables.Platform_sdk_codename = &test.platformSdkCodename config.TestProductVariables.Platform_sdk_final = &test.platformSdkFinal ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -547,7 +547,7 @@ func TestAppSdkVersion(t *testing.T) { } func TestJNIABI(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", system_shared_libs: [], Loading Loading @@ -620,7 +620,7 @@ func TestJNIABI(t *testing.T) { } func TestJNIPackaging(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", system_shared_libs: [], Loading Loading @@ -774,7 +774,7 @@ func TestCertificates(t *testing.T) { if test.certificateOverride != "" { config.TestProductVariables.CertificateOverrides = []string{test.certificateOverride} } ctx := testAppContext(config, test.bp, nil) ctx := testAppContext(test.bp, nil) run(t, ctx, config) foo := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -832,7 +832,7 @@ func TestPackageNameOverride(t *testing.T) { if test.packageNameOverride != "" { config.TestProductVariables.PackageNameOverrides = []string{test.packageNameOverride} } ctx := testAppContext(config, test.bp, nil) ctx := testAppContext(test.bp, nil) run(t, ctx, config) foo := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -865,7 +865,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) { ` config := testConfig(nil) config.TestProductVariables.ManifestPackageNameOverrides = []string{"foo:org.dandroid.bp"} ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading @@ -879,7 +879,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) { } func TestOverrideAndroidApp(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -980,7 +980,7 @@ func TestOverrideAndroidApp(t *testing.T) { } func TestOverrideAndroidAppDependency(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -1021,7 +1021,7 @@ func TestOverrideAndroidAppDependency(t *testing.T) { } func TestAndroidAppImport(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading Loading @@ -1050,7 +1050,7 @@ func TestAndroidAppImport(t *testing.T) { } func TestAndroidAppImport_NoDexPreopt(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading @@ -1071,7 +1071,7 @@ func TestAndroidAppImport_NoDexPreopt(t *testing.T) { } func TestAndroidAppImport_Presigned(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading Loading @@ -1166,7 +1166,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { config := testConfig(nil) config.TestProductVariables.AAPTPreferredConfig = test.aaptPreferredConfig config.TestProductVariables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading @@ -1183,7 +1183,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { } func TestStl(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", } Loading Loading @@ -1286,7 +1286,7 @@ func TestUsesLibraries(t *testing.T) { config := testConfig(nil) config.TestProductVariables.MissingUsesLibraries = []string{"baz"} ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -1398,7 +1398,7 @@ func TestCodelessApp(t *testing.T) { } func TestEmbedNotice(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -1549,7 +1549,7 @@ func TestUncompressDex(t *testing.T) { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) } ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading java/device_host_converter_test.go +2 −6 Original line number Diff line number Diff line Loading @@ -50,9 +50,7 @@ func TestDeviceForHost(t *testing.T) { } ` config := testConfig(nil) ctx := testContext(config, bp, nil) run(t, ctx, config) ctx, config := testJava(t, bp) deviceModule := ctx.ModuleForTests("device_module", "android_common") deviceTurbineCombined := deviceModule.Output("turbine-combined/device_module.jar") Loading Loading @@ -133,9 +131,7 @@ func TestHostForDevice(t *testing.T) { } ` config := testConfig(nil) ctx := testContext(config, bp, nil) run(t, ctx, config) ctx, config := testJava(t, bp) hostModule := ctx.ModuleForTests("host_module", config.BuildOsCommonVariant) hostJavac := hostModule.Output("javac/host_module.jar") Loading java/dexpreopt_bootjars_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ func TestDexpreoptBootJars(t *testing.T) { dexpreoptConfig.RuntimeApexJars = []string{"foo", "bar", "baz"} setDexpreoptTestGlobalConfig(config, dexpreoptConfig) ctx := testContext(config, bp, nil) ctx := testContext(bp, nil) ctx.RegisterSingletonType("dex_bootjars", android.SingletonFactoryAdaptor(dexpreoptBootJarsFactory)) Loading java/dexpreopt_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ func TestDexpreoptEnabled(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { ctx := testJava(t, test.bp) ctx, _ := testJava(t, test.bp) dexpreopt := ctx.ModuleForTests("foo", "android_common").MaybeDescription("dexpreopt") enabled := dexpreopt.Rule != nil Loading Loading
java/androidmk_test.go +11 −17 Original line number Diff line number Diff line Loading @@ -15,18 +15,20 @@ package java import ( "android/soong/android" "bytes" "io" "io/ioutil" "strings" "testing" "android/soong/android" ) type testAndroidMk struct { *testing.T body []byte } type testAndroidMkModule struct { *testing.T props map[string]string Loading Loading @@ -115,30 +117,26 @@ func getAndroidMk(t *testing.T, ctx *android.TestContext, config android.Config, } func TestRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], required: ["libfoo"], } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasRequired("libfoo") } func TestHostdex(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], hostdex: true, } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo") Loading @@ -146,16 +144,14 @@ func TestHostdex(t *testing.T) { } func TestHostdexRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], hostdex: true, required: ["libfoo"], } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasRequired("libfoo") Loading @@ -163,8 +159,7 @@ func TestHostdexRequired(t *testing.T) { } func TestHostdexSpecificRequired(t *testing.T) { config := testConfig(nil) ctx := testContext(config, ` ctx, config := testJava(t, ` java_library { name: "foo", srcs: ["a.java"], Loading @@ -175,8 +170,7 @@ func TestHostdexSpecificRequired(t *testing.T) { }, }, } `, nil) run(t, ctx, config) `) mk := getAndroidMk(t, ctx, config, "foo") mk.moduleFor("foo").hasNoRequired("libfoo") Loading
java/app_test.go +21 −21 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ var ( } ) func testAppContext(config android.Config, bp string, fs map[string][]byte) *android.TestContext { func testAppContext(bp string, fs map[string][]byte) *android.TestContext { appFS := map[string][]byte{} for k, v := range fs { appFS[k] = v Loading @@ -53,13 +53,13 @@ func testAppContext(config android.Config, bp string, fs map[string][]byte) *and appFS[file] = nil } return testContext(config, bp, appFS) return testContext(bp, appFS) } func testApp(t *testing.T, bp string) *android.TestContext { config := testConfig(nil) ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -176,7 +176,7 @@ func TestResourceDirs(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { config := testConfig(nil) ctx := testContext(config, fmt.Sprintf(bp, testCase.prop), fs) ctx := testContext(fmt.Sprintf(bp, testCase.prop), fs) run(t, ctx, config) module := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -388,7 +388,7 @@ func TestAndroidResources(t *testing.T) { config.TestProductVariables.EnforceRROExcludedOverlays = testCase.enforceRROExcludedOverlays } ctx := testAppContext(config, bp, fs) ctx := testAppContext(bp, fs) run(t, ctx, config) resourceListToFiles := func(module android.TestingModule, list []string) (files []string) { Loading Loading @@ -515,7 +515,7 @@ func TestAppSdkVersion(t *testing.T) { config.TestProductVariables.Platform_sdk_codename = &test.platformSdkCodename config.TestProductVariables.Platform_sdk_final = &test.platformSdkFinal ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -547,7 +547,7 @@ func TestAppSdkVersion(t *testing.T) { } func TestJNIABI(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", system_shared_libs: [], Loading Loading @@ -620,7 +620,7 @@ func TestJNIABI(t *testing.T) { } func TestJNIPackaging(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", system_shared_libs: [], Loading Loading @@ -774,7 +774,7 @@ func TestCertificates(t *testing.T) { if test.certificateOverride != "" { config.TestProductVariables.CertificateOverrides = []string{test.certificateOverride} } ctx := testAppContext(config, test.bp, nil) ctx := testAppContext(test.bp, nil) run(t, ctx, config) foo := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -832,7 +832,7 @@ func TestPackageNameOverride(t *testing.T) { if test.packageNameOverride != "" { config.TestProductVariables.PackageNameOverrides = []string{test.packageNameOverride} } ctx := testAppContext(config, test.bp, nil) ctx := testAppContext(test.bp, nil) run(t, ctx, config) foo := ctx.ModuleForTests("foo", "android_common") Loading Loading @@ -865,7 +865,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) { ` config := testConfig(nil) config.TestProductVariables.ManifestPackageNameOverrides = []string{"foo:org.dandroid.bp"} ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading @@ -879,7 +879,7 @@ func TestInstrumentationTargetOverridden(t *testing.T) { } func TestOverrideAndroidApp(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -980,7 +980,7 @@ func TestOverrideAndroidApp(t *testing.T) { } func TestOverrideAndroidAppDependency(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -1021,7 +1021,7 @@ func TestOverrideAndroidAppDependency(t *testing.T) { } func TestAndroidAppImport(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading Loading @@ -1050,7 +1050,7 @@ func TestAndroidAppImport(t *testing.T) { } func TestAndroidAppImport_NoDexPreopt(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading @@ -1071,7 +1071,7 @@ func TestAndroidAppImport_NoDexPreopt(t *testing.T) { } func TestAndroidAppImport_Presigned(t *testing.T) { ctx := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", Loading Loading @@ -1166,7 +1166,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { config := testConfig(nil) config.TestProductVariables.AAPTPreferredConfig = test.aaptPreferredConfig config.TestProductVariables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading @@ -1183,7 +1183,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) { } func TestStl(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` cc_library { name: "libjni", } Loading Loading @@ -1286,7 +1286,7 @@ func TestUsesLibraries(t *testing.T) { config := testConfig(nil) config.TestProductVariables.MissingUsesLibraries = []string{"baz"} ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading Loading @@ -1398,7 +1398,7 @@ func TestCodelessApp(t *testing.T) { } func TestEmbedNotice(t *testing.T) { ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+` android_app { name: "foo", srcs: ["a.java"], Loading Loading @@ -1549,7 +1549,7 @@ func TestUncompressDex(t *testing.T) { config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true) } ctx := testAppContext(config, bp, nil) ctx := testAppContext(bp, nil) run(t, ctx, config) Loading
java/device_host_converter_test.go +2 −6 Original line number Diff line number Diff line Loading @@ -50,9 +50,7 @@ func TestDeviceForHost(t *testing.T) { } ` config := testConfig(nil) ctx := testContext(config, bp, nil) run(t, ctx, config) ctx, config := testJava(t, bp) deviceModule := ctx.ModuleForTests("device_module", "android_common") deviceTurbineCombined := deviceModule.Output("turbine-combined/device_module.jar") Loading Loading @@ -133,9 +131,7 @@ func TestHostForDevice(t *testing.T) { } ` config := testConfig(nil) ctx := testContext(config, bp, nil) run(t, ctx, config) ctx, config := testJava(t, bp) hostModule := ctx.ModuleForTests("host_module", config.BuildOsCommonVariant) hostJavac := hostModule.Output("javac/host_module.jar") Loading
java/dexpreopt_bootjars_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ func TestDexpreoptBootJars(t *testing.T) { dexpreoptConfig.RuntimeApexJars = []string{"foo", "bar", "baz"} setDexpreoptTestGlobalConfig(config, dexpreoptConfig) ctx := testContext(config, bp, nil) ctx := testContext(bp, nil) ctx.RegisterSingletonType("dex_bootjars", android.SingletonFactoryAdaptor(dexpreoptBootJarsFactory)) Loading
java/dexpreopt_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ func TestDexpreoptEnabled(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { ctx := testJava(t, test.bp) ctx, _ := testJava(t, test.bp) dexpreopt := ctx.ModuleForTests("foo", "android_common").MaybeDescription("dexpreopt") enabled := dexpreopt.Rule != nil Loading