summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-05-07 12:59:47 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-14 20:13:04 -0700
commit52fa8c11f8e5217e17da74c04e8ad1e5aee9ff40 (patch)
treea4894fe06a3f1c9fcbbfe728955f75a8de59ed93 /tests
parent88a47ff99952bb4f270a4e80c80c578e39fb9477 (diff)
downloadvboot-52fa8c11f8e5217e17da74c04e8ad1e5aee9ff40.tar.gz
Makefile: Enable more warnings for host utilities / tests
This patch adds a bunch of more warnings that are already enabled in coreboot and thus already enabled for firmware builds anyway (because coreboot just passes its CFLAGS through). Enabling it in the vboot Makefile means they also apply to host utilities and tests, which sounds desirable for consistency. Fix enough of the cruft and bad coding practices that accumulated over the years of not having warnings enabled to get it to build again (this includes making functions static, removing dead code, cleaning up prototypes, etc.). Also remove -fno-strict-aliasing from the x86 firmware build options, because it's not clear why it's there (coreboot isn't doing this, so presumably it's not needed). BRANCH=None BUG=None TEST=make runtests Change-Id: Ie4a42083c4770a4eca133b22725be9ba85b24184 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1598721 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bdb_sprw_test.c6
-rw-r--r--tests/bdb_test.c16
-rw-r--r--tests/cgptlib_test.c4
-rw-r--r--tests/cgptlib_test.h2
-rw-r--r--tests/crc32_test.c2
-rw-r--r--tests/crc32_test.h2
-rw-r--r--tests/ec_sync_tests.c2
-rw-r--r--tests/futility/test_file_types.c2
-rw-r--r--tests/sha_test_vectors.h6
-rw-r--r--tests/tlcl_tests.c10
-rw-r--r--tests/tpm_lite/tlcl_tests.c2
-rw-r--r--tests/vb20_common2_tests.c2
-rw-r--r--tests/vb20_common3_tests.c4
-rw-r--r--tests/vb20_kernel_tests.c4
-rw-r--r--tests/vb21_api_tests.c4
-rw-r--r--tests/vb21_common2_tests.c2
-rw-r--r--tests/vb21_misc_tests.c2
-rw-r--r--tests/vb2_nvstorage_tests.c2
-rw-r--r--tests/vb2_rsa_utility_tests.c12
-rw-r--r--tests/vb2_sha_tests.c8
-rw-r--r--tests/vboot_api_devmode_tests.c2
-rw-r--r--tests/vboot_api_kernel2_tests.c8
-rw-r--r--tests/vboot_api_kernel4_tests.c8
-rw-r--r--tests/vboot_api_kernel6_tests.c1
-rw-r--r--tests/vboot_api_kernel_tests.c11
-rw-r--r--tests/vboot_detach_menu_tests.c12
-rw-r--r--tests/vboot_kernel_tests.c7
27 files changed, 65 insertions, 78 deletions
diff --git a/tests/bdb_sprw_test.c b/tests/bdb_sprw_test.c
index 1f5be951..8395275c 100644
--- a/tests/bdb_sprw_test.c
+++ b/tests/bdb_sprw_test.c
@@ -59,9 +59,9 @@ static struct bdb_header *create_bdb(const char *key_dir,
.oem_area_0_size = sizeof(oem_area_0),
.oem_area_1 = oem_area_1,
.oem_area_1_size = sizeof(oem_area_1),
- .header_sig_description = "The header sig",
- .data_sig_description = "The data sig",
- .data_description = "Test BDB data",
+ .header_sig_description = (char *)"The header sig",
+ .data_sig_description = (char *)"The data sig",
+ .data_description = (char *)"Test BDB data",
.data_version = 3,
.hash = hash,
.num_hashes = num_hashes,
diff --git a/tests/bdb_test.c b/tests/bdb_test.c
index 0dd76190..693d6191 100644
--- a/tests/bdb_test.c
+++ b/tests/bdb_test.c
@@ -14,7 +14,7 @@
#include "host.h"
#include "test_common.h"
-void check_header_tests(void)
+static void check_header_tests(void)
{
struct bdb_header sgood = {
.struct_magic = BDB_HEADER_MAGIC,
@@ -58,7 +58,7 @@ void check_header_tests(void)
TEST_EQ_S(bdb_check_header(&s, ssize), BDB_ERROR_BDB_SIZE);
}
-void check_key_tests(void)
+static void check_key_tests(void)
{
struct bdb_key sgood = {
.struct_magic = BDB_KEY_MAGIC,
@@ -119,7 +119,7 @@ void check_key_tests(void)
TEST_EQ_S(bdb_check_key(&s, ssize), BDB_ERROR_SIG_ALG);
}
-void check_sig_tests(void)
+static void check_sig_tests(void)
{
struct bdb_sig sgood = {
.struct_magic = BDB_SIG_MAGIC,
@@ -179,7 +179,7 @@ void check_sig_tests(void)
TEST_EQ_S(bdb_check_sig(&s, ssize), BDB_ERROR_SIG_ALG);
}
-void check_data_tests(void)
+static void check_data_tests(void)
{
struct bdb_data sgood = {
.struct_magic = BDB_DATA_MAGIC,
@@ -248,7 +248,7 @@ void check_data_tests(void)
/**
* Test bdb_verify() and bdb_create()
*/
-void check_bdb_verify(const char *key_dir)
+static void check_bdb_verify(const char *key_dir)
{
uint8_t oem_area_0[32] = "Some OEM area.";
uint8_t oem_area_1[64] = "Some other OEM area.";
@@ -279,9 +279,9 @@ void check_bdb_verify(const char *key_dir)
.oem_area_0_size = sizeof(oem_area_0),
.oem_area_1 = oem_area_1,
.oem_area_1_size = sizeof(oem_area_1),
- .header_sig_description = "The header sig",
- .data_sig_description = "The data sig",
- .data_description = "Test BDB data",
+ .header_sig_description = (char *)"The header sig",
+ .data_sig_description = (char *)"The data sig",
+ .data_description = (char *)"Test BDB data",
.data_version = 3,
.hash = hash,
.num_hashes = 2,
diff --git a/tests/cgptlib_test.c b/tests/cgptlib_test.c
index a886174d..669f7969 100644
--- a/tests/cgptlib_test.c
+++ b/tests/cgptlib_test.c
@@ -1645,7 +1645,7 @@ static int ErrorTextTest(void)
return TEST_OK;
}
-static int CheckHeaderOffDevice()
+static int CheckHeaderOffDevice(void)
{
GptData* gpt = GetEmptyGptData();
BuildTestGptData(gpt);
@@ -1711,7 +1711,7 @@ int main(int argc, char *argv[])
int i;
int error_count = 0;
struct {
- char *name;
+ const char *name;
test_func fp;
int retval;
} test_cases[] = {
diff --git a/tests/cgptlib_test.h b/tests/cgptlib_test.h
index 90e76fc8..0f226bd3 100644
--- a/tests/cgptlib_test.h
+++ b/tests/cgptlib_test.h
@@ -14,7 +14,7 @@ enum {
};
#define TEST_CASE(func) #func, func
-typedef int (*test_func)();
+typedef int (*test_func)(void);
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
diff --git a/tests/crc32_test.c b/tests/crc32_test.c
index 81bdba98..a9631a58 100644
--- a/tests/crc32_test.c
+++ b/tests/crc32_test.c
@@ -11,7 +11,7 @@
#define MAX_VECTOR_LEN 256
-int TestCrc32TestVectors() {
+int TestCrc32TestVectors(void) {
struct {
uint8_t vector[MAX_VECTOR_LEN];
int len;
diff --git a/tests/crc32_test.h b/tests/crc32_test.h
index 493d34ea..18530f98 100644
--- a/tests/crc32_test.h
+++ b/tests/crc32_test.h
@@ -5,6 +5,6 @@
#ifndef VBOOT_REFERENCE_CRC32_TEST_H_
#define VBOOT_REFERENCE_CRC32_TEST_H_
-int TestCrc32TestVectors();
+int TestCrc32TestVectors(void);
#endif /* VBOOT_REFERENCE_CRC32_TEST_H_ */
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index a971b961..571eef67 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -202,7 +202,7 @@ VbError_t VbExEcUpdateImage(int devidx, enum VbSelectFirmware_t select,
return update_retval;
}
-VbError_t VbDisplayScreen(struct vb2_context *ctx, uint32_t screen, int force,
+VbError_t VbDisplayScreen(struct vb2_context *c, uint32_t screen, int force,
const VbScreenData *data)
{
if (screens_count < ARRAY_SIZE(screens_displayed))
diff --git a/tests/futility/test_file_types.c b/tests/futility/test_file_types.c
index 2bf27887..c77802bd 100644
--- a/tests/futility/test_file_types.c
+++ b/tests/futility/test_file_types.c
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
{
char filename[PATH_MAX];
char status[80];
- char *srcdir;
+ const char *srcdir;
enum futil_file_type type;
int i;
diff --git a/tests/sha_test_vectors.h b/tests/sha_test_vectors.h
index 9214799e..d2532b9f 100644
--- a/tests/sha_test_vectors.h
+++ b/tests/sha_test_vectors.h
@@ -8,10 +8,10 @@
#ifndef VBOOT_REFERENCE_SHA_TEST_VECTORS_H_
#define VBOOT_REFERENCE_SHA_TEST_VECTORS_H_
-char* oneblock_msg = "abc";
-char* multiblock_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkl"
+const char* oneblock_msg = "abc";
+const char* multiblock_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkl"
"jklmklmnlmnomnopnopq";
-char* multiblock_msg2= "abcdefghbcdefghicdefghijdefghijkefghi"
+const char* multiblock_msg2= "abcdefghbcdefghicdefghijdefghijkefghi"
"jklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnop"
"qrsmnopqrstnopqrstu";
char* long_msg;
diff --git a/tests/tlcl_tests.c b/tests/tlcl_tests.c
index 00eae615..f9f990d9 100644
--- a/tests/tlcl_tests.c
+++ b/tests/tlcl_tests.c
@@ -273,7 +273,7 @@ static void ReadWriteTest(void)
/**
* Test DefineSpaceEx
*/
-void DefineSpaceExTest(void) {
+static void DefineSpaceExTest(void) {
uint8_t osap_response[] = {
0x00, 0xc4, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
0x00, 0x00, 0x02, 0x41, 0x3d, 0xce, 0x20, 0xa2,
@@ -367,7 +367,7 @@ void DefineSpaceExTest(void) {
/**
* Test TlclInitNvAuthPolicy.
*/
-void InitNvAuthPolicyTest(void) {
+static void InitNvAuthPolicyTest(void) {
const uint8_t empty_selection_digest[] = {
0x79, 0xdd, 0xda, 0xfd, 0xc1, 0x97, 0xdc, 0xcc,
0xe9, 0x98, 0x9a, 0xee, 0xf5, 0x52, 0x89, 0xee,
@@ -798,7 +798,7 @@ static void IFXFieldUpgradeInfoTest(void)
/**
* Test ReadPubek
*/
-void ReadPubekTest(void) {
+static void ReadPubekTest(void) {
uint8_t response[] = {
0x00, 0xc4, 0x00, 0x00, 0x01, 0x3a, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03,
@@ -922,7 +922,7 @@ void ReadPubekTest(void) {
/**
* Test TakeOwnership
*/
-void TakeOwnershipTest(void) {
+static void TakeOwnershipTest(void) {
uint8_t oiap_response[] = {
0x00, 0xc4, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00,
0x00, 0x00, 0x00, 0x4c, 0x04, 0x1a, 0x18, 0xa9,
@@ -1071,7 +1071,7 @@ void TakeOwnershipTest(void) {
/**
* Test ReadDelegationFamilyTable
*/
-void ReadDelegationFamilyTableTest(void) {
+static void ReadDelegationFamilyTableTest(void) {
uint8_t response[] = {
0x00, 0xc4, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x25,
diff --git a/tests/tpm_lite/tlcl_tests.c b/tests/tpm_lite/tlcl_tests.c
index c164f4fe..353b16c6 100644
--- a/tests/tpm_lite/tlcl_tests.c
+++ b/tests/tpm_lite/tlcl_tests.c
@@ -14,7 +14,7 @@
const char* resilient_startup = NULL;
uint32_t TlclStartupIfNeeded(void) {
- static char* null_getenv = "some string"; /* just a unique address */
+ static const char* null_getenv = "some string"; /* a unique address */
uint32_t result = TlclStartup();
if (resilient_startup == NULL) {
resilient_startup = getenv("TLCL_RESILIENT_STARTUP");
diff --git a/tests/vb20_common2_tests.c b/tests/vb20_common2_tests.c
index 2dea3172..39e4c06f 100644
--- a/tests/vb20_common2_tests.c
+++ b/tests/vb20_common2_tests.c
@@ -139,7 +139,7 @@ static void test_verify_data(const struct vb2_packed_key *key1,
}
-int test_algorithm(int key_algorithm, const char *keys_dir)
+static int test_algorithm(int key_algorithm, const char *keys_dir)
{
char filename[1024];
struct vb2_private_key *private_key = NULL;
diff --git a/tests/vb20_common3_tests.c b/tests/vb20_common3_tests.c
index 5533124a..255889f3 100644
--- a/tests/vb20_common3_tests.c
+++ b/tests/vb20_common3_tests.c
@@ -509,8 +509,8 @@ static void test_verify_kernel_preamble(
free(body_sig);
}
-int test_permutation(int signing_key_algorithm, int data_key_algorithm,
- const char *keys_dir)
+static int test_permutation(int signing_key_algorithm, int data_key_algorithm,
+ const char *keys_dir)
{
char filename[1024];
int retval = 1;
diff --git a/tests/vb20_kernel_tests.c b/tests/vb20_kernel_tests.c
index 213b9e68..6d936285 100644
--- a/tests/vb20_kernel_tests.c
+++ b/tests/vb20_kernel_tests.c
@@ -178,7 +178,7 @@ int vb2_unpack_key_buffer(struct vb2_public_key *key,
int vb2_verify_keyblock(struct vb2_keyblock *block,
uint32_t size,
const struct vb2_public_key *key,
- const struct vb2_workbuf *wb)
+ const struct vb2_workbuf *w)
{
return mock_verify_keyblock_retval;
}
@@ -186,7 +186,7 @@ int vb2_verify_keyblock(struct vb2_keyblock *block,
int vb2_verify_kernel_preamble(struct vb2_kernel_preamble *preamble,
uint32_t size,
const struct vb2_public_key *key,
- const struct vb2_workbuf *wb)
+ const struct vb2_workbuf *w)
{
return mock_verify_preamble_retval;
}
diff --git a/tests/vb21_api_tests.c b/tests/vb21_api_tests.c
index 89e683b0..18809400 100644
--- a/tests/vb21_api_tests.c
+++ b/tests/vb21_api_tests.c
@@ -124,12 +124,12 @@ static void reset_common_data(enum reset_type t)
/* Mocked functions */
-int vb21_load_fw_keyblock(struct vb2_context *ctx)
+int vb21_load_fw_keyblock(struct vb2_context *c)
{
return retval_vb21_load_fw_keyblock;
}
-int vb21_load_fw_preamble(struct vb2_context *ctx)
+int vb21_load_fw_preamble(struct vb2_context *c)
{
return retval_vb21_load_fw_preamble;
}
diff --git a/tests/vb21_common2_tests.c b/tests/vb21_common2_tests.c
index 5a867ee2..e74ad0a4 100644
--- a/tests/vb21_common2_tests.c
+++ b/tests/vb21_common2_tests.c
@@ -237,7 +237,7 @@ static void test_verify_data(const struct vb2_public_key *pubk_orig,
free(buf2);
}
-int test_algorithm(int key_algorithm, const char *keys_dir)
+static int test_algorithm(int key_algorithm, const char *keys_dir)
{
char filename[1024];
diff --git a/tests/vb21_misc_tests.c b/tests/vb21_misc_tests.c
index c33432d9..8cc3bbbc 100644
--- a/tests/vb21_misc_tests.c
+++ b/tests/vb21_misc_tests.c
@@ -119,7 +119,7 @@ static void reset_common_data(enum reset_type t)
/* Mocked functions */
-int vb2ex_read_resource(struct vb2_context *ctx,
+int vb2ex_read_resource(struct vb2_context *c,
enum vb2_resource_index index,
uint32_t offset,
void *buf,
diff --git a/tests/vb2_nvstorage_tests.c b/tests/vb2_nvstorage_tests.c
index 1dccdade..c63dd30d 100644
--- a/tests/vb2_nvstorage_tests.c
+++ b/tests/vb2_nvstorage_tests.c
@@ -27,7 +27,7 @@ struct nv_field {
uint32_t default_value; /* Expected default value */
uint32_t test_value; /* Value to test writing */
uint32_t test_value2; /* Second value to test writing */
- char *desc; /* Field description */
+ const char *desc; /* Field description */
};
/* Array of fields to test, terminated with a field with desc==NULL. */
diff --git a/tests/vb2_rsa_utility_tests.c b/tests/vb2_rsa_utility_tests.c
index 63307b1a..58203b23 100644
--- a/tests/vb2_rsa_utility_tests.c
+++ b/tests/vb2_rsa_utility_tests.c
@@ -16,17 +16,7 @@
#include "test_common.h"
#include "utility.h"
#include "vboot_api.h"
-
-/*
- * Internal functions from 2rsa.c that have error conditions we can't trigger
- * from the public APIs. These include checks for bad algorithms where the
- * next call level up already checks for bad algorithms, etc.
- *
- * These functions aren't in 2rsa.h because they're not part of the public
- * APIs.
- */
-int vb2_mont_ge(const struct vb2_public_key *key, uint32_t *a);
-int vb2_check_padding(const uint8_t *sig, const struct vb2_public_key *key);
+#include "vboot_test.h"
/**
* Test RSA utility funcs
diff --git a/tests/vb2_sha_tests.c b/tests/vb2_sha_tests.c
index 54bca66f..6eae02ff 100644
--- a/tests/vb2_sha_tests.c
+++ b/tests/vb2_sha_tests.c
@@ -15,7 +15,7 @@
#include "sha_test_vectors.h"
#include "test_common.h"
-void sha1_tests(void)
+static void sha1_tests(void)
{
uint8_t digest[VB2_SHA1_DIGEST_SIZE];
uint8_t *test_inputs[3];
@@ -45,7 +45,7 @@ void sha1_tests(void)
"vb2_hash_block_size(VB2_HASH_SHA1)");
}
-void sha256_tests(void)
+static void sha256_tests(void)
{
uint8_t digest[VB2_SHA256_DIGEST_SIZE];
uint8_t *test_inputs[3];
@@ -101,7 +101,7 @@ void sha256_tests(void)
TEST_SUCC(memcmp(digest, expected_extend, sizeof(digest)), NULL);
}
-void sha512_tests(void)
+static void sha512_tests(void)
{
uint8_t digest[VB2_SHA512_DIGEST_SIZE];
uint8_t *test_inputs[3];
@@ -131,7 +131,7 @@ void sha512_tests(void)
"vb2_hash_block_size(VB2_HASH_SHA512)");
}
-void misc_tests(void)
+static void misc_tests(void)
{
uint8_t digest[VB2_SHA512_DIGEST_SIZE];
struct vb2_digest_context dc;
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 73e938ad..9d20e322 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -39,7 +39,7 @@ typedef struct {
} note_event_t;
typedef struct {
- char *name;
+ const char *name;
uint32_t gbb_flags;
VbError_t beep_return;
uint32_t keypress_key;
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 889d2cba..a3cbd487 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -23,6 +23,7 @@
#include "vboot_display.h"
#include "vboot_kernel.h"
#include "vboot_struct.h"
+#include "vboot_test.h"
/* Mock data */
static uint8_t shared_data[VB_SHARED_DATA_MIN_SIZE];
@@ -59,9 +60,6 @@ static enum vb2_tpm_mode tpm_mode;
static char set_vendor_data[32];
static int set_vendor_data_called;
-extern enum VbEcBootMode_t VbGetMode(void);
-extern struct RollbackSpaceFwmp *VbApiKernelGetFwmp(void);
-
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
@@ -214,12 +212,12 @@ int vb2_audio_looping(void)
return 1;
}
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *c, uint32_t get_info_flags)
{
return vbtlk_retval + get_info_flags;
}
-VbError_t VbDisplayScreen(struct vb2_context *ctx, uint32_t screen, int force,
+VbError_t VbDisplayScreen(struct vb2_context *c, uint32_t screen, int force,
const VbScreenData *data)
{
if (screens_count < ARRAY_SIZE(screens_displayed))
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index cb2179d5..adad4131 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -131,7 +131,7 @@ uint32_t RollbackFwmpRead(struct RollbackSpaceFwmp *fwmp)
return rfr_retval;
}
-uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
+uint32_t VbTryLoadKernel(struct vb2_context *c, uint32_t get_info_flags)
{
shared->kernel_version_tpm = new_version;
@@ -141,7 +141,7 @@ uint32_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
return vbboot_retval;
}
-VbError_t VbBootDeveloper(struct vb2_context *ctx)
+VbError_t VbBootDeveloper(struct vb2_context *c)
{
shared->kernel_version_tpm = new_version;
@@ -151,7 +151,7 @@ VbError_t VbBootDeveloper(struct vb2_context *ctx)
return vbboot_retval;
}
-VbError_t VbBootRecovery(struct vb2_context *ctx)
+VbError_t VbBootRecovery(struct vb2_context *c)
{
shared->kernel_version_tpm = new_version;
@@ -161,7 +161,7 @@ VbError_t VbBootRecovery(struct vb2_context *ctx)
return vbboot_retval;
}
-VbError_t VbBootDiagnostic(struct vb2_context *ctx)
+VbError_t VbBootDiagnostic(struct vb2_context *c)
{
if (vbboot_retval == -4)
return VBERROR_SIMULATED;
diff --git a/tests/vboot_api_kernel6_tests.c b/tests/vboot_api_kernel6_tests.c
index c44c3c12..27065ac2 100644
--- a/tests/vboot_api_kernel6_tests.c
+++ b/tests/vboot_api_kernel6_tests.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
+#include "rollback_index.h"
#include "test_common.h"
#include "vboot_api.h"
diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c
index 06d7d695..1bc2c9aa 100644
--- a/tests/vboot_api_kernel_tests.c
+++ b/tests/vboot_api_kernel_tests.c
@@ -20,8 +20,7 @@
#include "utility.h"
#include "vboot_api.h"
#include "vboot_kernel.h"
-
-struct LoadKernelParams *VbApiKernelGetParams(void);
+#include "vboot_test.h"
#define MAX_TEST_DISKS 10
#define DEFAULT_COUNT -1
@@ -34,7 +33,7 @@ typedef struct {
} disk_desc_t;
typedef struct {
- char *name;
+ const char *name;
/* inputs for test case */
uint32_t want_flags;
@@ -249,7 +248,7 @@ static void ResetMocks(int i)
t = test + i;
}
-int is_nonzero(const void *vptr, size_t count)
+static int is_nonzero(const void *vptr, size_t count)
{
const char *p = (const char *)vptr;
while (count--)
@@ -319,7 +318,7 @@ VbError_t VbExDiskFreeInfo(VbDiskInfo *infos,
return VBERROR_SUCCESS;
}
-VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
+VbError_t LoadKernel(struct vb2_context *c, LoadKernelParams *params)
{
got_find_disk = (const char *)params->disk_handle;
VB2_DEBUG("%s(%d): got_find_disk = %s\n", __FUNCTION__,
@@ -331,7 +330,7 @@ VbError_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
return t->loadkernel_return_val[load_kernel_calls++];
}
-void vb2_nv_set(struct vb2_context *ctx,
+void vb2_nv_set(struct vb2_context *c,
enum vb2_nv_param param,
uint32_t value)
{
diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c
index 182ba3e2..bf71a5f4 100644
--- a/tests/vboot_detach_menu_tests.c
+++ b/tests/vboot_detach_menu_tests.c
@@ -24,6 +24,7 @@
#include "vboot_display.h"
#include "vboot_kernel.h"
#include "vboot_struct.h"
+#include "vboot_test.h"
#include "vboot_ui_menu_private.h"
/* Mock data */
@@ -59,9 +60,6 @@ static uint32_t beeps_count = 0;
static uint32_t mock_altfw_mask;
static int vbexaltfwmask_called;
-extern enum VbEcBootMode_t VbGetMode(void);
-extern struct RollbackSpaceFwmp *VbApiKernelGetFwmp(void);
-
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
@@ -196,7 +194,7 @@ int vb2_audio_looping(void)
return 1;
}
-VbError_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
+VbError_t VbTryLoadKernel(struct vb2_context *c, uint32_t get_info_flags)
{
if (vbtlk_retval_count < ARRAY_SIZE(vbtlk_retval) &&
vbtlk_retval[vbtlk_retval_count] != 0)
@@ -204,7 +202,7 @@ VbError_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
return vbtlk_last_retval + get_info_flags;
}
-VbError_t VbDisplayScreen(struct vb2_context *ctx, uint32_t screen, int force,
+VbError_t VbDisplayScreen(struct vb2_context *c, uint32_t screen, int force,
const VbScreenData *data)
{
if (screens_count < ARRAY_SIZE(screens_displayed))
@@ -214,7 +212,7 @@ VbError_t VbDisplayScreen(struct vb2_context *ctx, uint32_t screen, int force,
return VBERROR_SUCCESS;
}
-VbError_t VbDisplayMenu(struct vb2_context *ctx, uint32_t screen, int force,
+VbError_t VbDisplayMenu(struct vb2_context *c, uint32_t screen, int force,
uint32_t selected_index, uint32_t disabled_idx_mask)
{
if (screens_count < ARRAY_SIZE(screens_displayed))
@@ -229,7 +227,7 @@ VbError_t VbDisplayMenu(struct vb2_context *ctx, uint32_t screen, int force,
return VBERROR_SUCCESS;
}
-VbError_t VbDisplayDebugInfo(struct vb2_context *ctx)
+VbError_t VbDisplayDebugInfo(struct vb2_context *c)
{
debug_info_displayed = 1;
return VBERROR_SUCCESS;
diff --git a/tests/vboot_kernel_tests.c b/tests/vboot_kernel_tests.c
index a5922eda..e94c5b73 100644
--- a/tests/vboot_kernel_tests.c
+++ b/tests/vboot_kernel_tests.c
@@ -25,6 +25,7 @@
#include "load_kernel_fw.h"
#include "rollback_index.h"
#include "test_common.h"
+#include "vb2_common.h"
#include "vb2_struct.h"
#include "vboot_api.h"
#include "vboot_common.h"
@@ -189,7 +190,7 @@ static void ResetMocks(void)
/* Mocks */
-VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
+VbError_t VbExDiskRead(VbExDiskHandle_t h, uint64_t lba_start,
uint64_t lba_count, void *buffer)
{
LOGCALL("VbExDiskRead(h, %d, %d)\n", (int)lba_start, (int)lba_count);
@@ -203,7 +204,7 @@ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
return VBERROR_SUCCESS;
}
-VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
+VbError_t VbExDiskWrite(VbExDiskHandle_t h, uint64_t lba_start,
uint64_t lba_count, const void *buffer)
{
LOGCALL("VbExDiskWrite(h, %d, %d)\n", (int)lba_start, (int)lba_count);
@@ -567,7 +568,7 @@ static void ReadWriteGptTest(void)
}
-static void TestLoadKernel(int expect_retval, char *test_name)
+static void TestLoadKernel(int expect_retval, const char *test_name)
{
TEST_EQ(LoadKernel(&ctx, &lkp), expect_retval, test_name);
}