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

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Jul 15 13:01:49 UTC 2013

#8949: Add a way to do mocking for Tor unit tests
 Reporter:  nickm               |          Owner:                    
     Type:  enhancement         |         Status:  needs_review      
 Priority:  major               |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor                 |        Version:                    
 Keywords:  tor-client testing  |         Parent:                    
   Points:                      |   Actualpoints:                    

Comment(by nickm):

 Replying to [comment:2 andrea]:
 > Begin code review:
 > f7d654b81e1a65803c22bb53fc1d3a2021d87d50:
 >  * By modifying src_or_libtor_testing_a_CPPFLAGS, I presume the intent
 is to build everything twice, once for the tor binary and once for the
 unit tests.

 That's right.  When you specify the same C file as a source for two
 different build targets (like libor.a and libor-testing.a), and say that
 those build targets have different CPPFLAGS or CFLAGS or whatever, then
 autoconf will build the C file twice: first storing it in foo.o, and then
 in (say) src_or_libor_testing_a_foo.o or something like that.

 >  * I am deficient in automake clue here; are we certain this builds a
 complete separate set of object files, rather than just seeing one built
 and then not trying to rebuild it?

 It does in fact literally cause there to be two object files made for each
 C file. :)

 >  * Building everything twice seems icky, but I agree the other options
 seem even ickier.


 Linus is having a look too; once he's done, or once a little while passes,
 I plan to merge.

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

More information about the tor-bugs mailing list