vppinfra: add 'filter' option to test_vector_funcs
Type: improvement
Change-Id: I5ed9029e5dc1368b7debbef04a3ac439a61af9ea
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vppinfra/vector/test/test.c b/src/vppinfra/vector/test/test.c
index d098766..144604e 100644
--- a/src/vppinfra/vector/test/test.c
+++ b/src/vppinfra/vector/test/test.c
@@ -35,6 +35,8 @@
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 @@
clib_error_report (err);
fformat (stdout, "\n");
}
-
+ next:
r = r->next;
}
}
@@ -161,6 +163,8 @@
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 @@
}
while ((++pt)->fn);
}
+ next:
r = r->next;
}
}
@@ -220,6 +225,8 @@
{
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 5b26996..1662287 100644
--- a/src/vppinfra/vector/test/test.h
+++ b/src/vppinfra/vector/test/test.h
@@ -53,6 +53,7 @@
{
test_registration_t *registrations[CLIB_MARCH_TYPE_N_VARIANTS];
u32 repeat;
+ u8 *filter;
} test_main_t;
extern test_main_t test_main;