1 /* Copyright (c) 2014-2017, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
8 #define CONNECTION_PRIVATE
9 #define DIRECTORY_PRIVATE
10 #define DIRVOTE_PRIVATE
11 #define ENTRYNODES_PRIVATE
12 #define HIBERNATE_PRIVATE
13 #define NETWORKSTATUS_PRIVATE
14 #define ROUTERLIST_PRIVATE
15 #define TOR_UNIT_TESTING
18 #include "connection.h"
19 #include "container.h"
21 #include "directory.h"
23 #include "entrynodes.h"
24 #include "hibernate.h"
25 #include "microdesc.h"
26 #include "networkstatus.h"
30 #include "routerlist.h"
31 #include "routerset.h"
32 #include "routerparse.h"
33 #include "shared_random.h"
34 #include "statefile.h"
36 #include "test_dir_common.h"
37 #include "log_test_helpers.h"
39 void construct_consensus(char **consensus_text_md
);
41 static authority_cert_t
*mock_cert
;
43 static authority_cert_t
*
44 get_my_v3_authority_cert_m(void)
46 tor_assert(mock_cert
);
50 /* 4 digests + 3 sep + pre + post + NULL */
51 static char output
[4*BASE64_DIGEST256_LEN
+3+2+2+1];
54 mock_get_from_dirserver(uint8_t dir_purpose
, uint8_t router_purpose
,
55 const char *resource
, int pds_flags
,
56 download_want_authority_t want_authority
)
63 strlcpy(output
, resource
, sizeof(output
));
69 test_routerlist_initiate_descriptor_downloads(void *arg
)
71 const char *prose
= "unhurried and wise, we perceive.";
72 smartlist_t
*digests
= smartlist_new();
75 for (int i
= 0; i
< 20; i
++) {
76 smartlist_add(digests
, (char*)prose
);
79 MOCK(directory_get_from_dirserver
, mock_get_from_dirserver
);
80 initiate_descriptor_downloads(NULL
, DIR_PURPOSE_FETCH_MICRODESC
,
82 UNMOCK(directory_get_from_dirserver
);
84 tt_str_op(output
, OP_EQ
, "d/"
85 "dW5odXJyaWVkIGFuZCB3aXNlLCB3ZSBwZXJjZWl2ZS4-"
86 "dW5odXJyaWVkIGFuZCB3aXNlLCB3ZSBwZXJjZWl2ZS4-"
87 "dW5odXJyaWVkIGFuZCB3aXNlLCB3ZSBwZXJjZWl2ZS4-"
88 "dW5odXJyaWVkIGFuZCB3aXNlLCB3ZSBwZXJjZWl2ZS4"
92 smartlist_free(digests
);
98 mock_initiate_descriptor_downloads(const routerstatus_t
*source
,
99 int purpose
, smartlist_t
*digests
,
100 int lo
, int hi
, int pds_flags
)
112 test_routerlist_launch_descriptor_downloads(void *arg
)
114 smartlist_t
*downloadable
= smartlist_new();
115 time_t now
= time(NULL
);
119 for (int i
= 0; i
< 100; i
++) {
120 cp
= tor_malloc(DIGEST256_LEN
);
122 crypto_rand(cp
, DIGEST256_LEN
);
123 smartlist_add(downloadable
, cp
);
126 MOCK(initiate_descriptor_downloads
, mock_initiate_descriptor_downloads
);
127 launch_descriptor_downloads(DIR_PURPOSE_FETCH_MICRODESC
, downloadable
,
129 tt_int_op(3, OP_EQ
, count
);
130 UNMOCK(initiate_descriptor_downloads
);
133 SMARTLIST_FOREACH(downloadable
, char *, cp1
, tor_free(cp1
));
134 smartlist_free(downloadable
);
138 construct_consensus(char **consensus_text_md
)
140 networkstatus_t
*vote
= NULL
;
141 networkstatus_t
*v1
= NULL
, *v2
= NULL
, *v3
= NULL
;
142 networkstatus_voter_info_t
*voter
= NULL
;
143 authority_cert_t
*cert1
=NULL
, *cert2
=NULL
, *cert3
=NULL
;
144 crypto_pk_t
*sign_skey_1
=NULL
, *sign_skey_2
=NULL
, *sign_skey_3
=NULL
;
145 crypto_pk_t
*sign_skey_leg
=NULL
;
146 time_t now
= time(NULL
);
147 smartlist_t
*votes
= NULL
;
150 tt_assert(!dir_common_authority_pk_init(&cert1
, &cert2
, &cert3
,
151 &sign_skey_1
, &sign_skey_2
,
153 sign_skey_leg
= pk_generate(4);
155 dir_common_construct_vote_1(&vote
, cert1
, sign_skey_1
,
156 &dir_common_gen_routerstatus_for_v3ns
,
157 &v1
, &n_vrs
, now
, 1);
158 networkstatus_vote_free(vote
);
160 tt_int_op(n_vrs
, OP_EQ
, 4);
161 tt_int_op(smartlist_len(v1
->routerstatus_list
), OP_EQ
, 4);
163 dir_common_construct_vote_2(&vote
, cert2
, sign_skey_2
,
164 &dir_common_gen_routerstatus_for_v3ns
,
165 &v2
, &n_vrs
, now
, 1);
166 networkstatus_vote_free(vote
);
168 tt_int_op(n_vrs
, OP_EQ
, 4);
169 tt_int_op(smartlist_len(v2
->routerstatus_list
), OP_EQ
, 4);
171 dir_common_construct_vote_3(&vote
, cert3
, sign_skey_3
,
172 &dir_common_gen_routerstatus_for_v3ns
,
173 &v3
, &n_vrs
, now
, 1);
176 tt_int_op(n_vrs
, OP_EQ
, 4);
177 tt_int_op(smartlist_len(v3
->routerstatus_list
), OP_EQ
, 4);
178 networkstatus_vote_free(vote
);
179 votes
= smartlist_new();
180 smartlist_add(votes
, v1
);
181 smartlist_add(votes
, v2
);
182 smartlist_add(votes
, v3
);
184 *consensus_text_md
= networkstatus_compute_consensus(votes
, 3,
187 "AAAAAAAAAAAAAAAAAAAA",
191 tt_assert(*consensus_text_md
);
195 networkstatus_vote_free(v1
);
196 networkstatus_vote_free(v2
);
197 networkstatus_vote_free(v3
);
198 smartlist_free(votes
);
199 authority_cert_free(cert1
);
200 authority_cert_free(cert2
);
201 authority_cert_free(cert3
);
202 crypto_pk_free(sign_skey_1
);
203 crypto_pk_free(sign_skey_2
);
204 crypto_pk_free(sign_skey_3
);
205 crypto_pk_free(sign_skey_leg
);
208 static int mock_usable_consensus_flavor_value
= FLAV_NS
;
211 mock_usable_consensus_flavor(void)
213 return mock_usable_consensus_flavor_value
;
217 test_router_pick_directory_server_impl(void *arg
)
221 networkstatus_t
*con_md
= NULL
;
222 char *consensus_text_md
= NULL
;
223 int flags
= PDS_IGNORE_FASCISTFIREWALL
|PDS_RETRY_IF_NO_SERVERS
;
224 or_options_t
*options
= get_options_mutable();
225 const routerstatus_t
*rs
= NULL
;
226 options
->UseMicrodescriptors
= 1;
227 char *router1_id
= NULL
, *router2_id
= NULL
, *router3_id
= NULL
;
228 node_t
*node_router1
= NULL
, *node_router2
= NULL
, *node_router3
= NULL
;
229 config_line_t
*policy_line
= NULL
;
230 time_t now
= time(NULL
);
231 int tmp_dirport1
, tmp_dirport3
;
235 MOCK(usable_consensus_flavor
, mock_usable_consensus_flavor
);
237 /* With no consensus, we must be bootstrapping, regardless of time or flavor
239 mock_usable_consensus_flavor_value
= FLAV_NS
;
240 tt_assert(networkstatus_consensus_is_bootstrapping(now
));
241 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2000));
242 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2*24*60*60));
243 tt_assert(networkstatus_consensus_is_bootstrapping(now
- 2*24*60*60));
245 mock_usable_consensus_flavor_value
= FLAV_MICRODESC
;
246 tt_assert(networkstatus_consensus_is_bootstrapping(now
));
247 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2000));
248 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2*24*60*60));
249 tt_assert(networkstatus_consensus_is_bootstrapping(now
- 2*24*60*60));
251 /* Init SR subsystem. */
252 MOCK(get_my_v3_authority_cert
, get_my_v3_authority_cert_m
);
253 mock_cert
= authority_cert_parse_from_string(AUTHORITY_CERT_1
, NULL
);
255 UNMOCK(get_my_v3_authority_cert
);
257 /* No consensus available, fail early */
258 rs
= router_pick_directory_server_impl(V3_DIRINFO
, (const int) 0, NULL
);
259 tt_ptr_op(rs
, OP_EQ
, NULL
);
261 construct_consensus(&consensus_text_md
);
262 tt_assert(consensus_text_md
);
263 con_md
= networkstatus_parse_vote_from_string(consensus_text_md
, NULL
,
266 tt_int_op(con_md
->flavor
,OP_EQ
, FLAV_MICRODESC
);
267 tt_assert(con_md
->routerstatus_list
);
268 tt_int_op(smartlist_len(con_md
->routerstatus_list
), OP_EQ
, 3);
269 tt_assert(!networkstatus_set_current_consensus_from_ns(con_md
,
272 /* If the consensus time or flavor doesn't match, we are still
274 mock_usable_consensus_flavor_value
= FLAV_NS
;
275 tt_assert(networkstatus_consensus_is_bootstrapping(now
));
276 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2000));
277 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2*24*60*60));
278 tt_assert(networkstatus_consensus_is_bootstrapping(now
- 2*24*60*60));
280 /* With a valid consensus for the current time and flavor, we stop
281 * bootstrapping, even if we have no certificates */
282 mock_usable_consensus_flavor_value
= FLAV_MICRODESC
;
283 tt_assert(!networkstatus_consensus_is_bootstrapping(now
+ 2000));
284 tt_assert(!networkstatus_consensus_is_bootstrapping(con_md
->valid_after
));
285 tt_assert(!networkstatus_consensus_is_bootstrapping(con_md
->valid_until
));
286 tt_assert(!networkstatus_consensus_is_bootstrapping(con_md
->valid_until
288 /* These times are outside the test validity period */
289 tt_assert(networkstatus_consensus_is_bootstrapping(now
));
290 tt_assert(networkstatus_consensus_is_bootstrapping(now
+ 2*24*60*60));
291 tt_assert(networkstatus_consensus_is_bootstrapping(now
- 2*24*60*60));
293 nodelist_set_consensus(con_md
);
294 nodelist_assert_ok();
296 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
297 /* We should not fail now we have a consensus and routerstatus_list
298 * and nodelist are populated. */
299 tt_ptr_op(rs
, OP_NE
, NULL
);
301 /* Manipulate the nodes so we get the dir server we expect */
302 router1_id
= tor_malloc(DIGEST_LEN
);
303 memset(router1_id
, TEST_DIR_ROUTER_ID_1
, DIGEST_LEN
);
304 router2_id
= tor_malloc(DIGEST_LEN
);
305 memset(router2_id
, TEST_DIR_ROUTER_ID_2
, DIGEST_LEN
);
306 router3_id
= tor_malloc(DIGEST_LEN
);
307 memset(router3_id
, TEST_DIR_ROUTER_ID_3
, DIGEST_LEN
);
309 node_router1
= node_get_mutable_by_id(router1_id
);
310 node_router2
= node_get_mutable_by_id(router2_id
);
311 node_router3
= node_get_mutable_by_id(router3_id
);
313 node_router1
->is_possible_guard
= 1;
315 node_router1
->is_running
= 0;
316 node_router3
->is_running
= 0;
317 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
318 tt_ptr_op(rs
, OP_NE
, NULL
);
319 tt_assert(tor_memeq(rs
->identity_digest
, router2_id
, DIGEST_LEN
));
321 node_router1
->is_running
= 1;
322 node_router3
->is_running
= 1;
324 node_router1
->rs
->is_v2_dir
= 0;
325 node_router3
->rs
->is_v2_dir
= 0;
326 tmp_dirport1
= node_router1
->rs
->dir_port
;
327 tmp_dirport3
= node_router3
->rs
->dir_port
;
328 node_router1
->rs
->dir_port
= 0;
329 node_router3
->rs
->dir_port
= 0;
330 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
331 tt_ptr_op(rs
, OP_NE
, NULL
);
332 tt_assert(tor_memeq(rs
->identity_digest
, router2_id
, DIGEST_LEN
));
334 node_router1
->rs
->is_v2_dir
= 1;
335 node_router3
->rs
->is_v2_dir
= 1;
336 node_router1
->rs
->dir_port
= tmp_dirport1
;
337 node_router3
->rs
->dir_port
= tmp_dirport3
;
339 node_router1
->is_valid
= 0;
340 node_router3
->is_valid
= 0;
341 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
342 tt_ptr_op(rs
, OP_NE
, NULL
);
343 tt_assert(tor_memeq(rs
->identity_digest
, router2_id
, DIGEST_LEN
));
345 node_router1
->is_valid
= 1;
346 node_router3
->is_valid
= 1;
348 /* Manipulate overloaded */
350 node_router2
->rs
->last_dir_503_at
= now
;
351 node_router3
->rs
->last_dir_503_at
= now
;
352 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
353 tt_ptr_op(rs
, OP_NE
, NULL
);
354 tt_assert(tor_memeq(rs
->identity_digest
, router1_id
, DIGEST_LEN
));
355 node_router2
->rs
->last_dir_503_at
= 0;
356 node_router3
->rs
->last_dir_503_at
= 0;
358 /* Set a Fascist firewall */
359 flags
&= ~ PDS_IGNORE_FASCISTFIREWALL
;
360 policy_line
= tor_malloc_zero(sizeof(config_line_t
));
361 policy_line
->key
= tor_strdup("ReachableORAddresses");
362 policy_line
->value
= tor_strdup("accept *:442, reject *:*");
363 options
->ReachableORAddresses
= policy_line
;
364 policies_parse_from_options(options
);
366 node_router1
->rs
->or_port
= 444;
367 node_router2
->rs
->or_port
= 443;
368 node_router3
->rs
->or_port
= 442;
369 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
370 tt_ptr_op(rs
, OP_NE
, NULL
);
371 tt_assert(tor_memeq(rs
->identity_digest
, router3_id
, DIGEST_LEN
));
372 node_router1
->rs
->or_port
= 442;
373 node_router2
->rs
->or_port
= 443;
374 node_router3
->rs
->or_port
= 444;
375 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
376 tt_ptr_op(rs
, OP_NE
, NULL
);
377 tt_assert(tor_memeq(rs
->identity_digest
, router1_id
, DIGEST_LEN
));
379 /* Fascist firewall and overloaded */
380 node_router1
->rs
->or_port
= 442;
381 node_router2
->rs
->or_port
= 443;
382 node_router3
->rs
->or_port
= 442;
383 node_router3
->rs
->last_dir_503_at
= now
;
384 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
385 tt_ptr_op(rs
, OP_NE
, NULL
);
386 tt_assert(tor_memeq(rs
->identity_digest
, router1_id
, DIGEST_LEN
));
387 node_router3
->rs
->last_dir_503_at
= 0;
389 /* Fascists against OR and Dir */
390 policy_line
= tor_malloc_zero(sizeof(config_line_t
));
391 policy_line
->key
= tor_strdup("ReachableAddresses");
392 policy_line
->value
= tor_strdup("accept *:80, reject *:*");
393 options
->ReachableDirAddresses
= policy_line
;
394 policies_parse_from_options(options
);
395 node_router1
->rs
->or_port
= 442;
396 node_router2
->rs
->or_port
= 441;
397 node_router3
->rs
->or_port
= 443;
398 node_router1
->rs
->dir_port
= 80;
399 node_router2
->rs
->dir_port
= 80;
400 node_router3
->rs
->dir_port
= 81;
401 node_router1
->rs
->last_dir_503_at
= now
;
402 rs
= router_pick_directory_server_impl(V3_DIRINFO
, flags
, NULL
);
403 tt_ptr_op(rs
, OP_NE
, NULL
);
404 tt_assert(tor_memeq(rs
->identity_digest
, router1_id
, DIGEST_LEN
));
405 node_router1
->rs
->last_dir_503_at
= 0;
408 UNMOCK(usable_consensus_flavor
);
411 tor_free(router1_id
);
413 tor_free(router2_id
);
415 tor_free(router3_id
);
416 if (options
->ReachableORAddresses
||
417 options
->ReachableDirAddresses
)
419 tor_free(consensus_text_md
);
420 networkstatus_vote_free(con_md
);
423 static or_state_t
*dummy_state
= NULL
;
425 get_or_state_replacement(void)
431 mock_directory_initiate_request(directory_request_t
*req
)
437 static circuit_guard_state_t
*
438 mock_circuit_guard_state_new(entry_guard_t
*guard
, unsigned state
,
439 entry_guard_restriction_t
*rst
)
447 /** Test that we will use our directory guards to fetch mds even if we don't
448 * have any dirinfo (tests bug #23862). */
450 test_directory_guard_fetch_with_no_dirinfo(void *arg
)
453 char *consensus_text_md
= NULL
;
454 or_options_t
*options
= get_options_mutable();
458 hibernate_set_state_for_testing_(HIBERNATE_STATE_LIVE
);
460 /* Initialize the SRV subsystem */
461 MOCK(get_my_v3_authority_cert
, get_my_v3_authority_cert_m
);
462 mock_cert
= authority_cert_parse_from_string(AUTHORITY_CERT_1
, NULL
);
464 UNMOCK(get_my_v3_authority_cert
);
466 /* Initialize the entry node configuration from the ticket */
467 options
->UseEntryGuards
= 1;
468 options
->StrictNodes
= 1;
469 get_options_mutable()->EntryNodes
= routerset_new();
470 routerset_parse(get_options_mutable()->EntryNodes
,
471 "2121212121212121212121212121212121212121", "foo");
473 /* Mock some functions */
474 dummy_state
= tor_malloc_zero(sizeof(or_state_t
));
475 MOCK(get_or_state
, get_or_state_replacement
);
476 MOCK(directory_initiate_request
, mock_directory_initiate_request
);
477 /* we need to mock this one to avoid memleaks */
478 MOCK(circuit_guard_state_new
, mock_circuit_guard_state_new
);
480 /* Call guards_update_all() to simulate loading our state file (see
481 * entry_guards_load_guards_from_state() and ticket #23989). */
484 /* Test logic: Simulate the arrival of a new consensus when we have no
485 * dirinfo at all. Tor will need to fetch the mds from the consensus. Make
486 * sure that Tor will use the specified entry guard instead of relying on the
487 * fallback directories. */
489 /* Fixup the dirconn that will deliver the consensus */
490 dir_connection_t
*conn
= dir_connection_new(AF_INET
);
491 tor_addr_from_ipv4h(&conn
->base_
.addr
, 0x7f000001);
492 conn
->base_
.port
= 8800;
493 TO_CONN(conn
)->address
= tor_strdup("127.0.0.1");
494 conn
->base_
.purpose
= DIR_PURPOSE_FETCH_CONSENSUS
;
495 conn
->requested_resource
= tor_strdup("ns");
497 /* Construct a consensus */
498 construct_consensus(&consensus_text_md
);
499 tt_assert(consensus_text_md
);
501 /* Place the consensus in the dirconn */
502 response_handler_args_t args
;
503 memset(&args
, 0, sizeof(response_handler_args_t
));
504 args
.status_code
= 200;
505 args
.body
= consensus_text_md
;
506 args
.body_len
= strlen(consensus_text_md
);
508 /* Update approx time so that the consensus is considered live */
509 update_approx_time(time(NULL
)+1010);
511 setup_capture_of_logs(LOG_DEBUG
);
513 /* Now handle the consensus */
514 retval
= handle_response_fetch_consensus(conn
, &args
);
515 tt_int_op(retval
, OP_EQ
, 0);
517 /* Make sure that our primary guard was chosen */
518 expect_log_msg_containing("Selected primary guard router3");
521 tor_free(consensus_text_md
);
522 tor_free(dummy_state
);
523 connection_free_minimal(TO_CONN(conn
));
524 entry_guards_free_all();
525 teardown_capture_of_logs();
528 static connection_t
*mocked_connection
= NULL
;
530 /* Mock connection_get_by_type_addr_port_purpose by returning
531 * mocked_connection. */
532 static connection_t
*
533 mock_connection_get_by_type_addr_port_purpose(int type
,
534 const tor_addr_t
*addr
,
535 uint16_t port
, int purpose
)
542 return mocked_connection
;
545 #define TEST_ADDR_STR "127.0.0.1"
546 #define TEST_DIR_PORT 12345
549 test_routerlist_router_is_already_dir_fetching(void *arg
)
552 tor_addr_port_t test_ap
, null_addr_ap
, zero_port_ap
;
555 tor_addr_parse(&test_ap
.addr
, TEST_ADDR_STR
);
556 test_ap
.port
= TEST_DIR_PORT
;
557 tor_addr_make_null(&null_addr_ap
.addr
, AF_INET6
);
558 null_addr_ap
.port
= TEST_DIR_PORT
;
559 tor_addr_parse(&zero_port_ap
.addr
, TEST_ADDR_STR
);
560 zero_port_ap
.port
= 0;
561 MOCK(connection_get_by_type_addr_port_purpose
,
562 mock_connection_get_by_type_addr_port_purpose
);
564 /* Test that we never get 1 from a NULL connection */
565 mocked_connection
= NULL
;
566 tt_int_op(router_is_already_dir_fetching(&test_ap
, 1, 1), OP_EQ
, 0);
567 tt_int_op(router_is_already_dir_fetching(&test_ap
, 1, 0), OP_EQ
, 0);
568 tt_int_op(router_is_already_dir_fetching(&test_ap
, 0, 1), OP_EQ
, 0);
569 /* We always expect 0 in these cases */
570 tt_int_op(router_is_already_dir_fetching(&test_ap
, 0, 0), OP_EQ
, 0);
571 tt_int_op(router_is_already_dir_fetching(NULL
, 1, 1), OP_EQ
, 0);
572 tt_int_op(router_is_already_dir_fetching(&null_addr_ap
, 1, 1), OP_EQ
, 0);
573 tt_int_op(router_is_already_dir_fetching(&zero_port_ap
, 1, 1), OP_EQ
, 0);
575 /* Test that we get 1 with a connection in the appropriate circumstances */
576 mocked_connection
= connection_new(CONN_TYPE_DIR
, AF_INET
);
577 tt_int_op(router_is_already_dir_fetching(&test_ap
, 1, 1), OP_EQ
, 1);
578 tt_int_op(router_is_already_dir_fetching(&test_ap
, 1, 0), OP_EQ
, 1);
579 tt_int_op(router_is_already_dir_fetching(&test_ap
, 0, 1), OP_EQ
, 1);
581 /* Test that we get 0 even with a connection in the appropriate
583 tt_int_op(router_is_already_dir_fetching(&test_ap
, 0, 0), OP_EQ
, 0);
584 tt_int_op(router_is_already_dir_fetching(NULL
, 1, 1), OP_EQ
, 0);
585 tt_int_op(router_is_already_dir_fetching(&null_addr_ap
, 1, 1), OP_EQ
, 0);
586 tt_int_op(router_is_already_dir_fetching(&zero_port_ap
, 1, 1), OP_EQ
, 0);
589 /* If a connection is never set up, connection_free chokes on it. */
590 if (mocked_connection
) {
591 buf_free(mocked_connection
->inbuf
);
592 buf_free(mocked_connection
->outbuf
);
594 tor_free(mocked_connection
);
595 UNMOCK(connection_get_by_type_addr_port_purpose
);
601 #define NODE(name, flags) \
602 { #name, test_routerlist_##name, (flags), NULL, NULL }
603 #define ROUTER(name,flags) \
604 { #name, test_router_##name, (flags), NULL, NULL }
606 struct testcase_t routerlist_tests
[] = {
607 NODE(initiate_descriptor_downloads
, 0),
608 NODE(launch_descriptor_downloads
, 0),
609 NODE(router_is_already_dir_fetching
, TT_FORK
),
610 ROUTER(pick_directory_server_impl
, TT_FORK
),
611 { "directory_guard_fetch_with_no_dirinfo",
612 test_directory_guard_fetch_with_no_dirinfo
, TT_FORK
, NULL
, NULL
},