Merge "Convert testDexpreoptBoot to use test fixtures" am: a8c443618a am: 34fc4cf2fb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1629622

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5f6eb23663c51bf0024d03c8ce739647cd778113
This commit is contained in:
Paul Duffin
2021-03-12 13:04:31 +00:00
committed by Automerger Merge Worker

View File

@@ -16,7 +16,6 @@ package java
import (
"path/filepath"
"reflect"
"sort"
"testing"
@@ -44,17 +43,11 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
}
`
config := testConfig(nil, bp, nil)
result := javaFixtureFactory.
Extend(dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar", "platform:baz")).
RunTestWithBp(t, bp)
pathCtx := android.PathContextForTesting(config)
dexpreoptConfig := dexpreopt.GlobalConfigForTests(pathCtx)
dexpreoptConfig.BootJars = android.CreateTestConfiguredJarList([]string{"platform:foo", "platform:bar", "platform:baz"})
dexpreopt.SetTestGlobalConfig(config, dexpreoptConfig)
ctx := testContext(config)
run(t, ctx, config)
dexpreoptBootJars := ctx.SingletonForTests("dex_bootjars")
dexpreoptBootJars := result.SingletonForTests("dex_bootjars")
rule := dexpreoptBootJars.Output(ruleFile)
for i := range expectedInputs {
@@ -73,13 +66,9 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
sort.Strings(outputs)
sort.Strings(expectedOutputs)
if !reflect.DeepEqual(inputs, expectedInputs) {
t.Errorf("want inputs %q\n got inputs %q", expectedInputs, inputs)
}
result.AssertDeepEquals("inputs", expectedInputs, inputs)
if !reflect.DeepEqual(outputs, expectedOutputs) {
t.Errorf("want outputs %q\n got outputs %q", expectedOutputs, outputs)
}
result.AssertDeepEquals("outputs", expectedOutputs, outputs)
}
func TestDexpreoptBootJars(t *testing.T) {