Create sub tests for each test in TestJavaSdkLibraryEnforce am: aa6caa7fa8
am: 1094ec685f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1634625 Change-Id: I4ac34464a7f81461d3f6ad230ea81a8ee83fc9da
This commit is contained in:
commit
f2157304dd
|
@ -936,45 +936,55 @@ func TestJavaSdkLibraryEnforce(t *testing.T) {
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runTest := func(t *testing.T, info testConfigInfo, expectedErrorPattern string) {
|
||||||
|
t.Run(fmt.Sprintf("%#v", info), func(t *testing.T) {
|
||||||
|
if expectedErrorPattern == "" {
|
||||||
|
testJavaWithConfig(t, createTestConfig(info))
|
||||||
|
} else {
|
||||||
|
testJavaErrorWithConfig(t, expectedErrorPattern, createTestConfig(info))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
errorMessage := "is not allowed across the partitions"
|
errorMessage := "is not allowed across the partitions"
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "product",
|
fromPartition: "product",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: false,
|
enforceJavaSdkLibraryCheck: false,
|
||||||
}))
|
}, "")
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "product",
|
fromPartition: "product",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: false,
|
enforceProductInterface: false,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, "")
|
||||||
|
|
||||||
testJavaErrorWithConfig(t, errorMessage, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "product",
|
fromPartition: "product",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, errorMessage)
|
||||||
|
|
||||||
testJavaErrorWithConfig(t, errorMessage, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "vendor",
|
fromPartition: "vendor",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, errorMessage)
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "vendor",
|
fromPartition: "vendor",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
|
@ -982,43 +992,43 @@ func TestJavaSdkLibraryEnforce(t *testing.T) {
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
allowList: []string{"bar"},
|
allowList: []string{"bar"},
|
||||||
}))
|
}, "")
|
||||||
|
|
||||||
testJavaErrorWithConfig(t, errorMessage, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_library",
|
libraryType: "java_library",
|
||||||
fromPartition: "vendor",
|
fromPartition: "vendor",
|
||||||
toPartition: "product",
|
toPartition: "product",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, errorMessage)
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_sdk_library",
|
libraryType: "java_sdk_library",
|
||||||
fromPartition: "product",
|
fromPartition: "product",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, "")
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_sdk_library",
|
libraryType: "java_sdk_library",
|
||||||
fromPartition: "vendor",
|
fromPartition: "vendor",
|
||||||
toPartition: "system",
|
toPartition: "system",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, "")
|
||||||
|
|
||||||
testJavaWithConfig(t, createTestConfig(testConfigInfo{
|
runTest(t, testConfigInfo{
|
||||||
libraryType: "java_sdk_library",
|
libraryType: "java_sdk_library",
|
||||||
fromPartition: "vendor",
|
fromPartition: "vendor",
|
||||||
toPartition: "product",
|
toPartition: "product",
|
||||||
enforceVendorInterface: true,
|
enforceVendorInterface: true,
|
||||||
enforceProductInterface: true,
|
enforceProductInterface: true,
|
||||||
enforceJavaSdkLibraryCheck: true,
|
enforceJavaSdkLibraryCheck: true,
|
||||||
}))
|
}, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaults(t *testing.T) {
|
func TestDefaults(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue