aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_relay.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2018-09-14 20:28:47 +0000
committerMike Perry <mikeperry-git@torproject.org>2018-09-17 23:12:53 +0000
commitdfd3823047d05a878a7a559ab6fc539dcad240fc (patch)
tree33443e3837fc4624ecc74d46188c35c0005c95a9 /src/test/test_relay.c
parent36e81e1f59581f1dbc29ab44585a202463a99054 (diff)
downloadtor-dfd3823047d05a878a7a559ab6fc539dcad240fc.tar.gz
tor-dfd3823047d05a878a7a559ab6fc539dcad240fc.zip
Bug 23512: Mock assert_circuit_ok in tests.
This mocking was not available in 0.2.9.
Diffstat (limited to 'src/test/test_relay.c')
-rw-r--r--src/test/test_relay.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/test/test_relay.c b/src/test/test_relay.c
index ce8ff1a917..f18de805f6 100644
--- a/src/test/test_relay.c
+++ b/src/test/test_relay.c
@@ -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;
@@ -95,6 +96,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 +149,7 @@ test_relay_close_circuit(void *arg)
tor_free(orcirc);
free_fake_channel(nchan);
free_fake_channel(pchan);
+ UNMOCK(assert_circuit_ok);
return;
}