[tor-bugs] #8949 [Tor]: Add a robust way to do mocking for Tor unit tests

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu May 23 15:20:42 UTC 2013


#8949: Add a robust way to do mocking for Tor unit tests
--------------------------------+-------------------------------------------
 Reporter:  nickm               |          Owner:                    
     Type:  enhancement         |         Status:  new               
 Priority:  major               |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor                 |        Version:                    
 Keywords:  tor-client testing  |         Parent:                    
   Points:                      |   Actualpoints:                    
--------------------------------+-------------------------------------------
 Right now, one of our biggest obstacles to improved test coverage is the
 fact that we don't have a good way to mock functions during C testing.

 There are a big pile of mocking tools for C, but they mostly suck and
 either want you to split your code up weirdly, litter it with macro salad,
 or such.

 There's another class of solution based on preprocessing C or
 postprocessing assembly, but both approaches are fragile, and we'd
 probably need to polish or maintain whatever tool we wound up using.  Not
 a great situation to be in.  I've maintained compiler wrappers. (It was a
 bad scene, man.)[http://www.pmg.csail.mit.edu/polyj/]

 Still, our current low test coverage is worse still; worse even than macro
 salad; worse even than magic compiler wrappers.  So we ought to bite the
 bullet and figure out the least difficult and least awful option and do
 it.

 (Please don't just post the results of a search on "c mocking tools" or "c
 unit testing" here: I can do that search too.)

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


More information about the tor-bugs mailing list