summaryrefslogtreecommitdiff
path: root/tests/futility/test_update.sh
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-08-31 15:16:59 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-09-10 01:13:20 -0700
commit8c564a18969b14f7a86ffd93089bba9f37cb53a5 (patch)
treef2994e5fa9a031cd32ee2da82568820cf6ae8187 /tests/futility/test_update.sh
parentc6c620194ff4a44626b550338973df7aa00886f7 (diff)
downloadvboot-8c564a18969b14f7a86ffd93089bba9f37cb53a5.tar.gz
futility: cmd_update: Add quirk 'enlarge_image'
Some devices may have shipped with a smaller image that the real flash may be larger, especially if the device's original flash has been EOL'ed. The quirk 'enlarge_image' allows changing image size according to current_image size by padding 0xFF (flash default value). BUG=chromium:875551 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I84373cfa9bcbd98a2cd96a7dd4bed27a6f724cf3 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1198806 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'tests/futility/test_update.sh')
-rwxr-xr-xtests/futility/test_update.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index 8cba724b..4748f10a 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -25,9 +25,10 @@ test_quirks() {
tr '\n' ' '
}
-test "$(test_quirks "test")" = "test,1 "
-test "$(test_quirks "test=2")" = "test,2 "
-test "$(test_quirks " test, test=2")" = "test,1 test,2 "
+test "$(test_quirks "enlarge_image")" = "enlarge_image,1 "
+test "$(test_quirks "enlarge_image=2")" = "enlarge_image,2 "
+test "$(test_quirks " enlarge_image, enlarge_image=2")" = \
+ "enlarge_image,1 enlarge_image,2 "
# Test data files
LINK_BIOS="${SCRIPTDIR}/data/bios_link_mp.bin"
@@ -84,6 +85,10 @@ FROM_DIFFERENT_ROOTKEY_IMAGE="${FROM_IMAGE}2"
cp -f "${FROM_IMAGE}" "${FROM_DIFFERENT_ROOTKEY_IMAGE}"
"${FUTILITY}" gbb -s --rootkey="${TMP}.to/rootkey" "${FROM_IMAGE}"
+# Hack for quirks
+cp -f "${FROM_IMAGE}" "${FROM_IMAGE}.large"
+truncate -s $((8388608 * 2)) "${FROM_IMAGE}.large"
+
# Generate expected results.
cp -f "${TO_IMAGE}" "${TMP}.expected.full"
cp -f "${FROM_IMAGE}" "${TMP}.expected.rw"
@@ -105,6 +110,8 @@ cp -f "${FROM_IMAGE}" "${TMP}.expected.legacy"
RW_SECTION_B:${TMP}.to/RW_SECTION_B
"${FUTILITY}" load_fmap "${TMP}.expected.legacy" \
RW_LEGACY:${TMP}.to/RW_LEGACY
+cp -f "${TMP}.expected.full" "${TMP}.expected.large"
+dd if=/dev/zero bs=8388608 count=1 | tr '\000' '\377' >>"${TMP}.expected.large"
test_update() {
local test_name="$1"
@@ -212,3 +219,12 @@ test_update "RW update (vboot1, B->B)" \
test_update "Legacy update" \
"${FROM_IMAGE}" "${TMP}.expected.legacy" \
-i "${TO_IMAGE}" --mode=legacy
+
+# Test quirks
+test_update "Full update (wrong size)" \
+ "${FROM_IMAGE}.large" "!Image size is different" \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1
+
+test_update "Full update (--quirks enlarge_image)" \
+ "${FROM_IMAGE}.large" "${TMP}.expected.large" --quirks enlarge_image \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1