summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-02-13 19:42:06 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-02-16 18:25:17 +0100
commitf78ab5787773fbda3be5581a3b48f43ec7acd9d3 (patch)
tree9976cf6fbdf5383c04551874001f21f660f4e732
parent961e3da364797eee9d84902cce509baf2f6f9d2d (diff)
downloadouroboros-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>
-rw-r--r--src/lib/tests/shm_rbuff_test.c8
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");