summaryrefslogtreecommitdiff
path: root/payloads/libpayload/tests/mocks/die.c
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2021-11-15 08:36:07 +0000
committerFelix Held <felix-coreboot@felixheld.de>2022-01-10 14:30:04 +0000
commit63e54275f684da6f6db8289561726adab5254b39 (patch)
treea01a1b40170f88ef0036585564eb30ac8b57ef48 /payloads/libpayload/tests/mocks/die.c
parent1fa3da4d9b30ad7e63b79b6966794ee179dc6501 (diff)
libpayload: Implement new CBFS access API
This commit adds new CBFS API, which is based on the one available in the main coreboot source tree. Libpayload implementation supports RO/RW file lookups and file contents verification. Change-Id: I00da0658dbac0cddf92ad55611def947932d23c7 Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/59497 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/tests/mocks/die.c')
-rw-r--r--payloads/libpayload/tests/mocks/die.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/payloads/libpayload/tests/mocks/die.c b/payloads/libpayload/tests/mocks/die.c
new file mode 100644
index 0000000000..a67105a12b
--- /dev/null
+++ b/payloads/libpayload/tests/mocks/die.c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <tests/test.h>
+#include <stdbool.h>
+
+void die_work(const char *file, const char *func, int line, const char *fmt, ...)
+{
+ /* Failing asserts are jumping to the user code (test) if expect_assert_failed() was
+ previously called. Otherwise it jumps to the cmocka code and fails the test. */
+ mock_assert(false, "Mock assetion called", file, line);
+
+ /* Should never be reached */
+ print_error("%s() called...\n", __func__);
+ while (1)
+ ;
+}