hooks-impl.h 918 B

12345678910111213141516171819202122232425262728293031
  1. /* 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. #ifndef _KUNIT_HOOKS_IMPL_H
  12. #define _KUNIT_HOOKS_IMPL_H
  13. #include <kunit/test-bug.h>
  14. /* List of declarations. */
  15. void __printf(3, 4) __kunit_fail_current_test_impl(const char *file,
  16. int line,
  17. const char *fmt, ...);
  18. void *__kunit_get_static_stub_address_impl(struct kunit *test, void *real_fn_addr);
  19. /* Code to set all of the function pointers. */
  20. static inline void kunit_install_hooks(void)
  21. {
  22. /* Install the KUnit hook functions. */
  23. kunit_hooks.fail_current_test = __kunit_fail_current_test_impl;
  24. kunit_hooks.get_static_stub_address = __kunit_get_static_stub_address_impl;
  25. }
  26. #endif /* _KUNIT_HOOKS_IMPL_H */