summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-08-24 11:52:21 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-31 11:19:58 -0700
commitd7d098dfc83c8ae7dd09f07738d22bd8f506a049 (patch)
tree12319a0dd684a69c8859f85d1c10de8812d8851e /tests
parentc1f9b056a3a7f15f33581a0cf6ae3bf5af828e7a (diff)
downloadvboot-d7d098dfc83c8ae7dd09f07738d22bd8f506a049.tar.gz
futility: cmd_update: Add "system property" and '--sys_props' to override
When updating firmware, we may need to get some system environment status, like which firmware slot was selected and boot (active), or setting cookies so the next boot will be using right (updated) slot. In verified boot, these status are manipulated by "system property" using API Vb{Get,Set}SystemProperty{String,Int}. The user land tool is `crossystem`. In order to run the firmware updater for testing and debugging, we need an easy way to toggle getting real system status, or fetch from predefined values. A new 'system_property' structure is introduced and included as part of `updater_config`. Each property can be access by `get_system_property(property_type)` function. If the value was not fetched yet, the function will call corresponding 'getter' function defined in property and then cache it. A new parameter '--sys_props` is also introduced so we can easily override them from command line so the updater will not get status from running system. The --sys_props takes a list of integers, eliminated by space or comma. For example, "1,2,3" => overrides [0]=1, [1]=2, [2]=3. "1 2,3" => overrides [0]=1, [1]=2, [2]=3. "1, ,3" => overrides [0]=1, [2]=3. BUG=chromium:875551 TEST=make futil; futility update -i IMAGE tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ia2e06a953da1480da9a94f7f397802caa7468efa Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1188015
Diffstat (limited to 'tests')
-rwxr-xr-xtests/futility/test_update.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index 7e2a142d..ca9c6f85 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -6,6 +6,19 @@
me=${0##*/}
TMP="$me.tmp"
+# Test --sys_props (primitive test needed for future updating tests).
+test_sys_props() {
+ ! "${FUTILITY}" --debug update --sys_props "$*" |
+ sed -n 's/.*property\[\(.*\)].value = \(.*\)/\1,\2,/p' |
+ tr '\n' ' '
+}
+
+test "$(test_sys_props "1,2,3")" = "0,1, 1,2, 2,3, "
+test "$(test_sys_props "1 2 3")" = "0,1, 1,2, 2,3, "
+test "$(test_sys_props "1, 2,3 ")" = "0,1, 1,2, 2,3, "
+test "$(test_sys_props " 1,, 2")" = "0,1, 2,2, "
+test "$(test_sys_props " , 4,")" = "1,4, "
+
# Test data files
LINK_BIOS="${SCRIPTDIR}/data/bios_link_mp.bin"
PEPPY_BIOS="${SCRIPTDIR}/data/bios_peppy_mp.bin"