X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Funittest%2Fsvm_fifo_test.c;fp=src%2Fplugins%2Funittest%2Fsvm_fifo_test.c;h=f5d4818bfe0b4190a44f3b8d865789dfc7d17881;hb=97d39e3e054ee681335197205e94fbf9a97a40e4;hp=ccaffa1f2367ea3c5905f3de82a65ad937e85e26;hpb=fb7e7ed2cd10446d5ecd1b1e8df470e706c448ed;p=vpp.git diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c index ccaffa1f236..f5d4818bfe0 100644 --- a/src/plugins/unittest/svm_fifo_test.c +++ b/src/plugins/unittest/svm_fifo_test.c @@ -1596,9 +1596,12 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input) SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane"); /* - * Dequeue just a part of data + * Dequeue just a part of data. Because we're tracking ooo data, we can't + * call dequeue. Therefore, first peek and then dequeue drop */ - rv = svm_fifo_dequeue (f, fifo_inc, data_buf); + rv = svm_fifo_peek (f, 0, fifo_inc, data_buf); + SFIFO_TEST (rv == fifo_inc, "should dequeue all data"); + rv = svm_fifo_dequeue_drop (f, fifo_inc); SFIFO_TEST (rv == fifo_inc, "should dequeue all data"); rv = svm_fifo_n_chunks (f); SFIFO_TEST (rv == 1, "should have %u chunks has %u", 1, rv); @@ -1624,10 +1627,11 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input) SFIFO_TEST (c->length == 4096, "end chunk length should be %u", 4096); /* - * Dequeue all + * Dequeue all. Don't call dequeue see above */ - rv = svm_fifo_dequeue (f, fifo_size, data_buf + fifo_inc); + rv = svm_fifo_peek (f, 0, fifo_size, data_buf + fifo_inc); SFIFO_TEST (rv == fifo_size, "should dequeue all data"); + SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane"); rv = compare_data (data_buf, test_data, 0, vec_len (test_data), (u32 *) & i); @@ -1635,6 +1639,10 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input) vlib_cli_output (vm, "[%d] dequeued %u expected %u", i, data_buf[i], test_data[i]); SFIFO_TEST ((rv == 0), "dequeued compared to original returned %d", rv); + + rv = svm_fifo_dequeue_drop (f, fifo_size); + SFIFO_TEST (rv == fifo_size, "should dequeue all data"); + SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane"); /* fifo does not end on chunk boundary because of the - 100 */ SFIFO_TEST (f->head_chunk != 0, "should have head chunk"); @@ -1711,7 +1719,10 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input) /* * Dequeue all */ - rv = svm_fifo_dequeue (f, fifo_size, data_buf); + + /* Because we're tracking ooo data, we can't call dequeue. Therefore, + * first peek and then dequeue drop */ + rv = svm_fifo_peek (f, 0, fifo_size, data_buf); SFIFO_TEST (rv == fifo_size, "should dequeue all data"); rv = compare_data (data_buf, test_data, 0, vec_len (test_data), @@ -1721,6 +1732,11 @@ sfifo_test_fifo_grow (vlib_main_t * vm, unformat_input_t * input) test_data[i]); SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane"); SFIFO_TEST ((rv == 0), "dequeued compared to original returned %d", rv); + + + rv = svm_fifo_dequeue_drop (f, fifo_size); + SFIFO_TEST ((rv == fifo_size), "all bytes should be dropped %u", rv); + SFIFO_TEST (svm_fifo_is_sane (f), "fifo should be sane"); SFIFO_TEST (f->ooo_deq == 0, "should have no ooo deq chunk"); rv = svm_fifo_n_chunks (f); SFIFO_TEST (rv == 1, "should have %u chunks has %u", 1, rv);