[tor-bugs] #25118 [Core Tor/Tor]: We need circuit launch and cannibalization unit tests

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri May 4 13:36:08 UTC 2018


#25118: We need circuit launch and cannibalization unit tests
-------------------------------------------------+-------------------------
 Reporter:  dgoulet                              |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  High                                 |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-circuit, tor-test,               |  Actual Points:
  034-triage-20180328, 034-removed-20180328      |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------
Changes (by dgoulet):

 * status:  needs_review => needs_revision


Comment:

 Ok so basically here is the problem:

 {{{
 May 04 09:31:55.761 [debug] circuit_launch_by_extend_info(): Haven't
 fetched enough directory info yet; canceling circuit launch.
 }}}

 A useful trick for you is to use `./src/test/test <your-test> --debug`
 which will output the debug logs of the test. You can see that you don't
 get at all in the function but rather exit very fast with a NULL.

 So couple of things:

 1. Use `tt_assert(new_circ)` to make sure you do have a circuit that you
 expected.

 2. `router_have_minimum_dir_info()` is mockable so you'll have to mock it
 to return true.

 This `circuit_launch_by_extend_info()` is really not simple to unit test,
 you might need to mock lots of things. So instead, you could skip it and
 just unit tests `circuit_find_to_cannibalize()` which it self will be
 something intense as well.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25118#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list