summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/test/utest/host/src/expiration.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/sar/test/utest/host/src/expiration.c')
-rw-r--r--cesar/mac/sar/test/utest/host/src/expiration.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/cesar/mac/sar/test/utest/host/src/expiration.c b/cesar/mac/sar/test/utest/host/src/expiration.c
index 7fd452e5e9..8711ddcf68 100644
--- a/cesar/mac/sar/test/utest/host/src/expiration.c
+++ b/cesar/mac/sar/test/utest/host/src/expiration.c
@@ -112,6 +112,41 @@ test_case_expiration (test_t test)
}
test_end;
sar_cleanup (t.sar);
+ /* Here constants in MFS limiting are unknown to this testing code.
+ * Behaviour will depend on MFS limit constants, code, and current blk
+ * allocator configuration. The test tries to mimic a typical behaviour
+ * but it might have to be changed if context is changed. */
+ test_begin (test, "MFS TX max seg nb update")
+ {
+ int limit, initial;
+ uint i;
+ mfs_tx_max_seg_nb_update (0);
+ initial = limit = mfs_tx_max_seg_nb;
+ phy_date = 0;
+ /* Expiration without MFS, limit should not change. */
+ sar_expiration_mfs (t.sar);
+ test_fail_unless (mfs_tx_max_seg_nb == initial);
+ /* Expiration with TX MFS, limit should be lower. */
+ for (i = 1; i <= COUNT (expiration_ntb); i++)
+ test_case_expiration__add (&t, i, 1, true, expiration_ntb[i - 1]);
+ sar_expiration_mfs (t.sar);
+ test_fail_unless (mfs_tx_max_seg_nb < limit);
+ limit = mfs_tx_max_seg_nb;
+ /* Expiration with RX MFS, limit should be even lower. */
+ for (i = 1; i <= COUNT (expiration_ntb); i++)
+ test_case_expiration__add (&t, i, 1, false, expiration_ntb[i - 1]);
+ sar_expiration_mfs (t.sar);
+ test_fail_unless (mfs_tx_max_seg_nb < limit);
+ /* Expire segments, empty MFS are not counted. */
+ phy_date = expiration_ntb[COUNT (expiration_ntb) - 1] + 10;
+ sar_expiration_mfs (t.sar);
+ test_fail_unless (mfs_tx_max_seg_nb == initial);
+ /* OK, cleanup, limit should return to initial value after
+ * expiration. */
+ sar_cleanup (t.sar);
+ sar_expiration_mfs (t.sar);
+ test_fail_unless (mfs_tx_max_seg_nb == initial);
+ } test_end;
sar_test_uninit (&t);
}