diff options
author | Damjan Marion <damarion@cisco.com> | 2021-05-06 17:34:49 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-05-07 05:09:27 +0000 |
commit | e3e355507508ccbe1a14b78e0654775af8d932fe (patch) | |
tree | ebe9c5c8f74cb542da311587de7f35a8be0e8ab3 /src/vppinfra/test_vector_funcs.h | |
parent | cec1b2776b4b6967d400bc86551765ac7fa4643e (diff) |
vppinfra: add universal array mask_compare and compress funcs
Type: improvement
Change-Id: I6d812339f626ea630ad9354632d2f9506122d379
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/test_vector_funcs.h')
-rw-r--r-- | src/vppinfra/test_vector_funcs.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vppinfra/test_vector_funcs.h b/src/vppinfra/test_vector_funcs.h new file mode 100644 index 00000000000..bc499fb24e8 --- /dev/null +++ b/src/vppinfra/test_vector_funcs.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Copyright(c) 2021 Cisco Systems, Inc. + */ + +#ifndef included_test_test_h +#define included_test_test_h + +#include <vppinfra/cpu.h> + +typedef clib_error_t *(test_fn_t) (clib_error_t *); + +typedef struct test_registration_ +{ + char *name; + u8 multiarch : 1; + test_fn_t *fn; + struct test_registration_ *next; +} test_registration_t; + +extern test_registration_t *test_registrations[CLIB_MARCH_TYPE_N_VARIANTS]; + +#define __clib_test_fn static __clib_noinline __clib_section (".test_wrapper") + +#define REGISTER_TEST(x) \ + test_registration_t CLIB_MARCH_SFX (__test_##x); \ + static void __clib_constructor CLIB_MARCH_SFX (__test_registration_##x) ( \ + void) \ + { \ + test_registration_t *r = &CLIB_MARCH_SFX (__test_##x); \ + r->next = test_registrations[CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE)]; \ + test_registrations[CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE)] = r; \ + } \ + test_registration_t CLIB_MARCH_SFX (__test_##x) + +#endif |