summaryrefslogtreecommitdiff
path: root/unit/test-ippool.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-05-29 10:00:30 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-05-29 12:52:21 +0300
commit292da8695fedbb75bdeb0333c642573b6d08a687 (patch)
tree8fba766ec765280ee4691d21845151d277172205 /unit/test-ippool.c
parentba8e15ac7817c0d833f121ad8ba4141b66b847bd (diff)
downloadconnman-292da8695fedbb75bdeb0333c642573b6d08a687.tar.gz
connman-292da8695fedbb75bdeb0333c642573b6d08a687.tar.bz2
connman-292da8695fedbb75bdeb0333c642573b6d08a687.zip
test-ippool: Shortcut exhausting allocation test
Instead really trying to allocate all possible 69888 blocks, let's reserve the first two IP pools and then we only need to allocate 255 blocks. That should bring down the runtime considerable.
Diffstat (limited to 'unit/test-ippool.c')
-rw-r--r--unit/test-ippool.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/unit/test-ippool.c b/unit/test-ippool.c
index 07456d5a..f45c5b96 100644
--- a/unit/test-ippool.c
+++ b/unit/test-ippool.c
@@ -111,8 +111,6 @@ static void test_case_3(void)
__connman_ippool_init();
- /* Allocate all possible pools */
-
/*
* Number of addresses
* 24-bit block 10.0.0.0 – 10.255.255.255 16,777,216
@@ -124,12 +122,18 @@ static void test_case_3(void)
* Total numbers of 256 blocks: 69,888
*/
+ /*
+ * Completely exhaust the first two pools because they are a bit
+ * too large.
+ */
+ __connman_ippool_newaddr(45, "10.0.0.1", 8);
+ __connman_ippool_newaddr(46, "172.16.0.1", 11);
+
while (TRUE) {
pool = __connman_ippool_create(23, 1, 100, NULL, NULL);
if (pool == NULL)
break;
i += 1;
- g_assert(i < 69888);
list = g_slist_prepend(list, pool);
@@ -146,6 +150,8 @@ static void test_case_3(void)
g_assert(end_ip);
}
+ g_assert(i == 255);
+
LOG("Number of blocks %d", i);
for (it = list; it != NULL; it = it->next) {