Stop sdk package depending on testing.T being embedded in TestResult
This change is in preparation for removing testing.T from TestResult. Bug: 181070625 Test: m nothing Change-Id: I67535aff0d894e6e3d8456b75540f340af853355
This commit is contained in:
parent
e84b1338c5
commit
36474d322b
7 changed files with 103 additions and 116 deletions
|
@ -29,7 +29,7 @@ func TestSnapshotWithBootImage(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -58,6 +58,5 @@ sdk_snapshot {
|
||||||
boot_images: ["mysdk_mybootimage@current"],
|
boot_images: ["mysdk_mybootimage@current"],
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
checkAllCopyRules(""),
|
checkAllCopyRules(""))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,26 +54,25 @@ func propertyStructFixture() interface{} {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkPropertySetFixture(h android.TestHelper, val interface{}, hasTags bool) {
|
func checkPropertySetFixture(t *testing.T, val interface{}, hasTags bool) {
|
||||||
set := val.(*bpPropertySet)
|
set := val.(*bpPropertySet)
|
||||||
h.AssertDeepEquals("wrong x value", "taxi", set.getValue("x"))
|
android.AssertDeepEquals(t, "wrong x value", "taxi", set.getValue("x"))
|
||||||
h.AssertDeepEquals("wrong y value", 1729, set.getValue("y"))
|
android.AssertDeepEquals(t, "wrong y value", 1729, set.getValue("y"))
|
||||||
|
|
||||||
subset := set.getValue("sub").(*bpPropertySet)
|
subset := set.getValue("sub").(*bpPropertySet)
|
||||||
h.AssertDeepEquals("wrong sub.x value", "taxi", subset.getValue("x"))
|
android.AssertDeepEquals(t, "wrong sub.x value", "taxi", subset.getValue("x"))
|
||||||
h.AssertDeepEquals("wrong sub.y value", 1729, subset.getValue("y"))
|
android.AssertDeepEquals(t, "wrong sub.y value", 1729, subset.getValue("y"))
|
||||||
|
|
||||||
if hasTags {
|
if hasTags {
|
||||||
h.AssertDeepEquals("wrong y tag", "tag_y", set.getTag("y"))
|
android.AssertDeepEquals(t, "wrong y tag", "tag_y", set.getTag("y"))
|
||||||
h.AssertDeepEquals("wrong sub.x tag", "tag_x", subset.getTag("x"))
|
android.AssertDeepEquals(t, "wrong sub.x tag", "tag_x", subset.getTag("x"))
|
||||||
} else {
|
} else {
|
||||||
h.AssertDeepEquals("wrong y tag", nil, set.getTag("y"))
|
android.AssertDeepEquals(t, "wrong y tag", nil, set.getTag("y"))
|
||||||
h.AssertDeepEquals("wrong sub.x tag", nil, subset.getTag("x"))
|
android.AssertDeepEquals(t, "wrong sub.x tag", nil, subset.getTag("x"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddPropertySimple(t *testing.T) {
|
func TestAddPropertySimple(t *testing.T) {
|
||||||
h := android.TestHelper{t}
|
|
||||||
set := newPropertySet()
|
set := newPropertySet()
|
||||||
for name, val := range map[string]interface{}{
|
for name, val := range map[string]interface{}{
|
||||||
"x": "taxi",
|
"x": "taxi",
|
||||||
|
@ -83,16 +82,15 @@ func TestAddPropertySimple(t *testing.T) {
|
||||||
"arr": []string{"a", "b", "c"},
|
"arr": []string{"a", "b", "c"},
|
||||||
} {
|
} {
|
||||||
set.AddProperty(name, val)
|
set.AddProperty(name, val)
|
||||||
h.AssertDeepEquals("wrong value", val, set.getValue(name))
|
android.AssertDeepEquals(t, "wrong value", val, set.getValue(name))
|
||||||
}
|
}
|
||||||
h.AssertPanic("adding x again should panic",
|
android.AssertPanic(t, "adding x again should panic",
|
||||||
func() { set.AddProperty("x", "taxi") })
|
func() { set.AddProperty("x", "taxi") })
|
||||||
h.AssertPanic("adding arr again should panic",
|
android.AssertPanic(t, "adding arr again should panic",
|
||||||
func() { set.AddProperty("arr", []string{"d"}) })
|
func() { set.AddProperty("arr", []string{"d"}) })
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddPropertySubset(t *testing.T) {
|
func TestAddPropertySubset(t *testing.T) {
|
||||||
h := android.TestHelper{t}
|
|
||||||
getFixtureMap := map[string]func() interface{}{
|
getFixtureMap := map[string]func() interface{}{
|
||||||
"property set": propertySetFixture,
|
"property set": propertySetFixture,
|
||||||
"property struct": propertyStructFixture,
|
"property struct": propertyStructFixture,
|
||||||
|
@ -103,8 +101,8 @@ func TestAddPropertySubset(t *testing.T) {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
set := propertySetFixture().(*bpPropertySet)
|
set := propertySetFixture().(*bpPropertySet)
|
||||||
set.AddProperty("new", getFixture())
|
set.AddProperty("new", getFixture())
|
||||||
checkPropertySetFixture(h, set, true)
|
checkPropertySetFixture(t, set, true)
|
||||||
checkPropertySetFixture(h, set.getValue("new"), name == "property set")
|
checkPropertySetFixture(t, set.getValue("new"), name == "property set")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -118,40 +116,38 @@ func TestAddPropertySubset(t *testing.T) {
|
||||||
subset.AddPropertySet("sub")
|
subset.AddPropertySet("sub")
|
||||||
set.AddProperty("sub", getFixture())
|
set.AddProperty("sub", getFixture())
|
||||||
merged := set.getValue("sub").(*bpPropertySet)
|
merged := set.getValue("sub").(*bpPropertySet)
|
||||||
h.AssertDeepEquals("wrong flag value", false, merged.getValue("flag"))
|
android.AssertDeepEquals(t, "wrong flag value", false, merged.getValue("flag"))
|
||||||
checkPropertySetFixture(h, merged, name == "property set")
|
checkPropertySetFixture(t, merged, name == "property set")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("add conflicting subset", func(t *testing.T) {
|
t.Run("add conflicting subset", func(t *testing.T) {
|
||||||
set := propertySetFixture().(*bpPropertySet)
|
set := propertySetFixture().(*bpPropertySet)
|
||||||
h.AssertPanic("adding x again should panic",
|
android.AssertPanic(t, "adding x again should panic",
|
||||||
func() { set.AddProperty("x", propertySetFixture()) })
|
func() { set.AddProperty("x", propertySetFixture()) })
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("add non-pointer struct", func(t *testing.T) {
|
t.Run("add non-pointer struct", func(t *testing.T) {
|
||||||
set := propertySetFixture().(*bpPropertySet)
|
set := propertySetFixture().(*bpPropertySet)
|
||||||
str := propertyStructFixture().(*propertyStruct)
|
str := propertyStructFixture().(*propertyStruct)
|
||||||
h.AssertPanic("adding a non-pointer struct should panic",
|
android.AssertPanic(t, "adding a non-pointer struct should panic",
|
||||||
func() { set.AddProperty("new", *str) })
|
func() { set.AddProperty("new", *str) })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddPropertySetNew(t *testing.T) {
|
func TestAddPropertySetNew(t *testing.T) {
|
||||||
h := android.TestHelper{t}
|
|
||||||
set := newPropertySet()
|
set := newPropertySet()
|
||||||
subset := set.AddPropertySet("sub")
|
subset := set.AddPropertySet("sub")
|
||||||
subset.AddProperty("new", "d^^b")
|
subset.AddProperty("new", "d^^b")
|
||||||
h.AssertDeepEquals("wrong sub.new value", "d^^b", set.getValue("sub").(*bpPropertySet).getValue("new"))
|
android.AssertDeepEquals(t, "wrong sub.new value", "d^^b", set.getValue("sub").(*bpPropertySet).getValue("new"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAddPropertySetExisting(t *testing.T) {
|
func TestAddPropertySetExisting(t *testing.T) {
|
||||||
h := android.TestHelper{t}
|
|
||||||
set := propertySetFixture().(*bpPropertySet)
|
set := propertySetFixture().(*bpPropertySet)
|
||||||
subset := set.AddPropertySet("sub")
|
subset := set.AddPropertySet("sub")
|
||||||
subset.AddProperty("new", "d^^b")
|
subset.AddProperty("new", "d^^b")
|
||||||
h.AssertDeepEquals("wrong sub.new value", "d^^b", set.getValue("sub").(*bpPropertySet).getValue("new"))
|
android.AssertDeepEquals(t, "wrong sub.new value", "d^^b", set.getValue("sub").(*bpPropertySet).getValue("new"))
|
||||||
}
|
}
|
||||||
|
|
||||||
type removeFredTransformation struct {
|
type removeFredTransformation struct {
|
||||||
|
@ -180,9 +176,6 @@ func (t removeFredTransformation) transformPropertySetAfterContents(name string,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTransformRemoveProperty(t *testing.T) {
|
func TestTransformRemoveProperty(t *testing.T) {
|
||||||
|
|
||||||
helper := android.TestHelper{t}
|
|
||||||
|
|
||||||
set := newPropertySet()
|
set := newPropertySet()
|
||||||
set.AddProperty("name", "name")
|
set.AddProperty("name", "name")
|
||||||
set.AddProperty("fred", "12")
|
set.AddProperty("fred", "12")
|
||||||
|
@ -191,13 +184,10 @@ func TestTransformRemoveProperty(t *testing.T) {
|
||||||
|
|
||||||
contents := &generatedContents{}
|
contents := &generatedContents{}
|
||||||
outputPropertySet(contents, set)
|
outputPropertySet(contents, set)
|
||||||
helper.AssertTrimmedStringEquals("removing property failed", "name: \"name\",\n", contents.content.String())
|
android.AssertTrimmedStringEquals(t, "removing property failed", "name: \"name\",\n", contents.content.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTransformRemovePropertySet(t *testing.T) {
|
func TestTransformRemovePropertySet(t *testing.T) {
|
||||||
|
|
||||||
helper := android.TestHelper{t}
|
|
||||||
|
|
||||||
set := newPropertySet()
|
set := newPropertySet()
|
||||||
set.AddProperty("name", "name")
|
set.AddProperty("name", "name")
|
||||||
set.AddPropertySet("fred")
|
set.AddPropertySet("fred")
|
||||||
|
@ -206,5 +196,5 @@ func TestTransformRemovePropertySet(t *testing.T) {
|
||||||
|
|
||||||
contents := &generatedContents{}
|
contents := &generatedContents{}
|
||||||
outputPropertySet(contents, set)
|
outputPropertySet(contents, set)
|
||||||
helper.AssertTrimmedStringEquals("removing property set failed", "name: \"name\",\n", contents.content.String())
|
android.AssertTrimmedStringEquals(t, "removing property set failed", "name: \"name\",\n", contents.content.String())
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ func TestSdkCompileMultilibOverride(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ func TestSnapshotWithObject(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ func TestSnapshotWithCcDuplicateHeaders(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAllCopyRules(`
|
checkAllCopyRules(`
|
||||||
myinclude/Test.h -> include/myinclude/Test.h
|
myinclude/Test.h -> include/myinclude/Test.h
|
||||||
.intermediates/mynativelib1/android_arm64_armv8-a_shared/mynativelib1.so -> arm64/lib/mynativelib1.so
|
.intermediates/mynativelib1/android_arm64_armv8-a_shared/mynativelib1.so -> arm64/lib/mynativelib1.so
|
||||||
|
@ -486,7 +486,7 @@ func TestSnapshotWithCcExportGeneratedHeaders(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ func TestSnapshotWithCcBinary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mymodule_exports", "",
|
CheckSnapshot(t, result, "mymodule_exports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ func TestSnapshotWithSingleHostOsType(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -997,7 +997,7 @@ func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mymodule_exports", "",
|
CheckSnapshot(t, result, "mymodule_exports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1105,7 +1105,7 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1303,7 +1303,7 @@ func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1558,7 +1558,7 @@ func TestSnapshotWithCcStaticLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1621,7 +1621,7 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1735,7 +1735,7 @@ func TestSnapshotWithCcLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1849,7 +1849,7 @@ func TestHostSnapshotWithMultiLib64(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1946,7 +1946,7 @@ func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1984,7 +1984,7 @@ func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2086,7 +2086,7 @@ func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2118,7 +2118,6 @@ cc_prebuilt_library_headers {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
// Verifi
|
|
||||||
checkVersionedAndroidBpContents(`
|
checkVersionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2199,7 +2198,7 @@ func TestSystemSharedLibPropagation(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2272,7 +2271,7 @@ cc_prebuilt_library_shared {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2383,7 +2382,7 @@ func TestStubsLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2436,7 +2435,7 @@ func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2549,7 +2548,7 @@ func TestUniqueHostSoname(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -2664,7 +2663,7 @@ func TestNoSanitizerMembers(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkUnversionedAndroidBpContents(`
|
checkUnversionedAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ func TestModuleExportsSnapshot(t *testing.T) {
|
||||||
"package/Android.bp": []byte(packageBp),
|
"package/Android.bp": []byte(packageBp),
|
||||||
})
|
})
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "package",
|
CheckSnapshot(t, result, "myexports", "package",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
|
||||||
// Make sure that the mysdk module depends on "sdkmember" and not "prebuilt_sdkmember".
|
// Make sure that the mysdk module depends on "sdkmember" and not "prebuilt_sdkmember".
|
||||||
java.CheckModuleDependencies(t, result.TestContext, "mysdk", "android_common", []string{"sdkmember"})
|
java.CheckModuleDependencies(t, result.TestContext, "mysdk", "android_common", []string{"sdkmember"})
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`// This is auto-generated. DO NOT EDIT.
|
checkAndroidBpContents(`// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
|
@ -256,7 +256,7 @@ func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ func TestSnapshotWithJavaImplLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ func TestSnapshotWithJavaBootLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ func TestSnapshotWithJavaTest(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ func TestHostSnapshotWithJavaTest(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ func TestSnapshotWithJavaSystemModules(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "myexports", "",
|
CheckSnapshot(t, result, "myexports", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1033,7 +1033,7 @@ func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1134,7 +1134,7 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1368,7 +1368,7 @@ func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1476,7 +1476,7 @@ func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1564,7 +1564,7 @@ func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -1640,7 +1640,7 @@ func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ func TestSnapshotVisibility(t *testing.T) {
|
||||||
"package/Android.bp": []byte(packageBp),
|
"package/Android.bp": []byte(packageBp),
|
||||||
})
|
})
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "package",
|
CheckSnapshot(t, result, "mysdk", "package",
|
||||||
checkAndroidBpContents(`
|
checkAndroidBpContents(`
|
||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -317,9 +317,8 @@ func TestSdkInstall(t *testing.T) {
|
||||||
`
|
`
|
||||||
result := testSdkWithFs(t, sdk, nil)
|
result := testSdkWithFs(t, sdk, nil)
|
||||||
|
|
||||||
CheckSnapshot(result, "mysdk", "",
|
CheckSnapshot(t, result, "mysdk", "",
|
||||||
checkAllOtherCopyRules(`.intermediates/mysdk/common_os/mysdk-current.zip -> mysdk-current.zip`),
|
checkAllOtherCopyRules(`.intermediates/mysdk/common_os/mysdk-current.zip -> mysdk-current.zip`))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type EmbeddedPropertiesStruct struct {
|
type EmbeddedPropertiesStruct struct {
|
||||||
|
@ -387,12 +386,10 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||||
|
|
||||||
extractor := newCommonValueExtractor(common)
|
extractor := newCommonValueExtractor(common)
|
||||||
|
|
||||||
h := android.TestHelper{t}
|
|
||||||
|
|
||||||
err := extractor.extractCommonProperties(common, structs)
|
err := extractor.extractCommonProperties(common, structs)
|
||||||
h.AssertDeepEquals("unexpected error", nil, err)
|
android.AssertDeepEquals(t, "unexpected error", nil, err)
|
||||||
|
|
||||||
h.AssertDeepEquals("common properties not correct",
|
android.AssertDeepEquals(t, "common properties not correct",
|
||||||
&testPropertiesStruct{
|
&testPropertiesStruct{
|
||||||
name: "common",
|
name: "common",
|
||||||
private: "",
|
private: "",
|
||||||
|
@ -410,7 +407,7 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||||
},
|
},
|
||||||
common)
|
common)
|
||||||
|
|
||||||
h.AssertDeepEquals("updated properties[0] not correct",
|
android.AssertDeepEquals(t, "updated properties[0] not correct",
|
||||||
&testPropertiesStruct{
|
&testPropertiesStruct{
|
||||||
name: "struct-0",
|
name: "struct-0",
|
||||||
private: "common",
|
private: "common",
|
||||||
|
@ -428,7 +425,7 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||||
},
|
},
|
||||||
structs[0])
|
structs[0])
|
||||||
|
|
||||||
h.AssertDeepEquals("updated properties[1] not correct",
|
android.AssertDeepEquals(t, "updated properties[1] not correct",
|
||||||
&testPropertiesStruct{
|
&testPropertiesStruct{
|
||||||
name: "struct-1",
|
name: "struct-1",
|
||||||
private: "common",
|
private: "common",
|
||||||
|
@ -462,10 +459,8 @@ func TestCommonValueOptimization_InvalidArchSpecificVariants(t *testing.T) {
|
||||||
|
|
||||||
extractor := newCommonValueExtractor(common)
|
extractor := newCommonValueExtractor(common)
|
||||||
|
|
||||||
h := android.TestHelper{t}
|
|
||||||
|
|
||||||
err := extractor.extractCommonProperties(common, structs)
|
err := extractor.extractCommonProperties(common, structs)
|
||||||
h.AssertErrorMessageEquals("unexpected error", `field "S_Common" is not tagged as "arch_variant" but has arch specific properties:
|
android.AssertErrorMessageEquals(t, "unexpected error", `field "S_Common" is not tagged as "arch_variant" but has arch specific properties:
|
||||||
"struct-0" has value "should-be-but-is-not-common0"
|
"struct-0" has value "should-be-but-is-not-common0"
|
||||||
"struct-1" has value "should-be-but-is-not-common1"`, err)
|
"struct-1" has value "should-be-but-is-not-common1"`, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,8 +108,9 @@ func pathsToStrings(paths android.Paths) []string {
|
||||||
//
|
//
|
||||||
// e.g. find the src/dest pairs from each cp command, the various zip files
|
// e.g. find the src/dest pairs from each cp command, the various zip files
|
||||||
// generated, etc.
|
// generated, etc.
|
||||||
func getSdkSnapshotBuildInfo(result *android.TestResult, sdk *sdk) *snapshotBuildInfo {
|
func getSdkSnapshotBuildInfo(t *testing.T, result *android.TestResult, sdk *sdk) *snapshotBuildInfo {
|
||||||
info := &snapshotBuildInfo{
|
info := &snapshotBuildInfo{
|
||||||
|
t: t,
|
||||||
r: result,
|
r: result,
|
||||||
androidBpContents: sdk.GetAndroidBpContentsForTests(),
|
androidBpContents: sdk.GetAndroidBpContentsForTests(),
|
||||||
androidUnversionedBpContents: sdk.GetUnversionedAndroidBpContentsForTests(),
|
androidUnversionedBpContents: sdk.GetUnversionedAndroidBpContentsForTests(),
|
||||||
|
@ -153,7 +154,7 @@ func getSdkSnapshotBuildInfo(result *android.TestResult, sdk *sdk) *snapshotBuil
|
||||||
info.intermediateZip = info.outputZip
|
info.intermediateZip = info.outputZip
|
||||||
mergeInput := android.NormalizePathForTesting(bp.Input)
|
mergeInput := android.NormalizePathForTesting(bp.Input)
|
||||||
if info.intermediateZip != mergeInput {
|
if info.intermediateZip != mergeInput {
|
||||||
result.Errorf("Expected intermediate zip %s to be an input to merge zips but found %s instead",
|
t.Errorf("Expected intermediate zip %s to be an input to merge zips but found %s instead",
|
||||||
info.intermediateZip, mergeInput)
|
info.intermediateZip, mergeInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,15 +178,15 @@ func getSdkSnapshotBuildInfo(result *android.TestResult, sdk *sdk) *snapshotBuil
|
||||||
// Takes a list of functions which check different facets of the snapshot build rules.
|
// Takes a list of functions which check different facets of the snapshot build rules.
|
||||||
// Allows each test to customize what is checked without duplicating lots of code
|
// Allows each test to customize what is checked without duplicating lots of code
|
||||||
// or proliferating check methods of different flavors.
|
// or proliferating check methods of different flavors.
|
||||||
func CheckSnapshot(result *android.TestResult, name string, dir string, checkers ...snapshotBuildInfoChecker) {
|
func CheckSnapshot(t *testing.T, result *android.TestResult, name string, dir string, checkers ...snapshotBuildInfoChecker) {
|
||||||
result.Helper()
|
t.Helper()
|
||||||
|
|
||||||
// The sdk CommonOS variant is always responsible for generating the snapshot.
|
// The sdk CommonOS variant is always responsible for generating the snapshot.
|
||||||
variant := android.CommonOS.Name
|
variant := android.CommonOS.Name
|
||||||
|
|
||||||
sdk := result.Module(name, variant).(*sdk)
|
sdk := result.Module(name, variant).(*sdk)
|
||||||
|
|
||||||
snapshotBuildInfo := getSdkSnapshotBuildInfo(result, sdk)
|
snapshotBuildInfo := getSdkSnapshotBuildInfo(t, result, sdk)
|
||||||
|
|
||||||
// Check state of the snapshot build.
|
// Check state of the snapshot build.
|
||||||
for _, checker := range checkers {
|
for _, checker := range checkers {
|
||||||
|
@ -197,7 +198,7 @@ func CheckSnapshot(result *android.TestResult, name string, dir string, checkers
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
dir = filepath.Clean(dir) + "/"
|
dir = filepath.Clean(dir) + "/"
|
||||||
}
|
}
|
||||||
result.AssertStringEquals("Snapshot zip file in wrong place",
|
android.AssertStringEquals(t, "Snapshot zip file in wrong place",
|
||||||
fmt.Sprintf(".intermediates/%s%s/%s/%s-current.zip", dir, name, variant, name), actual)
|
fmt.Sprintf(".intermediates/%s%s/%s/%s-current.zip", dir, name, variant, name), actual)
|
||||||
|
|
||||||
// Populate a mock filesystem with the files that would have been copied by
|
// Populate a mock filesystem with the files that would have been copied by
|
||||||
|
@ -208,7 +209,7 @@ func CheckSnapshot(result *android.TestResult, name string, dir string, checkers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the generated bp file to make sure it is valid.
|
// Process the generated bp file to make sure it is valid.
|
||||||
testSdkWithFs(result.T, snapshotBuildInfo.androidBpContents, fs)
|
testSdkWithFs(t, snapshotBuildInfo.androidBpContents, fs)
|
||||||
}
|
}
|
||||||
|
|
||||||
type snapshotBuildInfoChecker func(info *snapshotBuildInfo)
|
type snapshotBuildInfoChecker func(info *snapshotBuildInfo)
|
||||||
|
@ -218,8 +219,8 @@ type snapshotBuildInfoChecker func(info *snapshotBuildInfo)
|
||||||
// Both the expected and actual string are both trimmed before comparing.
|
// Both the expected and actual string are both trimmed before comparing.
|
||||||
func checkAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
func checkAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
info.r.AssertTrimmedStringEquals("Android.bp contents do not match", expected, info.androidBpContents)
|
android.AssertTrimmedStringEquals(info.t, "Android.bp contents do not match", expected, info.androidBpContents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +231,8 @@ func checkAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
||||||
// Both the expected and actual string are both trimmed before comparing.
|
// Both the expected and actual string are both trimmed before comparing.
|
||||||
func checkUnversionedAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
func checkUnversionedAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
info.r.AssertTrimmedStringEquals("unversioned Android.bp contents do not match", expected, info.androidUnversionedBpContents)
|
android.AssertTrimmedStringEquals(info.t, "unversioned Android.bp contents do not match", expected, info.androidUnversionedBpContents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +246,8 @@ func checkUnversionedAndroidBpContents(expected string) snapshotBuildInfoChecker
|
||||||
// Both the expected and actual string are both trimmed before comparing.
|
// Both the expected and actual string are both trimmed before comparing.
|
||||||
func checkVersionedAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
func checkVersionedAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
info.r.AssertTrimmedStringEquals("versioned Android.bp contents do not match", expected, info.androidVersionedBpContents)
|
android.AssertTrimmedStringEquals(info.t, "versioned Android.bp contents do not match", expected, info.androidVersionedBpContents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,27 +258,27 @@ func checkVersionedAndroidBpContents(expected string) snapshotBuildInfoChecker {
|
||||||
// before comparing.
|
// before comparing.
|
||||||
func checkAllCopyRules(expected string) snapshotBuildInfoChecker {
|
func checkAllCopyRules(expected string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
info.r.AssertTrimmedStringEquals("Incorrect copy rules", expected, info.copyRules)
|
android.AssertTrimmedStringEquals(info.t, "Incorrect copy rules", expected, info.copyRules)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkAllOtherCopyRules(expected string) snapshotBuildInfoChecker {
|
func checkAllOtherCopyRules(expected string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
info.r.AssertTrimmedStringEquals("Incorrect copy rules", expected, info.otherCopyRules)
|
android.AssertTrimmedStringEquals(info.t, "Incorrect copy rules", expected, info.otherCopyRules)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the specified paths match the list of zips to merge with the intermediate zip.
|
// Check that the specified paths match the list of zips to merge with the intermediate zip.
|
||||||
func checkMergeZips(expected ...string) snapshotBuildInfoChecker {
|
func checkMergeZips(expected ...string) snapshotBuildInfoChecker {
|
||||||
return func(info *snapshotBuildInfo) {
|
return func(info *snapshotBuildInfo) {
|
||||||
info.r.Helper()
|
info.t.Helper()
|
||||||
if info.intermediateZip == "" {
|
if info.intermediateZip == "" {
|
||||||
info.r.Errorf("No intermediate zip file was created")
|
info.t.Errorf("No intermediate zip file was created")
|
||||||
}
|
}
|
||||||
|
|
||||||
info.r.AssertDeepEquals("mismatching merge zip files", expected, info.mergeZips)
|
android.AssertDeepEquals(info.t, "mismatching merge zip files", expected, info.mergeZips)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +288,9 @@ func checkMergeZips(expected ...string) snapshotBuildInfoChecker {
|
||||||
// All source/input paths are relative either the build directory. All dest/output paths are
|
// All source/input paths are relative either the build directory. All dest/output paths are
|
||||||
// relative to the snapshot root directory.
|
// relative to the snapshot root directory.
|
||||||
type snapshotBuildInfo struct {
|
type snapshotBuildInfo struct {
|
||||||
|
t *testing.T
|
||||||
|
|
||||||
|
// The result from RunTest()
|
||||||
r *android.TestResult
|
r *android.TestResult
|
||||||
|
|
||||||
// The contents of the generated Android.bp file
|
// The contents of the generated Android.bp file
|
||||||
|
|
Loading…
Reference in a new issue