blob: 4e71b2d0143babc79c767c06e752bf9170025a7f [file] [log] [blame]
David Gow7170b7e2023-01-28 15:10:07 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Declarations for hook implementations.
4 *
5 * These will be set as the function pointers in struct kunit_hook_table,
6 * found in include/kunit/test-bug.h.
7 *
8 * Copyright (C) 2023, Google LLC.
9 * Author: David Gow <davidgow@google.com>
10 */
11
12#ifndef _KUNIT_HOOKS_IMPL_H
13#define _KUNIT_HOOKS_IMPL_H
14
15#include <kunit/test-bug.h>
16
17/* List of declarations. */
David Gow82649c72023-02-04 12:04:53 +080018void __printf(3, 4) __kunit_fail_current_test_impl(const char *file,
19 int line,
20 const char *fmt, ...);
David Gowe047c5ea2023-01-31 14:46:40 +080021void *__kunit_get_static_stub_address_impl(struct kunit *test, void *real_fn_addr);
David Gow7170b7e2023-01-28 15:10:07 +080022
23/* Code to set all of the function pointers. */
24static inline void kunit_install_hooks(void)
25{
26 /* Install the KUnit hook functions. */
27 kunit_hooks.fail_current_test = __kunit_fail_current_test_impl;
David Gowe047c5ea2023-01-31 14:46:40 +080028 kunit_hooks.get_static_stub_address = __kunit_get_static_stub_address_impl;
David Gow7170b7e2023-01-28 15:10:07 +080029}
30
31#endif /* _KUNIT_HOOKS_IMPL_H */