Remove uses of buildDir from java/app_set_test.go

Remove any uses, either direct (or indirect via testJavaConfig or
similar methods), of the package level buildDir variable from this
file.

Bug: 182885307
Test: m nothing
Change-Id: I64b13dcb310e0a0a2049b5e3b0ea0115e7e9c2f5
This commit is contained in:
Paul Duffin 2021-03-22 17:31:52 +00:00
parent fb8bc95199
commit f71e4ed326
1 changed files with 15 additions and 10 deletions

View File

@ -15,6 +15,7 @@
package java
import (
"fmt"
"reflect"
"testing"
@ -96,20 +97,24 @@ func TestAndroidAppSet_Variants(t *testing.T) {
}
for _, test := range testCases {
config := testAppConfig(nil, bp, nil)
config.TestProductVariables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI
config.TestProductVariables.Platform_sdk_version = &test.sdkVersion
ctx := android.GroupFixturePreparers(
PrepareForTestWithJavaDefaultModules,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.AAPTPrebuiltDPI = test.aaptPrebuiltDPI
variables.Platform_sdk_version = &test.sdkVersion
}),
android.FixtureModifyConfig(func(config android.Config) {
config.Targets[android.Android] = test.targets
ctx := testContext(config)
run(t, ctx, config)
}),
).RunTestWithBp(t, bp)
module := ctx.ModuleForTests("foo", "android_common")
const packedSplitApks = "foo.zip"
params := module.Output(packedSplitApks)
for k, v := range test.expected {
if actual := params.Args[k]; actual != v {
t.Errorf("%s: bad build arg value for '%s': '%s', expected '%s'",
test.name, k, actual, v)
}
t.Run(test.name, func(t *testing.T) {
android.AssertStringEquals(t, fmt.Sprintf("arg value for `%s`", k), v, params.Args[k])
})
}
}
}