summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2019-03-11 15:39:14 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-12 10:38:56 -0700
commit304aa429c1a04cda3ab2ce37b9e31af84405bfca (patch)
tree52d1c3694afa911a7f98b415f596aa1ac7f7aacc
parent2798b3bf39a3204385887c705ccfebc78fd07e48 (diff)
downloadvboot-304aa429c1a04cda3ab2ce37b9e31af84405bfca.tar.gz
futility: updater: Unit test for preserving sections using FMAP flags
In CL:1495054 the updater has different logic when the firmware image has FMAP_AREA_PRESERVE in FMAP flags. This needs to be verified in unit test. The new test tries to set 010=0x08 (FMAP_AREA_PRESERVE) in RO_VPD area flag but not RW_VPD, with RO and RW VPD both being provisioned in source (from) image. The legacy path would update both while the new path will only update RO, so we can make sure the flag-based preservation is working as expected. BUG=chromium:936768 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I07d232444344397b80344ccc9b56f8af3256e043 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1514452 Reviewed-by: Joel Kitching <kitching@chromium.org>
-rw-r--r--tests/futility/data/ro_vpd.binbin0 -> 16384 bytes
-rwxr-xr-xtests/futility/test_update.sh18
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/futility/data/ro_vpd.bin b/tests/futility/data/ro_vpd.bin
new file mode 100644
index 00000000..c953ec1f
--- /dev/null
+++ b/tests/futility/data/ro_vpd.bin
Binary files differ
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index 6d57f674..d8156e7b 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -33,6 +33,7 @@ test "$(test_quirks " enlarge_image, enlarge_image=2")" = \
# Test data files
LINK_BIOS="${SCRIPTDIR}/data/bios_link_mp.bin"
PEPPY_BIOS="${SCRIPTDIR}/data/bios_peppy_mp.bin"
+RO_VPD_BLOB="${SCRIPTDIR}/data/ro_vpd.bin"
# Work in scratch directory
cd "$OUTDIR"
@@ -45,6 +46,8 @@ TO_HWID="X86 LINK TEST 6638"
FROM_HWID="X86 PEPPY TEST 4211"
cp -f ${LINK_BIOS} ${TO_IMAGE}
cp -f ${PEPPY_BIOS} ${FROM_IMAGE}
+"${FUTILITY}" load_fmap "${FROM_IMAGE}" \
+ RO_VPD:"${RO_VPD_BLOB}" RW_VPD:"${RO_VPD_BLOB}"
patch_file() {
local file="$1"
@@ -136,6 +139,16 @@ cp -f "${TMP}.expected.full" "${TMP}.expected.me_unlocked"
patch_file "${TMP}.expected.me_unlocked" SI_DESC 128 \
"\x00\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff"
+# A special set of images that only RO_VPD is preserved (RW_VPD is wiped) using
+# FMAP_AREA_PRESERVE (\010=0x08).
+TO_IMAGE_WIPE_RW_VPD="${TO_IMAGE}.wipe_rw_vpd"
+cp -f "${TO_IMAGE}" "${TO_IMAGE_WIPE_RW_VPD}"
+patch_file ${TO_IMAGE_WIPE_RW_VPD} FMAP 0x3fc "$(printf '\010')"
+cp -f "${TMP}.expected.full" "${TMP}.expected.full.empty_rw_vpd"
+"${FUTILITY}" load_fmap "${TMP}.expected.full.empty_rw_vpd" \
+ RW_VPD:"${TMP}.to/RW_VPD"
+patch_file "${TMP}.expected.full.empty_rw_vpd" FMAP 0x3fc "$(printf '\010')"
+
test_update() {
local test_name="$1"
local emu_src="$2"
@@ -205,6 +218,11 @@ test_update "Full update (GBB1.2 hwid digest)" \
"${FROM_IMAGE}" "${TMP}.expected.full.gbb12" \
-i "${TO_IMAGE_GBB12}" --wp=0 --sys_props 0,0x10001,1
+test_update "Full update (Preserve VPD using FMAP_AREA_PRESERVE)" \
+ "${FROM_IMAGE}" "${TMP}.expected.full.empty_rw_vpd" \
+ -i "${TO_IMAGE_WIPE_RW_VPD}" --wp=0 --sys_props 0,0x10001,1
+
+
# Test RW-only update.
test_update "RW update" \
"${FROM_IMAGE}" "${TMP}.expected.rw" \