Add tests for core library neverallow rules am: b6c6bdd1c2
am: 28630e0c47
Change-Id: If9ac14fe90a21e80d8c7748cb505f53c3983d3c5
This commit is contained in:
@@ -159,6 +159,38 @@ var neverallowTests = []struct {
|
||||
},
|
||||
expectedError: "java_device_for_host can only be used in whitelisted projects",
|
||||
},
|
||||
// Libcore rule tests
|
||||
{
|
||||
name: "no_standard_libs: true inside core libraries",
|
||||
fs: map[string][]byte{
|
||||
"libcore/Blueprints": []byte(`
|
||||
java_library {
|
||||
name: "inside_core_libraries",
|
||||
no_standard_libs: true,
|
||||
}`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "no_standard_libs: true outside core libraries",
|
||||
fs: map[string][]byte{
|
||||
"Blueprints": []byte(`
|
||||
java_library {
|
||||
name: "outside_core_libraries",
|
||||
no_standard_libs: true,
|
||||
}`),
|
||||
},
|
||||
expectedError: "module \"outside_core_libraries\": violates neverallow",
|
||||
},
|
||||
{
|
||||
name: "no_standard_libs: false",
|
||||
fs: map[string][]byte{
|
||||
"Blueprints": []byte(`
|
||||
java_library {
|
||||
name: "outside_core_libraries",
|
||||
no_standard_libs: false,
|
||||
}`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestNeverallow(t *testing.T) {
|
||||
@@ -238,7 +270,8 @@ func (p *mockCcLibraryModule) GenerateAndroidBuildActions(ModuleContext) {
|
||||
}
|
||||
|
||||
type mockJavaLibraryProperties struct {
|
||||
Libs []string
|
||||
Libs []string
|
||||
No_standard_libs *bool
|
||||
}
|
||||
|
||||
type mockJavaLibraryModule struct {
|
||||
|
Reference in New Issue
Block a user