aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-06-26 21:11:26 -0700
committerDave Barach <openvpp@barachs.net>2019-06-27 15:57:59 +0000
commit6aa9f5f8dc14cec4005b8bac33b5a8697168548e (patch)
tree12bbb2d697379ce69f20a536134297331c2e1f2c /src
parent44b0b07bc18555ecdf11b2b4c184bb88a9fa118f (diff)
svm: improve fifo segment test
Type: feature Try to also catch weirdness when running tests on arm cpus. Change-Id: I45ab7c225f43623447271e67ebf37f94236a288f Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/unittest/svm_fifo_test.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/unittest/svm_fifo_test.c b/src/plugins/unittest/svm_fifo_test.c
index a8f83faa586..bf633b78c22 100644
--- a/src/plugins/unittest/svm_fifo_test.c
+++ b/src/plugins/unittest/svm_fifo_test.c
@@ -1954,7 +1954,7 @@ sfifo_test_fifo_segment_fifo_grow (int verbose)
clib_memset (a, 0, sizeof (*a));
a->segment_name = "fifo-test1";
/* size chosen to be able to force multi chunk allocation lower */
- a->segment_size = 208 << 10;
+ a->segment_size = 256 << 10;
/* fifo allocation allocates chunks in batch */
n_batch = FIFO_SEGMENT_ALLOC_BATCH_SIZE;
@@ -1978,6 +1978,7 @@ sfifo_test_fifo_segment_fifo_grow (int verbose)
SFIFO_TEST (rv == (n_batch - 1) * fifo_size, "free chunk bytes %u "
"expected %u", rv, (n_batch - 1) * fifo_size);
+ /* Grow by preallocated fifo_size chunk */
fifo_segment_grow_fifo (fs, f, fifo_size);
SFIFO_TEST (f->size == 2 * fifo_size, "fifo size should be %u is %u",
2 * fifo_size, f->size);
@@ -1989,6 +1990,11 @@ sfifo_test_fifo_segment_fifo_grow (int verbose)
SFIFO_TEST (rv == (n_batch - 2) * fifo_size, "free chunk bytes %u "
"expected %u", rv, (n_batch - 2) * fifo_size);
+ /* Grow by a size not preallocated but first make sure there's space */
+ rv = fifo_segment_free_bytes (fs);
+ SFIFO_TEST (rv > 16 * fifo_size, "free bytes %u more than %u", rv,
+ 16 * fifo_size);
+
fifo_segment_grow_fifo (fs, f, 16 * fifo_size);
SFIFO_TEST (f->size == 18 * fifo_size, "fifo size should be %u is %u",
18 * fifo_size, f->size);
@@ -2068,6 +2074,12 @@ sfifo_test_fifo_segment_fifo_grow (int verbose)
* Force multi chunk fifo allocation
*/
+ /* Check that we can force multi chunk allocation. Note that fifo size
+ * rounded up to power of 2, i.e., 17 becomes 32 */
+ rv = fifo_segment_free_bytes (fs);
+ SFIFO_TEST (rv < 32 * fifo_size, "free bytes %u less than %u", rv,
+ 32 * fifo_size);
+
f = fifo_segment_alloc_fifo (fs, 17 * fifo_size, FIFO_SEGMENT_RX_FIFO);
rv = fifo_segment_fl_chunk_bytes (fs);