From f78ab5787773fbda3be5581a3b48f43ec7acd9d3 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 13 Feb 2020 19:42:06 +0100 Subject: lib: Fix shm_rbuff test The rbuff_destroy function asserts that we do not try to destroy an rbuff that still contains packets. The test now empties the rbuff before destroying it. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/tests/shm_rbuff_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib') diff --git a/src/lib/tests/shm_rbuff_test.c b/src/lib/tests/shm_rbuff_test.c index d07f79a2..1d16a09d 100644 --- a/src/lib/tests/shm_rbuff_test.c +++ b/src/lib/tests/shm_rbuff_test.c @@ -93,11 +93,19 @@ int shm_rbuff_test(int argc, printf("success [%zd entries].\n\n", shm_rbuff_queued(rb)); + /* empty the rbuff */ + while (shm_rbuff_read(rb) >= 0) + ; + shm_rbuff_destroy(rb); return 0; error: + /* empty the rbuff */ + while (shm_rbuff_read(rb) >= 0) + ; + shm_rbuff_destroy(rb); err: printf("failed.\n\n"); -- cgit v1.2.3