blob: 1a8b9d6ea105702c18ed889907943ba3f1fbe82e [file] [log] [blame]
Damjan Marione3e35552021-05-06 17:34:49 +02001/* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2021 Cisco Systems, Inc.
3 */
4
5#include <vppinfra/format.h>
Damjan Mariond154a172021-07-13 21:12:41 +02006#include <vppinfra/vector/test/test.h>
Damjan Marione3e35552021-05-06 17:34:49 +02007
8test_registration_t *test_registrations[CLIB_MARCH_TYPE_N_VARIANTS] = {};
9
10int
Mohsin Kazmi85010602021-07-15 14:20:57 +000011test_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
21int
Damjan Marione3e35552021-05-06 17:34:49 +020022main (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 Kazmi85010602021-07-15 14:20:57 +000030 if (r == 0 || test_march_supported (i) < 0)
Damjan Marione3e35552021-05-06 17:34:49 +020031 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}