[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #1825 [Tor Relay]: Add unit tests for statistics code
#1825: Add unit tests for statistics code
-----------------------+----------------------------------------------------
Reporter: karsten | Owner:
Type: defect | Status: needs_review
Priority: normal | Milestone:
Component: Tor Relay | Version:
Keywords: | Parent:
-----------------------+----------------------------------------------------
Comment(by nickm):
The function name "rep_hist_exit_stats_history" is has no verb; it should
probably be rep_hist_get_exit_stats_history() or
rep_hist_format_exit_stats_history() or something. (Come to think of it,
I think "history" is redundant there; the "hist" means "history".
The asnprintf-and-join code makes me slightly concerned about
fragmentation, but I hope it won't be a big problem, given how
infrequently this function is called.
It looks like you're leaking at least written_string, read_string, and
streams_string in rep_hist_exit_stats_history(). Before I go hunting for
more leaks, it might be a good idea to run the new unit test under
valgrind or using dmalloc.
Given that the test_stats test touches global state, it might be a good
idea to run it in a subprocess. An entry like this would make it happen:
{ "stats", legacy_test_helper, TT_FORK, &legacy_setup, test_stats }
or define a new ENT-like macro, or make ENT take a flags argument to say
what the flags are. I can do this if you'd rather not.
Since this is done and makes stuff more tested, we may as well merge it
into 0.2.2.x, but it seems like a near thing. Arguably, we should hold off
merging non-bugfixes till 0.2.3.x. We can call "not being tested enough"
a bug, I suppose. ;)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/1825#comment:2>
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