Merge "Implement fake vendor snapshot"

This commit is contained in:
Treehugger Robot
2021-01-08 00:24:51 +00:00
committed by Gerrit Code Review
4 changed files with 58 additions and 8 deletions

View File

@@ -1248,6 +1248,15 @@ func TestVendorSnapshotCapture(t *testing.T) {
t.Errorf("%q expected but not found", jsonFile)
}
}
// fake snapshot should have all outputs in the normal snapshot.
fakeSnapshotSingleton := ctx.SingletonForTests("vendor-fake-snapshot")
for _, output := range snapshotSingleton.AllOutputs() {
fakeOutput := strings.Replace(output, "/vendor-snapshot/", "/fake/vendor-snapshot/", 1)
if fakeSnapshotSingleton.MaybeOutput(fakeOutput).Rule == nil {
t.Errorf("%q expected but not found", fakeOutput)
}
}
}
func TestVendorSnapshotUse(t *testing.T) {
@@ -1679,6 +1688,8 @@ func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) {
`module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`,
`module "libvendor\{.+,image:vendor.+,arch:arm64_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`,
`module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`,
`module "libvendor\{.+,image:vendor.+,arch:arm64_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`,
`module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`,
})
}
@@ -1722,6 +1733,10 @@ func TestVendorSnapshotExcludeWithVendorAvailable(t *testing.T) {
`module "libinclude\{.+,image:,arch:arm_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:vendor.+,arch:arm64_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:vendor.+,arch:arm_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:,arch:arm64_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:,arch:arm_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:vendor.+,arch:arm64_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
`module "libinclude\{.+,image:vendor.+,arch:arm_.+\}" may not use both "vendor_available: true" and "exclude_from_vendor_snapshot: true"`,
})
}