diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2020-02-13 19:42:06 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2020-02-16 18:25:17 +0100 |
commit | f78ab5787773fbda3be5581a3b48f43ec7acd9d3 (patch) | |
tree | 9976cf6fbdf5383c04551874001f21f660f4e732 /src/lib | |
parent | 961e3da364797eee9d84902cce509baf2f6f9d2d (diff) | |
download | ouroboros-f78ab5787773fbda3be5581a3b48f43ec7acd9d3.tar.gz ouroboros-f78ab5787773fbda3be5581a3b48f43ec7acd9d3.zip |
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 <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/tests/shm_rbuff_test.c | 8 |
1 files changed, 8 insertions, 0 deletions
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"); |