diff options
Diffstat (limited to 'src/vppinfra/test_pool_iterate.c')
-rw-r--r-- | src/vppinfra/test_pool_iterate.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/vppinfra/test_pool_iterate.c b/src/vppinfra/test_pool_iterate.c index 27ce4bb37b7..406a2a577c2 100644 --- a/src/vppinfra/test_pool_iterate.c +++ b/src/vppinfra/test_pool_iterate.c @@ -28,17 +28,45 @@ main (int argc, char *argv[]) { int i; uword next; + u32 last_len = 0; u32 *tp = 0; u32 *junk; for (i = 0; i < 70; i++) - pool_get (tp, junk); + { + pool_get (tp, junk); + if (vec_len (tp) > last_len) + { + last_len = vec_len (tp); + fformat (stdout, "vec_len (tp) now %d\n", last_len); + } + } (void) junk; /* compiler warning */ pool_put_index (tp, 1); pool_put_index (tp, 65); + for (i = 0; i < 70; i++) + { + int is_free; + + is_free = pool_is_free_index (tp, i); + + if (is_free == 0) + { + if (i == 1 || i == 65) + clib_warning ("oops, free index %d reported busy", i); + } + else + { + if (i != 1 && i != 65) + clib_warning ("oops, busy index %d reported free", i); + } + } + + fformat (stdout, "vec_len (tp) is %d\n", vec_len (tp)); + next = ~0; do { @@ -47,6 +75,25 @@ main (int argc, char *argv[]) } while (next != ~0); + /* *INDENT-OFF* */ + pool_foreach (junk, tp, + ({ + int is_free; + + is_free = pool_is_free_index (tp, junk - tp); + if (is_free == 0) + { + if (i == 1 || i == 65) + clib_warning ("oops, free index %d reported busy", i); + } + else + { + if (i != 1 && i != 65) + clib_warning ("oops, busy index %d reported free", i); + } + })); + /* *INDENT-ON* */ + return 0; } |