summaryrefslogtreecommitdiff
path: root/tests/vboot_kernel_tests.c
diff options
context:
space:
mode:
authorDan Ehrenberg <dehrenberg@chromium.org>2014-11-06 16:22:24 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-14 22:46:54 +0000
commita524a3a51591618c1395cb9e1238ee72b3f5e767 (patch)
treee3ba27f590375e71ff40d8df29c9e04466a743bb /tests/vboot_kernel_tests.c
parent837b408c92d02108cbb16a97769675f39598d576 (diff)
downloadvboot-a524a3a51591618c1395cb9e1238ee72b3f5e767.tar.gz
vboot: cgpt: fix my_lba of the secondary GPT
Previously, my_lba of the secondary GPT was recorded as if that GPT was written at the end of the device. This patch tweaks my_lba to report where it is in the random-access GPT address space, namely at the end of that space. TEST=Compiled it into the firmware and observed the firmware to update the my_lba field of the secondary GPT. BRANCH=none BUG=chromium:425677 Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org> Change-Id: I88791fb2cff1086351ca8a3adeef675c4a88cc9a Reviewed-on: https://chromium-review.googlesource.com/228942 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Daniel Ehrenberg <dehrenberg@chromium.org> Tested-by: Daniel Ehrenberg <dehrenberg@chromium.org>
Diffstat (limited to 'tests/vboot_kernel_tests.c')
-rw-r--r--tests/vboot_kernel_tests.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index 05035f28..c546ed12 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -316,9 +316,11 @@ static void ReadWriteGptTest(void)
TEST_EQ(AllocAndReadGptData(handle, &g), 0,
"AllocAndRead primary invalid");
TEST_EQ(CheckHeader(mock_gpt_primary, 0, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 1, "Primary header is invalid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 1, "Primary header is invalid");
TEST_EQ(CheckHeader(mock_gpt_secondary, 1, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 0, "Secondary header is valid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 0, "Secondary header is valid");
TEST_CALLS("VbExDiskRead(h, 1, 1)\n"
"VbExDiskRead(h, 1023, 1)\n"
"VbExDiskRead(h, 991, 32)\n");
@@ -333,9 +335,11 @@ static void ReadWriteGptTest(void)
TEST_EQ(AllocAndReadGptData(handle, &g), 0,
"AllocAndRead secondary invalid");
TEST_EQ(CheckHeader(mock_gpt_primary, 0, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 0, "Primary header is valid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 0, "Primary header is valid");
TEST_EQ(CheckHeader(mock_gpt_secondary, 1, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 1, "Secondary header is invalid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 1, "Secondary header is invalid");
TEST_CALLS("VbExDiskRead(h, 1, 1)\n"
"VbExDiskRead(h, 2, 32)\n"
"VbExDiskRead(h, 1023, 1)\n");
@@ -351,9 +355,11 @@ static void ReadWriteGptTest(void)
TEST_EQ(AllocAndReadGptData(handle, &g), 1,
"AllocAndRead primary and secondary invalid");
TEST_EQ(CheckHeader(mock_gpt_primary, 0, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 1, "Primary header is invalid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 1, "Primary header is invalid");
TEST_EQ(CheckHeader(mock_gpt_secondary, 1, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 1, "Secondary header is invalid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 1, "Secondary header is invalid");
TEST_CALLS("VbExDiskRead(h, 1, 1)\n"
"VbExDiskRead(h, 1023, 1)\n");
WriteAndFreeGptData(handle, &g);
@@ -380,7 +386,8 @@ static void ReadWriteGptTest(void)
"VbExDiskWrite(h, 1, 1)\n"
"VbExDiskWrite(h, 2, 32)\n");
TEST_EQ(CheckHeader(mock_gpt_primary, 0, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 0, "Fix Primary GPT: Primary header is valid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 0, "Fix Primary GPT: Primary header is valid");
/*
* Invalidate secondary GPT header and check that it can be
@@ -404,7 +411,8 @@ static void ReadWriteGptTest(void)
"VbExDiskWrite(h, 1023, 1)\n"
"VbExDiskWrite(h, 991, 32)\n");
TEST_EQ(CheckHeader(mock_gpt_secondary, 1, g.drive_sectors,
- GPT_STORED_ON_DEVICE), 0, "Fix Secondary GPT: Secondary header is valid");
+ g.gpt_drive_sectors, GPT_STORED_ON_DEVICE),
+ 0, "Fix Secondary GPT: Secondary header is valid");
/* Data which is changed is written */
ResetMocks();