diff options
Diffstat (limited to 'src/test/test_relay.c')
-rw-r--r-- | src/test/test_relay.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 57dcb2406a..a64d9af5b9 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2016, The Tor Project, Inc. */ +/* Copyright (c) 2014-2017, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" @@ -48,12 +48,6 @@ new_fake_orcirc(channel_t *nchan, channel_t *pchan) circ->deliver_window = CIRCWINDOW_START_MAX; circ->n_chan_create_cell = NULL; - /* for assert_circ_ok */ - orcirc->p_crypto = (void*)1; - orcirc->n_crypto = (void*)1; - orcirc->n_digest = (void*)1; - orcirc->p_digest = (void*)1; - circuit_set_p_circid_chan(orcirc, get_unique_circ_id_by_chan(pchan), pchan); cell_queue_init(&(orcirc->p_chan_cells)); @@ -61,6 +55,13 @@ new_fake_orcirc(channel_t *nchan, channel_t *pchan) } static void +assert_circuit_ok_mock(const circuit_t *c) +{ + (void) c; + return; +} + +static void test_relay_close_circuit(void *arg) { channel_t *nchan = NULL, *pchan = NULL; @@ -77,10 +78,6 @@ test_relay_close_circuit(void *arg) pchan = new_fake_channel(); tt_assert(pchan); - /* We'll need chans with working cmuxes */ - nchan->cmux = circuitmux_alloc(); - pchan->cmux = circuitmux_alloc(); - /* Make a fake orcirc */ orcirc = new_fake_orcirc(nchan, pchan); tt_assert(orcirc); @@ -95,6 +92,8 @@ test_relay_close_circuit(void *arg) MOCK(scheduler_channel_has_waiting_cells, scheduler_channel_has_waiting_cells_mock); + MOCK(assert_circuit_ok, + assert_circuit_ok_mock); /* Append it */ old_count = get_mock_scheduler_has_waiting_cells_count(); @@ -146,6 +145,7 @@ test_relay_close_circuit(void *arg) tor_free(orcirc); free_fake_channel(nchan); free_fake_channel(pchan); + UNMOCK(assert_circuit_ok); return; } @@ -167,10 +167,6 @@ test_relay_append_cell_to_circuit_queue(void *arg) pchan = new_fake_channel(); tt_assert(pchan); - /* We'll need chans with working cmuxes */ - nchan->cmux = circuitmux_alloc(); - pchan->cmux = circuitmux_alloc(); - /* Make a fake orcirc */ orcirc = new_fake_orcirc(nchan, pchan); tt_assert(orcirc); @@ -191,14 +187,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(); - tt_int_op(new_count, ==, old_count + 1); + tt_int_op(new_count, OP_EQ, 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(); - tt_int_op(new_count, ==, old_count + 1); + tt_int_op(new_count, OP_EQ, old_count + 1); UNMOCK(scheduler_channel_has_waiting_cells); |