]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Update test_relay.c for recent test suite changes and --enable-mempools support
authorAndrea Shepard <andrea@torproject.org>
Tue, 23 Sep 2014 14:22:26 +0000 (07:22 -0700)
committerAndrea Shepard <andrea@torproject.org>
Wed, 1 Oct 2014 06:15:43 +0000 (23:15 -0700)
src/test/test_relay.c

index 6b9cb33ca32b3124cec7b2b9ea2228bc686d97d8..6907597705346211e45b79cd3a4b0b1c6a044002 100644 (file)
@@ -61,14 +61,16 @@ test_relay_append_cell_to_circuit_queue(void *arg)
   (void)arg;
 
   /* We'll need the cell pool for append_cell_to_circuit_queue() to work */
+#ifdef ENABLE_MEMPOOLS
   init_cell_pool();
+#endif /* ENABLE_MEMPOOLS */
 
   /* Make fake channels to be nchan and pchan for the circuit */
   nchan = new_fake_channel();
-  test_assert(nchan);
+  tt_assert(nchan);
 
   pchan = new_fake_channel();
-  test_assert(pchan);
+  tt_assert(pchan);
 
   /* We'll need chans with working cmuxes */
   nchan->cmux = circuitmux_alloc();
@@ -76,7 +78,7 @@ test_relay_append_cell_to_circuit_queue(void *arg)
 
   /* Make a fake orcirc */
   orcirc = new_fake_orcirc(nchan, pchan);
-  test_assert(orcirc);
+  tt_assert(orcirc);
 
   /* Make a cell */
   cell = tor_malloc_zero(sizeof(cell_t));
@@ -90,14 +92,14 @@ test_relay_append_cell_to_circuit_queue(void *arg)
   append_cell_to_circuit_queue(TO_CIRCUIT(orcirc), nchan, cell,
                                CELL_DIRECTION_OUT, 0);
   new_count = get_mock_scheduler_has_waiting_cells_count();
-  test_eq(new_count, old_count + 1);
+  tt_int_op(new_count, ==, old_count + 1);
 
   /* Now try the reverse direction */
   old_count = get_mock_scheduler_has_waiting_cells_count();
   append_cell_to_circuit_queue(TO_CIRCUIT(orcirc), pchan, cell,
                                CELL_DIRECTION_IN, 0);
   new_count = get_mock_scheduler_has_waiting_cells_count();
-  test_eq(new_count, old_count + 1);
+  tt_int_op(new_count, ==, old_count + 1);
 
   UNMOCK(scheduler_channel_has_waiting_cells);
 
@@ -117,7 +119,9 @@ test_relay_append_cell_to_circuit_queue(void *arg)
   tor_free(nchan);
   if (pchan && pchan->cmux) circuitmux_free(pchan->cmux);
   tor_free(pchan);
+#ifdef ENABLE_MEMPOOLS
   free_cell_pool();
+#endif /* ENABLE_MEMPOOLS */
 
   return;
 }