commit 4d20c427b4874a3cb97e4567e4ae54830c5a79be Author: Andrea Shepard andrea@torproject.org Date: Tue Sep 23 07:22:26 2014 -0700
Update test_relay.c for recent test suite changes and --enable-mempools support --- src/test/test_relay.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 6b9cb33..6907597 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -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; }
tor-commits@lists.torproject.org