summaryrefslogtreecommitdiff
path: root/sdk/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'sdk/testing.go')
-rw-r--r--sdk/testing.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/sdk/testing.go b/sdk/testing.go
index 3254cf9f3..294f1a57d 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -136,6 +136,7 @@ func getSdkSnapshotBuildInfo(t *testing.T, result *android.TestResult, sdk *sdk)
androidUnversionedBpContents: sdk.GetUnversionedAndroidBpContentsForTests(),
androidVersionedBpContents: sdk.GetVersionedAndroidBpContentsForTests(),
snapshotTestCustomizations: map[snapshotTest]*snapshotTestCustomization{},
+ targetBuildRelease: sdk.builderForTests.targetBuildRelease,
}
buildParams := sdk.BuildParamsForTests()
@@ -253,6 +254,13 @@ func CheckSnapshot(t *testing.T, result *android.TestResult, name string, dir st
}
fs[filepath.Join(snapshotSubDir, "Android.bp")] = []byte(snapshotBuildInfo.androidBpContents)
+ // If the generated snapshot builders not for the current release then it cannot be loaded by
+ // the current release.
+ currentBuildRelease := latestBuildRelease()
+ if snapshotBuildInfo.targetBuildRelease != currentBuildRelease {
+ return
+ }
+
// The preparers from the original source fixture.
sourcePreparers := result.Preparer()
@@ -476,6 +484,9 @@ type snapshotBuildInfo struct {
// The final output zip.
outputZip string
+ // The target build release.
+ targetBuildRelease *buildRelease
+
// The test specific customizations for each snapshot test.
snapshotTestCustomizations map[snapshotTest]*snapshotTestCustomization
}