Generate classpaths.proto config for *CLASSPATH variables.
Instead of embedding "raw" values from PRODUCT_*_CLASSPATH variables into /etc/classpath, encode them into classpaths.proto binary format. Existing platform_bootclasspath{} module is used to generate the whole monolithic config to begin with. Later, the config will be split among individual bootclasspath_fragment and systemserverclasspath_fragment modules. Bug: 180105615 Test: m && launch_cvd Change-Id: Ia66f521f8976ff78a62ecf91131d26db21064de7
This commit is contained in:
@@ -132,6 +132,89 @@ func TestPlatformBootclasspath(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspathVariant(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
platform_bootclasspath {
|
||||
name: "platform-bootclasspath",
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
variants := result.ModuleVariantsForTests("platform-bootclasspath")
|
||||
android.AssertIntEquals(t, "expect 1 variant", 1, len(variants))
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspath_ClasspathFragmentPaths(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
platform_bootclasspath {
|
||||
name: "platform-bootclasspath",
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||
android.AssertStringEquals(t, "output filepath", p.Name()+".pb", p.ClasspathFragmentBase.outputFilepath.Base())
|
||||
android.AssertPathRelativeToTopEquals(t, "install filepath", "out/soong/target/product/test_device/system/etc/classpaths", p.ClasspathFragmentBase.installDirPath)
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspathModule_AndroidMkEntries(t *testing.T) {
|
||||
preparer := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
platform_bootclasspath {
|
||||
name: "platform-bootclasspath",
|
||||
}
|
||||
`),
|
||||
)
|
||||
|
||||
t.Run("AndroidMkEntries", func(t *testing.T) {
|
||||
result := preparer.RunTest(t)
|
||||
|
||||
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||
|
||||
entries := android.AndroidMkEntriesForTest(t, result.TestContext, p)
|
||||
android.AssertIntEquals(t, "AndroidMkEntries count", 2, len(entries))
|
||||
})
|
||||
|
||||
t.Run("hiddenapi-flags-entry", func(t *testing.T) {
|
||||
result := preparer.RunTest(t)
|
||||
|
||||
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||
|
||||
entries := android.AndroidMkEntriesForTest(t, result.TestContext, p)
|
||||
got := entries[0].OutputFile
|
||||
android.AssertBoolEquals(t, "valid output path", true, got.Valid())
|
||||
android.AssertSame(t, "output filepath", p.hiddenAPIFlagsCSV, got.Path())
|
||||
})
|
||||
|
||||
t.Run("classpath-fragment-entry", func(t *testing.T) {
|
||||
result := preparer.RunTest(t)
|
||||
|
||||
want := map[string][]string{
|
||||
"LOCAL_MODULE": {"platform-bootclasspath"},
|
||||
"LOCAL_MODULE_CLASS": {"ETC"},
|
||||
"LOCAL_INSTALLED_MODULE_STEM": {"platform-bootclasspath.pb"},
|
||||
// Output and Install paths are tested separately in TestPlatformBootclasspath_ClasspathFragmentPaths
|
||||
}
|
||||
|
||||
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
|
||||
|
||||
entries := android.AndroidMkEntriesForTest(t, result.TestContext, p)
|
||||
got := entries[1]
|
||||
for k, expectedValue := range want {
|
||||
if value, ok := got.EntryMap[k]; ok {
|
||||
android.AssertDeepEquals(t, k, expectedValue, value)
|
||||
} else {
|
||||
t.Errorf("No %s defined, saw %q", k, got.EntryMap)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestPlatformBootclasspath_Dist(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForTestWithPlatformBootclasspath,
|
||||
|
Reference in New Issue
Block a user