[tor-bugs] #17077 [Tor]: Improve coverage on src/or/config.c (parse_port_config)

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 22 18:15:06 UTC 2015


#17077: Improve coverage on src/or/config.c (parse_port_config)
-----------------------------+--------------------------
     Reporter:  rjunior      |      Owner:
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:
    Component:  Tor          |    Version:
   Resolution:               |   Keywords:  testing
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+--------------------------

Comment (by nickm):

 Quick observations:
   * It looks like the test_CL_PORT_* definitions in test_config are
 redundant.  It would be better to just move the CL_PORT_* definitions
 somewhere that test_config.c and config.c can both see them.
   * Why is the `-  tor_free(the_tor_version);` line in config.c?  That
 seems like an accident.
   * Likewise, it looks like some lines in config.c got reformatted for no
 real reason.
   * In the test cases, it would be good if they tested more than just
 'success/failure' on the parsing cases, but also the error messages that
 got logged on the failure cases.
   * Use tor_addr_eq, not tor_mem_op, to compare addresses for equality.
 It's permissible for two structs to be bytewise unequal but semantically
 equal.
   * Would it make sense to break each //start group .... //end group pair
 into its own function?

 Questions to always ask:
   * Are there memory leaks in this code?  (You can find out by running
 under valgrind; see doc/HACKING)
   * Does it compile when you configure with --enable-gcc-warnings?
   * Does `make check-spaces` give any format warnings?

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


More information about the tor-bugs mailing list