summaryrefslogtreecommitdiffstats
path: root/openbsc/tests/subscr
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-12-03 11:08:23 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-09 09:08:28 +0100
commit70d8e31a748026a92e5739147411dcf512df7205 (patch)
tree3cafaaf35fc462b7c72f0e591624f941fef567a5 /openbsc/tests/subscr
parent901c40f55041d72220403c653646a2e8f82f1924 (diff)
msc: Add per subscriber keep_in_ram flag
Currently the keep_subscr flag in gsm_subscriber_group refers to a whole group of subscribers which makes it difficult to really delete single entries if the flag is set. This patch adds a keep_in_ram field to gsm_subscriber which allows for keeping subscriber objects in RAM while deleting others. Note that really deleting an entry requires that both flags (subscr_group->keep_subscr and subscr->keep_in_ram) are set to 0. So only the latter should be used if a specification requires the deletion of a subscriber entry. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/subscr')
-rw-r--r--openbsc/tests/subscr/subscr_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/tests/subscr/subscr_test.c b/openbsc/tests/subscr/subscr_test.c
index 277fc88..2a5d0e1 100644
--- a/openbsc/tests/subscr/subscr_test.c
+++ b/openbsc/tests/subscr/subscr_test.c
@@ -83,6 +83,22 @@ static void test_subscr(void)
subscr_purge_inactive(&dummy_sgrp);
OSMO_ASSERT(llist_empty(&active_subscribers));
+
+ /* Test force_no_keep */
+
+ dummy_sgrp.keep_subscr = 0;
+
+ subscr = subscr_get_or_create(&dummy_sgrp, imsi);
+ OSMO_ASSERT(subscr);
+ subscr->keep_in_ram = 1;
+
+ OSMO_ASSERT(!llist_empty(&active_subscribers));
+ OSMO_ASSERT(subscr->use_count == 1);
+
+ subscr->keep_in_ram = 0;
+
+ subscr_put(subscr);
+ OSMO_ASSERT(llist_empty(&active_subscribers));
}
int main()