[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #11507 [Tor]: New tests for status.c



#11507: New tests for status.c
-------------------------+---------------------
 Reporter:  _x3j11       |          Owner:
     Type:  enhancement  |         Status:  new
 Priority:  normal       |      Milestone:
Component:  Tor          |        Version:
 Keywords:               |  Actual Points:
Parent ID:               |         Points:
-------------------------+---------------------
 In order to increase test coverage for Tor, it would be advantageous to
 have some mechanism to decrease the friction involved in the mocking
 process a little bit. A number of macros are introduced for this purpose,
 and a new test suite is added that uses them to test `status.c` (as a bit
 of a proof-of-concept) that gives 100% coverage.

 The idea is to think of each test being executed in its own sub-namespace.
 Normally, we would create these sub-namespaces by appending the module and
 test names to our mock functions; the attached patch introduces macros to
 make this simpler. These macros will also declare variables in the current
 test namespace that can be used to track (manually) how many times a given
 mock was called. Finally, macros are introduced to make the declaration of
 the `struct testcase_t` array simpler.

 Some further refinements could be made (eg., having a nicer way to set up
 and tear down a test fixture), but this should prove a good starting
 point. The disadvantage of executing tests like this in their own
 namespace is some mocks will need to be duplicated if they are shared
 amongst different test cases, but it is more ideal for tests to not have
 dependencies on other test setups so that failures can be easily isolated.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11507>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs