aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_oom.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2014-05-12 18:23:34 -0700
committerAndrea Shepard <andrea@torproject.org>2014-05-12 18:23:34 -0700
commit39d4e67be8283b2a7141a7aa8342d30e27f47e6f (patch)
treedbc602ce1470c3e8c7b2d13ec89336464b563956 /src/test/test_oom.c
parent17435384c050b29cd3c70819ac7176c407f4d1bb (diff)
downloadtor-39d4e67be8283b2a7141a7aa8342d30e27f47e6f.tar.gz
tor-39d4e67be8283b2a7141a7aa8342d30e27f47e6f.zip
Add --disable-mempools configure option
Diffstat (limited to 'src/test/test_oom.c')
-rw-r--r--src/test/test_oom.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/test_oom.c b/src/test/test_oom.c
index 989ca1203b..1afe3fd162 100644
--- a/src/test/test_oom.c
+++ b/src/test/test_oom.c
@@ -12,7 +12,9 @@
#include "compat_libevent.h"
#include "connection.h"
#include "config.h"
+#ifdef ENABLE_MEMPOOLS
#include "mempool.h"
+#endif
#include "relay.h"
#include "test.h"
@@ -130,7 +132,10 @@ test_oom_circbuf(void *arg)
(void) arg;
MOCK(circuit_mark_for_close_, circuit_mark_for_close_dummy_);
+
+#ifdef ENABLE_MEMPOOLS
init_cell_pool();
+#endif /* ENABLE_MEMPOOLS */
/* Far too low for real life. */
options->MaxMemInQueues = 256*packed_cell_mem_cost();
@@ -149,8 +154,13 @@ test_oom_circbuf(void *arg)
tor_gettimeofday_cache_set(&tv);
c2 = dummy_or_circuit_new(20, 20);
+#ifdef ENABLE_MEMPOOLS
tt_int_op(packed_cell_mem_cost(), ==,
sizeof(packed_cell_t) + MP_POOL_ITEM_OVERHEAD);
+#else
+ tt_int_op(packed_cell_mem_cost(), ==,
+ sizeof(packed_cell_t));
+#endif /* ENABLE_MEMPOOLS */
tt_int_op(cell_queues_get_total_allocation(), ==,
packed_cell_mem_cost() * 70);
tt_int_op(cell_queues_check_size(), ==, 0); /* We are still not OOM */
@@ -220,7 +230,10 @@ test_oom_streambuf(void *arg)
(void) arg;
MOCK(circuit_mark_for_close_, circuit_mark_for_close_dummy_);
+
+#ifdef ENABLE_MEMPOOLS
init_cell_pool();
+#endif /* ENABLE_MEMPOOLS */
/* Far too low for real life. */
options->MaxMemInQueues = 81*packed_cell_mem_cost() + 4096 * 34;