[tor-commits] [tor/master] test: Fix channel lifecycle and lifecycle_2
nickm at torproject.org
nickm at torproject.org
Fri Dec 8 19:46:20 UTC 2017
commit bd7823b29be14953c93a6ec28a68554ddfdd2855
Author: David Goulet <dgoulet at torproject.org>
Date: Wed Nov 22 11:21:29 2017 -0500
test: Fix channel lifecycle and lifecycle_2
They were broken due to previous commit. Fixes are trivial.
Signed-off-by: David Goulet <dgoulet at torproject.org>
---
src/test/test_channel.c | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index fce2b3eec..168ffcf78 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -812,8 +812,6 @@ test_channel_lifecycle(void *arg)
tt_assert(ch1);
/* Start it off in OPENING */
ch1->state = CHANNEL_STATE_OPENING;
- /* We'll need a cmux */
- ch1->cmux = circuitmux_alloc();
/* Try to register it */
channel_register(ch1);
@@ -828,14 +826,10 @@ test_channel_lifecycle(void *arg)
/* Move it to OPEN and flush */
channel_change_state_open(ch1);
- /* Queue should drain */
- tt_int_op(old_count + 1, OP_EQ, test_cells_written);
-
- /* Get another one */
+/* Get another one */
ch2 = new_fake_channel();
tt_assert(ch2);
ch2->state = CHANNEL_STATE_OPENING;
- ch2->cmux = circuitmux_alloc();
/* Register */
channel_register(ch2);
@@ -882,11 +876,10 @@ test_channel_lifecycle(void *arg)
done:
free_fake_channel(ch1);
free_fake_channel(ch2);
+ tor_free(p_cell);
UNMOCK(scheduler_channel_doesnt_want_writes);
UNMOCK(scheduler_release_channel);
-
- return;
}
/**
@@ -920,8 +913,6 @@ test_channel_lifecycle_2(void *arg)
tt_assert(ch);
/* Start it off in OPENING */
ch->state = CHANNEL_STATE_OPENING;
- /* The full lifecycle test needs a cmux */
- ch->cmux = circuitmux_alloc();
/* Try to register it */
channel_register(ch);
@@ -941,7 +932,6 @@ test_channel_lifecycle_2(void *arg)
ch = new_fake_channel();
tt_assert(ch);
ch->state = CHANNEL_STATE_OPENING;
- ch->cmux = circuitmux_alloc();
channel_register(ch);
tt_assert(ch->registered);
@@ -960,7 +950,6 @@ test_channel_lifecycle_2(void *arg)
ch = new_fake_channel();
tt_assert(ch);
ch->state = CHANNEL_STATE_OPENING;
- ch->cmux = circuitmux_alloc();
channel_register(ch);
tt_assert(ch->registered);
@@ -989,7 +978,6 @@ test_channel_lifecycle_2(void *arg)
ch = new_fake_channel();
tt_assert(ch);
ch->state = CHANNEL_STATE_OPENING;
- ch->cmux = circuitmux_alloc();
channel_register(ch);
tt_assert(ch->registered);
@@ -1015,7 +1003,6 @@ test_channel_lifecycle_2(void *arg)
ch = new_fake_channel();
tt_assert(ch);
ch->state = CHANNEL_STATE_OPENING;
- ch->cmux = circuitmux_alloc();
channel_register(ch);
tt_assert(ch->registered);
@@ -1162,14 +1149,14 @@ struct testcase_t channel_tests[] = {
NULL, NULL },
{ "id_map", test_channel_id_map, TT_FORK,
NULL, NULL },
-
- /* NOT WORKING TEST. */
- { "dumpstats", test_channel_dumpstats, TT_FORK,
- NULL, NULL },
{ "lifecycle", test_channel_lifecycle, TT_FORK,
NULL, NULL },
{ "lifecycle_2", test_channel_lifecycle_2, TT_FORK,
NULL, NULL },
+
+ /* NOT WORKING TEST. */
+ { "dumpstats", test_channel_dumpstats, TT_FORK,
+ NULL, NULL },
END_OF_TESTCASES
};
More information about the tor-commits
mailing list