summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/include/vboot_api.h5
-rw-r--r--firmware/lib/vboot_api_kernel.c3
-rw-r--r--firmware/stub/vboot_api_stub_init.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 53105407..7e94773e 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -37,6 +37,11 @@
typedef uint32_t VbError_t;
/*
+ * Define test_mockable for mocking functions.
+ */
+#define test_mockable __attribute__((weak))
+
+/*
* Predefined error numbers. Success is 0. Errors are non-zero, but differ
* between functions. For example, the TPM functions may pass through TPM
* error codes, some of which may be recoverable.
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 0fd1fa3e..312014bd 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -238,7 +238,8 @@ int VbUserConfirms(VbCommonParams *cparams, uint32_t confirm_flags)
return -1;
}
-VbError_t VbBootNormal(VbCommonParams *cparams, LoadKernelParams *p)
+VbError_t test_mockable
+VbBootNormal(VbCommonParams *cparams, LoadKernelParams *p)
{
/* Boot from fixed disk only */
VBDEBUG(("Entering %s()\n", __func__));
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index 9e4f6370..34387837 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -61,7 +61,7 @@ uint64_t VbExGetTimer(void)
return (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec;
}
-VbError_t VbExNvStorageRead(uint8_t *buf)
+VbError_t test_mockable VbExNvStorageRead(uint8_t *buf)
{
return VBERROR_SUCCESS;
}