xref: /openbmc/linux/lib/kunit/hooks-impl.h (revision e047c5ea)
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. */
187170b7edSDavid Gow void __kunit_fail_current_test_impl(const char *file, int line, const char *fmt, ...);
19*e047c5eaSDavid Gow void *__kunit_get_static_stub_address_impl(struct kunit *test, void *real_fn_addr);
207170b7edSDavid Gow 
217170b7edSDavid Gow /* Code to set all of the function pointers. */
227170b7edSDavid Gow static inline void kunit_install_hooks(void)
237170b7edSDavid Gow {
247170b7edSDavid Gow 	/* Install the KUnit hook functions. */
257170b7edSDavid Gow 	kunit_hooks.fail_current_test = __kunit_fail_current_test_impl;
26*e047c5eaSDavid Gow 	kunit_hooks.get_static_stub_address = __kunit_get_static_stub_address_impl;
277170b7edSDavid Gow }
287170b7edSDavid Gow 
297170b7edSDavid Gow #endif /* _KUNIT_HOOKS_IMPL_H */
30