[tor-bugs] #12207 [Tor]: Improve unittest coverage of entrynodes.c
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Jun 16 02:15:23 UTC 2014
#12207: Improve unittest coverage of entrynodes.c
------------------------+----------------------------------
Reporter: asn | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: Tor | Version:
Resolution: | Keywords: tor-client tor-guard
Actual Points: | Parent ID:
Points: |
------------------------+----------------------------------
Comment (by asn):
OK, just so that I don't spend more time for something we don't like, I
pushed a first version of my unittests in `bug12207_first_draft` of
`https://git.torproject.org/user/asn/tor.git`.
I tried to be careful during refactoring, so I splitted it into multiple
commits. Hope it's readable.
BTW, the unittests currently all fail because the loading of router
descriptors fails because of ` OLD_ROUTER_DESC_MAX_AGE` and:
{{{
if (!in_consensus && from_cache &&
router->cache_info.published_on < time(NULL) -
OLD_ROUTER_DESC_MAX_AGE) {
*msg = "Router descriptor was really old.";
routerinfo_free(router);
return ROUTER_WAS_NOT_NEW;
}
}}}
in `router_add_to_routerlist()`. We should make that piece of code not
apply during unittests.
I didn't find a nice way of doing this, but I still want to show you the
code, so this is still TODO.
You can check that the unittests pass if you increase the value of
`OLD_ROUTER_DESC_MAX_AGE`.
It's marked as draft because of the above issue, and also because I would
like to reread the code before marking for merge. I also need to run `make
check-spaces` on this.
FWIW, this seems to bring `entrynodes.c` coverage to:
{{{
File 'src/or/entrynodes.c'
Lines executed:33.63% of 1017
Creating 'entrynodes.c.gcov'
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12207#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list