[tor-dev] First test "report"

Esteban Manchado Velázquez emanchado at demiurgo.org
Sat Feb 11 12:12:25 UTC 2012


Hi there,

I'm done with the first batch of work on the test side. You have the  
(rebased just now) work here:  
https://github.com/emanchado/tor/commits/master. The rest of this e-mail  
summarises what I've done and explains my plan for further work.

The content of the commits
--------------------------
I have reviewed the whole test_util.c and made three kinds of changes:

1. Added more tests. Some of them failed, and after checking with other  
people on IRC the conclusion seems to be that they should pass (ie. they  
reproduce actual bugs in the code). To keep the test suite from failing,  
they are inside "#if 0" blocks. So someone should look for "#if 0" inside  
test_util.c and fix the code that makes those fail. Or maybe I should file  
bugs for those?

2. In comparison assertions, the general convention seems to be to place  
the expected value first ("test_eq(0, functioncall(...))" rather than  
"test_eq(functioncall(...), 0)"). I have modified the assertions not  
following that convention, so they all look the same.

3. General clean up, small code reorganisations, fix typos and such. Eg, I  
have turned all the "tt_int_op(a, ==, b)" into "test_eq(a, b)".


I was thinking of blogging about what I saw (esp. related to point 1). I  
think there are valuable lessons to be learned, which will help other  
people writing tests (both for Tor and outside of Tor). I'm not sure if  
there's enough content for a blog post, but if I do it after all, should I  
post the link here?

Plan for the future
-------------------

As I haven't explored coverage yet, I'll start with that for the code in  
src/common/ and see what I can do. My gut feeling (without having looked  
at other parts of the code yet!) is that tackling unit tests for code in  
src/or/ will be hard for me, and it seems better to explain what kind of  
things I have done in src/common/ so others, more familiar with that code,  
can fix/improve the unit tests for src/or/*. In other words, it seems much  
more effective for me to support someone who knows the code in src/or/*,  
rather than the other way around.

After I'm done with what I think is easy enough for me to do with the unit  
tests, I'll have a look at Stem (Damian's suggestion) and chutney (Nick's  
suggestion), and decide what I do next.

-- 
Esteban


More information about the tor-dev mailing list