From ee0412a7d171d4b33ca4f24eff33fd7bac45335d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 31 Oct 2016 22:14:51 +0200 Subject: [PATCH] net: tests: Fix net_buf_unref() tests for fragment chains The net_buf_unref() API will unref all associated fragments, so it's wrong to assume that no fragment destroy callbacks would be called when the head buf is unreffed. Instead the right expectation is that all fragments get unrefed as well. Change-Id: I00530e4c1cfa5dddbfcbeab9609347873010ff4d Signed-off-by: Johan Hedberg --- tests/net/buf/src/main.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/tests/net/buf/src/main.c b/tests/net/buf/src/main.c index 5bd60fdf689..93210fda213 100644 --- a/tests/net/buf/src/main.c +++ b/tests/net/buf/src/main.c @@ -309,13 +309,6 @@ static void net_buf_test_4(void) net_buf_unref(buf); - assert_equal(frag_destroy_called, 0, - "Incorrect frag destroy callback count"); - - for (i = 0; i < ARRAY_SIZE(frags_pool); i++) { - net_buf_unref(frags[i]); - } - assert_equal(frag_destroy_called, ARRAY_SIZE(frags_pool), "Incorrect frag destroy callback count"); } @@ -356,13 +349,6 @@ static void net_buf_test_big_buf(void) net_buf_frag_add(buf, frag); net_buf_unref(buf); - assert_equal(frag_destroy_called, 0, - "Incorrect frag destroy callback count"); - - for (i = 0; i < ARRAY_SIZE(big_pool); i++) { - net_buf_unref(big_frags[i]); - } - assert_equal(frag_destroy_called, ARRAY_SIZE(big_pool), "Incorrect frag destroy callback count"); } @@ -416,13 +402,6 @@ static void net_buf_test_multi_frags(void) net_buf_unref(buf); - assert_equal(frag_destroy_called, 0, - "Incorrect big frag destroy callback count"); - - for (i = 0; i < ARRAY_SIZE(frags_pool); i++) { - net_buf_unref(frags[i]); - } - assert_equal(frag_destroy_called, ARRAY_SIZE(frags_pool), "Incorrect big frag destroy callback count"); }