From 68843d1b6ce52315f8a3567537a3cb246c1ecf40 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 6 Dec 2021 13:21:33 +0100 Subject: vppinfra: add 'filter' option to test_vector_funcs Type: improvement Change-Id: I5ed9029e5dc1368b7debbef04a3ac439a61af9ea Signed-off-by: Damjan Marion --- src/vppinfra/vector/test/test.c | 9 ++++++++- src/vppinfra/vector/test/test.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/vppinfra/vector') diff --git a/src/vppinfra/vector/test/test.c b/src/vppinfra/vector/test/test.c index d098766481c..144604e5fcd 100644 --- a/src/vppinfra/vector/test/test.c +++ b/src/vppinfra/vector/test/test.c @@ -35,6 +35,8 @@ test_funct (test_main_t *tm) while (r) { clib_error_t *err; + if (tm->filter && strstr (r->name, (char *) tm->filter) == 0) + goto next; err = (r->fn) (0); fformat (stdout, "%-50s %s\n", r->name, err ? "FAIL" : "PASS"); if (err) @@ -42,7 +44,7 @@ test_funct (test_main_t *tm) clib_error_report (err); fformat (stdout, "\n"); } - + next: r = r->next; } } @@ -161,6 +163,8 @@ test_perf (test_main_t *tm) if (r->perf_tests) { test_perf_t *pt = r->perf_tests; + if (tm->filter && strstr (r->name, (char *) tm->filter) == 0) + goto next; fformat (stdout, "%-22s%-12s%U\n", r->name, "OpType", b->format_fn, b, pt, 0UL); do @@ -190,6 +194,7 @@ test_perf (test_main_t *tm) } while ((++pt)->fn); } + next: r = r->next; } } @@ -220,6 +225,8 @@ main (int argc, char *argv[]) { if (unformat (i, "perf")) perf = 1; + else if (unformat (i, "filter %s", &tm->filter)) + ; else if (unformat (i, "repeat %d", &tm->repeat)) ; else diff --git a/src/vppinfra/vector/test/test.h b/src/vppinfra/vector/test/test.h index 5b26996551b..16622877c45 100644 --- a/src/vppinfra/vector/test/test.h +++ b/src/vppinfra/vector/test/test.h @@ -53,6 +53,7 @@ typedef struct { test_registration_t *registrations[CLIB_MARCH_TYPE_N_VARIANTS]; u32 repeat; + u8 *filter; } test_main_t; extern test_main_t test_main; -- cgit 1.2.3-korg