On Sun, Sep 8, 2013 at 12:35 PM, Marek Majkowski marek@popcount.org wrote:
Tor ships with some testing facilities (tor/src/test/test), but they are not comprehensive. (I'm aware there's an ongoing effort on improving these tests).
To test anything non trivial it is necessary to run a tor node as a part of a tor network. There is another tool called chutney [1] that can be used to set up a small testing Tor network: it generates plenty of torrc configs and spawns a number of Tor servers locally.
This is very handy, but it can take a while before the network starts working - the Auth servers need to establish the consensus and do all the things I have no clue about.
Here's a simple shell script [2]:
- It uses chutney to start a testing tor network.
- It waits for it to work by trying to establish a connection to localhost:22.
- Finally it tears down the network.
Normally it takes around 5 minutes for the network to converge:
$ time ./go.sh real 4m8.330s user 0m2.064s sys 0m0.392s
Of course, you don't have to set a completely fresh Tor network for every single test, but that's what I often do. I'd be eager to hear how people are reusing chutney networks.
In past I wrote this thing called fluxcapacitor [3], it's a tool that speeds up tests. After a few fixes I was able to run chutney on it:
$ time /tmp/fluxcapacitor/fluxcapacitor ./go.sh
real 0m11.450s user 0m2.340s sys 0m2.120s
Running stuff under fluxcapacitor is not deterministic, sometimes it takes 8 seconds, sometimes 15 but it generally works and should go pretty quick.
That's it. I thought someone may find it useful.
Cheers, Marek
Thanks, Marek! This looks quite useful. Can you talk a bit more about under what circumstances (if any) the fluxcapacitor code there might give incorrect results?
Also, I had thought the quick-and-dirty chutney test we shipped (via ./src/test/test-network.sh) bootstrapped in faster than 5 minutes. Am I wrong there? Does it use any tricks that might be helpful in combination with fluxcapacitor?
best wishes,