diff options
author | Hung-Te Lin <hungte@chromium.org> | 2018-09-17 17:47:25 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-18 10:31:02 -0700 |
commit | 0828bde7b1f0e932c2db0884cb6894c422672666 (patch) | |
tree | 972c9c7e32ba9a1686cafb09552d7d887a8f877d | |
parent | b6cd64b799f94ef2fcc1f585939c4fe8c74a4d02 (diff) | |
download | vboot-0828bde7b1f0e932c2db0884cb6894c422672666.tar.gz |
futility: update: Fix update failure in factory mode due to wrong WP logic
In --mode=factory, we should fail if write protection is enabled.
Also added an unit test for the case.
BRANCH=None
BUG=b:115764295
TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility
Change-Id: I6c693e470a034554b1f4a3cb16cfbf974ae6f54b
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1226587
Reviewed-by: Marco Chen <marcochen@chromium.org>
-rw-r--r-- | futility/cmd_update.c | 2 | ||||
-rwxr-xr-x | tests/futility/test_update.sh | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c index 7e57b97d..47a734aa 100644 --- a/futility/cmd_update.c +++ b/futility/cmd_update.c @@ -1894,7 +1894,7 @@ static int do_update(int argc, char *argv[]) } else if (strcmp(optarg, "factory") == 0 || strcmp(optarg, "factory_install") == 0) { cfg.try_update = 0; - if (!is_write_protection_enabled(&cfg)) { + if (is_write_protection_enabled(&cfg)) { errorcnt++; Error("Mode %s needs WP disabled.\n", optarg); diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh index 44530abb..119974f1 100755 --- a/tests/futility/test_update.sh +++ b/tests/futility/test_update.sh @@ -220,6 +220,15 @@ test_update "RW update (vboot1, B->B)" \ "${FROM_IMAGE}" "${TMP}.expected.b" \ -i "${TO_IMAGE}" -t --wp=1 --sys_props 1,0 --sys_props 0,0x10001,0 +# Test 'factory mode' +test_update "Factory mode update (WP=0)" \ + "${FROM_IMAGE}" "${TMP}.expected.full" \ + -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1 + +test_update "Factory mode update (WP=1)" \ + "${FROM_IMAGE}" "!needs WP disabled" \ + -i "${TO_IMAGE}" --wp=1 --sys_props 0,0x10001,1 + # Test legacy update test_update "Legacy update" \ "${FROM_IMAGE}" "${TMP}.expected.legacy" \ |