[tor-dev] Improving the tests
nickm at alum.mit.edu
Tue Jan 31 22:16:11 UTC 2012
On Tue, Jan 31, 2012 at 4:21 PM, Esteban Manchado Velázquez
<emanchado at demiurgo.org> wrote:
> Hey guys,
> I wanted to try and help a bit, but I'm not exactly a C wizard or know much
> about networking code. However, I am an experienced developer, do understand
> C and have quite a bit of experience with automated testing.
> Luckily, according to
> https://www.torproject.org/getinvolved/volunteer.html.en#unitTesting, it
> seems you guys could use someone spending some time with the tests :-) I'm
> sure it's going to take me a while to get my head around the code and the
> tests, but I can give it a shot and see what happens. How do I get started?
> Any suggestions?
For unit tests:
I'd start by looking at the tests in src/test/*.c , then by running
the unit tests under gcov (there are instructions for using gcov with
Tor somewhere in doc/HACKING). From that, you'll get some idea for
how the unit tests work, and some idea which parts of the code need
unit tests (most of them).
The easiest stuff to test is going to be things under src/common/*,
but you might also what to think about which parts of src/or/* might
be testable. The hard part there is going to be that some of them
want to make changes affecting network state. Unit testing for that
kind of thing will require some refactoring of the code, so that
instead of following the pattern
action = calculate_action(input)
and then you can write the unit test for calculate_action.
For integration tests:
I started work on a python tool called chutney that configures and
launches a bunch of Tors to run tests on them, but so far it doesn't
actually do any testing. It'd be neat to have basic tests for things
like, "Does this work as a client? Does it build circuits? Correctly?"
and so on. But I'm not at all sure the right architecture for making
a test harness for that, and C is probably not the best choice there.
In either case, feel free to ask more questions here, or on the
#tor-dev IRC channel on the OFTC network
Glad you're intested, and looking forward to more tests,
More information about the tor-dev