summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2011-10-13 18:14:27 -0700
committerGabe Black (Do Not Use) <gabeblack@google.com>2011-10-14 11:30:13 -0700
commit9d0f325ee021813e7a0f2028536ef26300b09ae4 (patch)
tree2aad1eaf3571faaa62bdbd5fcbaae91924312021 /common
parenta383d751f8e6f71d64be79b50df1e247d20ce4a6 (diff)
Extend the vboot_test memwipe to test the new memory wipe API
BUG=None TEST=Ran vboot_test memwipe on Stumpy and saw it pass. Change-Id: Ibac1d9ae10804b87b31127af2f60cb6d3dd565c7 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: http://gerrit.chromium.org/gerrit/10068 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_vboot_test.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/common/cmd_vboot_test.c b/common/cmd_vboot_test.c
index ff8b9efbb3f..41963953aba 100644
--- a/common/cmd_vboot_test.c
+++ b/common/cmd_vboot_test.c
@@ -119,31 +119,51 @@ static int do_vboot_test_memwipe(cmd_tbl_t *cmdtp,
{
memory_wipe_t wipe;
char s[] = "ABCDEFGHIJ";
- const char r[] = "\0BCDEFGH\0J";
+ const char r[] = "\0BCDE\0GHIJ";
const size_t size = strlen(s);
uintptr_t base = (uintptr_t)s;
memory_wipe_init(&wipe);
- memory_wipe_add(&wipe, base, base + size);
- /* Result: ---------- */
+ memory_wipe_add(&wipe, base + 0, base + 1);
+ /* Result: -BCDEFGHIJ */
memory_wipe_sub(&wipe, base + 1, base + 2);
- /* Result: -B-------- */
- memory_wipe_sub(&wipe, base + 5, base + 7);
- /* Result: -B---FG--- */
- memory_wipe_sub(&wipe, base + 2, base + 3);
- /* Result: -BC--FG--- */
- memory_wipe_sub(&wipe, base + 9, base + 10);
- /* Result: -BC--FG--J */
- memory_wipe_sub(&wipe, base + 4, base + 6);
- /* Result: -BC-EFG--J */
+ /* Result: -BCDEFGHIJ */
+ memory_wipe_add(&wipe, base + 1, base + 2);
+ /* Result: --CDEFGHIJ */
+ memory_wipe_sub(&wipe, base + 1, base + 2);
+ /* Result: -BCDEFGHIJ */
+ memory_wipe_add(&wipe, base + 0, base + 2);
+ /* Result: --CDEFGHIJ */
+ memory_wipe_sub(&wipe, base + 1, base + 3);
+ /* Result: -BCDEFGHIJ */
+ memory_wipe_add(&wipe, base + 4, base + 6);
+ /* Result: -BCD--GHIJ */
+ memory_wipe_add(&wipe, base + 3, base + 4);
+ /* Result: -BC---GHIJ */
+ memory_wipe_sub(&wipe, base + 3, base + 7);
+ /* Result: -BCDEFGHIJ */
+ memory_wipe_add(&wipe, base + 2, base + 8);
+ /* Result: -B------IJ */
+ memory_wipe_sub(&wipe, base + 1, base + 9);
+ /* Result: -BCDEFGHIJ */
+ memory_wipe_add(&wipe, base + 4, base + 7);
+ /* Result: -BCD---HIJ */
memory_wipe_sub(&wipe, base + 3, base + 5);
- /* Result: -BCDEFG--J */
- memory_wipe_sub(&wipe, base + 2, base + 8);
- /* Result: -BCDEFGH-J */
+ /* Result: -BCDE--HIJ */
+ memory_wipe_sub(&wipe, base + 6, base + 8);
+ /* Result: -BCDE-GHIJ */
memory_wipe_execute(&wipe);
if (memcmp(s, r, size)) {
- VbExDebug("Failed to wipe the expected regions!\n");
+ int i;
+
+ VbExDebug("Expected: ");
+ for (i = 0; i < size; i++)
+ VbExDebug("%c", r[i] ? r[i] : '-');
+ VbExDebug("\nGot: ");
+ for (i = 0; i < size; i++)
+ VbExDebug("%c", s[i] ? s[i] : '-');
+ VbExDebug("\nFailed to wipe the expected regions!\n");
return 1;
}