summaryrefslogtreecommitdiff
path: root/tests/futility/test_update.sh
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-08-22 23:13:59 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-31 05:22:46 -0700
commit677b535dda16fe8662d646860ff84b1ed744d902 (patch)
tree582f3336e01f9f12e68b6353c7f5609afcbd25f6 /tests/futility/test_update.sh
parent09c1c22dff11a588e9f27c57c4574930f2e168dd (diff)
downloadvboot-677b535dda16fe8662d646860ff84b1ed744d902.tar.gz
futility: cmd_update: Add '--emulate' option
To help debugging and testing, we may want to run updater against an image file instead of modifying real system firmware. The --emulate allows running with all checks and reading, and outputs to given file. BUG=chromium:875551 TEST=make futil; futility update -i IMAGE --emulate IMAGE2 tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ic52fe60a1468f29245cade70f859513d8d117c9c Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1184953 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'tests/futility/test_update.sh')
-rwxr-xr-xtests/futility/test_update.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index aaf46904..c130a56c 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -6,16 +6,25 @@
me=${0##*/}
TMP="$me.tmp"
+# Include /usr/sbin for flahsrom(8)
+PATH=/usr/sbin:"${PATH}"
+
# Test data files
LINK_BIOS="${SCRIPTDIR}/data/bios_link_mp.bin"
+PEPPY_BIOS="${SCRIPTDIR}/data/bios_peppy_mp.bin"
LINK_VERSION="Google_Link.2695.1.133"
+PEPPY_VERSION="Google_Peppy.4389.89.0"
# Work in scratch directory
cd "$OUTDIR"
-
set -o pipefail
-# Test command execution.
+# Prepare temporary files.
+cp -f "${LINK_BIOS}" "${TMP}.emu"
-# The updater is now currently always loading system firmware using flashrom(8)
-# and can't be tested until an emulation interface is implemented.
+# Test command execution.
+versions="$("${FUTILITY}" update -i "${PEPPY_BIOS}" --emulate "${TMP}.emu" |
+ sed -n 's/.*(//; s/).*//p')"
+test "${versions}" = \
+"RO:${PEPPY_VERSION}, RW/A:${PEPPY_VERSION}, RW/B:${PEPPY_VERSION}
+RO:${LINK_VERSION}, RW/A:${LINK_VERSION}, RW/B:${LINK_VERSION}"