Merge changes I0116f5f4,I950c9b54,I967f5c42 am: 4ab2dd1afe
am: 7ca753793f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1718475 Change-Id: I864c97d90aa8f2ec4e43ac9d39464ca257b608e2
This commit is contained in:
@@ -7461,6 +7461,80 @@ func TestHostApexInHostOnlyBuild(t *testing.T) {
|
||||
}))
|
||||
}
|
||||
|
||||
func TestApexJavaCoverage(t *testing.T) {
|
||||
bp := `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
java_libs: ["mylib"],
|
||||
bootclasspath_fragments: ["mybootclasspathfragment"],
|
||||
systemserverclasspath_fragments: ["mysystemserverclasspathfragment"],
|
||||
updatable: false,
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "mylib",
|
||||
srcs: ["mylib.java"],
|
||||
apex_available: ["myapex"],
|
||||
compile_dex: true,
|
||||
}
|
||||
|
||||
bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
contents: ["mybootclasspathlib"],
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "mybootclasspathlib",
|
||||
srcs: ["mybootclasspathlib.java"],
|
||||
apex_available: ["myapex"],
|
||||
compile_dex: true,
|
||||
}
|
||||
|
||||
systemserverclasspath_fragment {
|
||||
name: "mysystemserverclasspathfragment",
|
||||
contents: ["mysystemserverclasspathlib"],
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "mysystemserverclasspathlib",
|
||||
srcs: ["mysystemserverclasspathlib.java"],
|
||||
apex_available: ["myapex"],
|
||||
compile_dex: true,
|
||||
}
|
||||
`
|
||||
|
||||
result := android.GroupFixturePreparers(
|
||||
PrepareForTestWithApexBuildComponents,
|
||||
prepareForTestWithMyapex,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
android.PrepareForTestWithAndroidBuildComponents,
|
||||
android.FixtureWithRootAndroidBp(bp),
|
||||
android.FixtureMergeEnv(map[string]string{
|
||||
"EMMA_INSTRUMENT": "true",
|
||||
}),
|
||||
).RunTest(t)
|
||||
|
||||
// Make sure jacoco ran on both mylib and mybootclasspathlib
|
||||
if result.ModuleForTests("mylib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
|
||||
t.Errorf("Failed to find jacoco rule for mylib")
|
||||
}
|
||||
if result.ModuleForTests("mybootclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
|
||||
t.Errorf("Failed to find jacoco rule for mybootclasspathlib")
|
||||
}
|
||||
if result.ModuleForTests("mysystemserverclasspathlib", "android_common_apex10000").MaybeRule("jacoco").Rule == nil {
|
||||
t.Errorf("Failed to find jacoco rule for mysystemserverclasspathlib")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
Reference in New Issue
Block a user