Damjan Marion | e3e3555 | 2021-05-06 17:34:49 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright(c) 2021 Cisco Systems, Inc. |
| 3 | */ |
| 4 | |
| 5 | #include <vppinfra/format.h> |
Damjan Marion | d154a17 | 2021-07-13 21:12:41 +0200 | [diff] [blame] | 6 | #include <vppinfra/vector/test/test.h> |
Damjan Marion | e3e3555 | 2021-05-06 17:34:49 +0200 | [diff] [blame] | 7 | |
| 8 | test_registration_t *test_registrations[CLIB_MARCH_TYPE_N_VARIANTS] = {}; |
| 9 | |
| 10 | int |
Mohsin Kazmi | 8501060 | 2021-07-15 14:20:57 +0000 | [diff] [blame^] | 11 | test_march_supported (clib_march_variant_type_t type) |
| 12 | { |
| 13 | #define _(s, n) \ |
| 14 | if (CLIB_MARCH_VARIANT_TYPE_##s == type) \ |
| 15 | return clib_cpu_march_priority_##s (); |
| 16 | foreach_march_variant |
| 17 | #undef _ |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | int |
Damjan Marion | e3e3555 | 2021-05-06 17:34:49 +0200 | [diff] [blame] | 22 | main (int argc, char *argv[]) |
| 23 | { |
| 24 | clib_mem_init (0, 64ULL << 20); |
| 25 | |
| 26 | for (int i = 0; i < CLIB_MARCH_TYPE_N_VARIANTS; i++) |
| 27 | { |
| 28 | test_registration_t *r = test_registrations[i]; |
| 29 | |
Mohsin Kazmi | 8501060 | 2021-07-15 14:20:57 +0000 | [diff] [blame^] | 30 | if (r == 0 || test_march_supported (i) < 0) |
Damjan Marion | e3e3555 | 2021-05-06 17:34:49 +0200 | [diff] [blame] | 31 | continue; |
| 32 | |
| 33 | fformat (stdout, "\nMultiarch Variant: %U\n", format_march_variant, i); |
| 34 | fformat (stdout, |
| 35 | "-------------------------------------------------------\n"); |
| 36 | while (r) |
| 37 | { |
| 38 | clib_error_t *err; |
| 39 | err = (r->fn) (0); |
| 40 | fformat (stdout, "%-50s %s\n", r->name, err ? "FAIL" : "PASS"); |
| 41 | if (err) |
| 42 | { |
| 43 | clib_error_report (err); |
| 44 | fformat (stdout, "\n"); |
| 45 | } |
| 46 | |
| 47 | r = r->next; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | fformat (stdout, "\n"); |
| 52 | return 0; |
| 53 | } |