xref: /openbmc/linux/lib/kunit/hooks-impl.h (revision 82649c7c)
17170b7edSDavid Gow /* SPDX-License-Identifier: GPL-2.0 */
27170b7edSDavid Gow /*
37170b7edSDavid Gow  * Declarations for hook implementations.
47170b7edSDavid Gow  *
57170b7edSDavid Gow  * These will be set as the function pointers in struct kunit_hook_table,
67170b7edSDavid Gow  * found in include/kunit/test-bug.h.
77170b7edSDavid Gow  *
87170b7edSDavid Gow  * Copyright (C) 2023, Google LLC.
97170b7edSDavid Gow  * Author: David Gow <davidgow@google.com>
107170b7edSDavid Gow  */
117170b7edSDavid Gow 
127170b7edSDavid Gow #ifndef _KUNIT_HOOKS_IMPL_H
137170b7edSDavid Gow #define _KUNIT_HOOKS_IMPL_H
147170b7edSDavid Gow 
157170b7edSDavid Gow #include <kunit/test-bug.h>
167170b7edSDavid Gow 
177170b7edSDavid Gow /* List of declarations. */
18*82649c7cSDavid Gow void __printf(3, 4) __kunit_fail_current_test_impl(const char *file,
19*82649c7cSDavid Gow 						   int line,
20*82649c7cSDavid Gow 						   const char *fmt, ...);
21e047c5eaSDavid Gow void *__kunit_get_static_stub_address_impl(struct kunit *test, void *real_fn_addr);
227170b7edSDavid Gow 
237170b7edSDavid Gow /* Code to set all of the function pointers. */
kunit_install_hooks(void)247170b7edSDavid Gow static inline void kunit_install_hooks(void)
257170b7edSDavid Gow {
267170b7edSDavid Gow 	/* Install the KUnit hook functions. */
277170b7edSDavid Gow 	kunit_hooks.fail_current_test = __kunit_fail_current_test_impl;
28e047c5eaSDavid Gow 	kunit_hooks.get_static_stub_address = __kunit_get_static_stub_address_impl;
297170b7edSDavid Gow }
307170b7edSDavid Gow 
317170b7edSDavid Gow #endif /* _KUNIT_HOOKS_IMPL_H */
32