1 /* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2021 Cisco Systems, Inc.
5 #ifndef included_test_test_h
6 #define included_test_test_h
8 #include <vppinfra/cpu.h>
10 typedef clib_error_t *(test_fn_t) (clib_error_t *);
12 typedef struct test_registration_
17 struct test_registration_ *next;
18 } test_registration_t;
20 extern test_registration_t *test_registrations[CLIB_MARCH_TYPE_N_VARIANTS];
22 #define __clib_test_fn static __clib_noinline __clib_section (".test_wrapper")
24 #define REGISTER_TEST(x) \
25 test_registration_t CLIB_MARCH_SFX (__test_##x); \
26 static void __clib_constructor CLIB_MARCH_SFX (__test_registration_##x) ( \
29 test_registration_t *r = &CLIB_MARCH_SFX (__test_##x); \
30 r->next = test_registrations[CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE)]; \
31 test_registrations[CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE)] = r; \
33 test_registration_t CLIB_MARCH_SFX (__test_##x)