diff options
author | Bill Richardson <wfrichar@chromium.org> | 2012-04-30 11:33:13 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-05-02 22:34:32 -0700 |
commit | 23429d3d782f7506fb4747356974294cce08ac47 (patch) | |
tree | 2c98d253f97d92b3c48ea3d87d4375e64f8ea4cd /tests/run_cgpt_tests.sh | |
parent | 81f704edad78f03deed5ef899a55e9d0c28dd16c (diff) | |
download | vboot-23429d3d782f7506fb4747356974294cce08ac47.tar.gz |
Let cgpt open devices in read-only mode when possible.
BUG=chromium-os:12430
TEST=manual
Running "make; make runtests" in src/platform/vboot_refererence will test
this change. Tests for use on a Chromebook are described in the bug report,
but will require a USB or SD card that has a physical write-protect switch.
Change-Id: I16a67bad3b59bec0981f4064f51fb1a29da65a90
Reviewed-on: https://gerrit.chromium.org/gerrit/21474
Tested-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'tests/run_cgpt_tests.sh')
-rwxr-xr-x | tests/run_cgpt_tests.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/run_cgpt_tests.sh b/tests/run_cgpt_tests.sh index ffd6f68d..8b792b4e 100755 --- a/tests/run_cgpt_tests.sh +++ b/tests/run_cgpt_tests.sh @@ -21,6 +21,7 @@ cd "$DIR" echo "Create an empty file to use as the device..." NUM_SECTORS=1000 DEV=fake_dev.bin +rm -f ${DEV} dd if=/dev/zero of=${DEV} conv=notrunc bs=512 count=${NUM_SECTORS} 2>/dev/null @@ -232,6 +233,28 @@ assert_pri 13 13 14 12 15 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 1 1 1 $GPT prioritize -i 1 -f ${DEV} assert_pri 15 15 13 12 14 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 1 1 1 1 0 + +# Now make sure that we don't need write access if we're just looking. +echo "Test read vs read-write access..." +chmod 0444 ${DEV} + +# These should fail +$GPT create -z ${DEV} 2>/dev/null && error +$GPT add -i 2 -P 3 ${DEV} 2>/dev/null && error +$GPT repair ${DEV} 2>/dev/null && error +$GPT prioritize -i 3 ${DEV} 2>/dev/null && error + +# Most 'boot' usage should fail too. +$GPT boot -p ${DEV} 2>/dev/null && error +dd if=/dev/zero of=fake_mbr.bin bs=100 count=1 2>/dev/null +$GPT boot -b fake_mbr.bin ${DEV} 2>/dev/null && error +$GPT boot -i 2 ${DEV} 2>/dev/null && error + +# These should pass +$GPT boot ${DEV} >/dev/null +$GPT show ${DEV} >/dev/null +$GPT find -t kernel ${DEV} >/dev/null + echo "Done." happy "All tests passed." |