summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKelvin Zhang <zhangkelvin@google.com>2020-06-30 02:43:22 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-06-30 02:43:22 +0200
commitdca48443286c0328eb9f321e188b6d244cc1cefe (patch)
treedb31bcae7f822837b313fb0cfe68b65cd07ce051 /tests
parentMerge "Track rename of adbd_system_binaries." (diff)
parentAdd recovery support of dynamic fingerprints (diff)
downloadandroid_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar.gz
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar.bz2
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar.lz
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar.xz
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.tar.zst
android_bootable_recovery-dca48443286c0328eb9f321e188b6d244cc1cefe.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/install_test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/install_test.cpp b/tests/unit/install_test.cpp
index ee753494c..90c4b1409 100644
--- a/tests/unit/install_test.cpp
+++ b/tests/unit/install_test.cpp
@@ -466,6 +466,34 @@ TEST(InstallTest, CheckPackageMetadata_ab_fingerprint) {
TestCheckPackageMetadata(metadata, OtaType::AB, false);
}
+TEST(InstallTest, CheckPackageMetadata_dynamic_fingerprint) {
+ std::string device = android::base::GetProperty("ro.product.device", "");
+ ASSERT_FALSE(device.empty());
+
+ std::string finger_print = android::base::GetProperty("ro.build.fingerprint", "");
+ ASSERT_FALSE(finger_print.empty());
+
+ std::string metadata = android::base::Join(
+ std::vector<std::string>{
+ "ota-type=AB",
+ "pre-device=please|work|" + device + "|please|work",
+ "pre-build=" + finger_print = "pass|this|test",
+ "post-timestamp=" + std::to_string(std::numeric_limits<int64_t>::max()),
+ },
+ "\n");
+ TestCheckPackageMetadata(metadata, OtaType::AB, true);
+
+ metadata = android::base::Join(
+ std::vector<std::string>{
+ "ota-type=AB",
+ "pre-device=" + device,
+ "pre-build=dummy_build_fingerprint",
+ "post-timestamp=" + std::to_string(std::numeric_limits<int64_t>::max()),
+ },
+ "\n");
+ TestCheckPackageMetadata(metadata, OtaType::AB, false);
+}
+
TEST(InstallTest, CheckPackageMetadata_ab_post_timestamp) {
std::string device = android::base::GetProperty("ro.product.device", "");
ASSERT_NE("", device);