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 <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-10-31 22:14:51 +02:00 committed by Anas Nashif
commit ee0412a7d1

View file

@ -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");
}