diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-11-29 15:30:17 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-11-29 15:30:17 -0500 |
commit | 19019f26b08b5222ec75db00987aa0fcf79ae825 (patch) | |
tree | 49a57169cf9a99215ee5dad43b4e726415eceef4 /src/test | |
parent | ae6b31aba93cabb5c3a4ee3b03da282fde797282 (diff) | |
parent | a5174b092e17169d4d640ae73a7b4ed26b3d4c10 (diff) | |
download | tor-19019f26b08b5222ec75db00987aa0fcf79ae825.tar.gz tor-19019f26b08b5222ec75db00987aa0fcf79ae825.zip |
Merge remote branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test.c b/src/test/test.c index 3f014186a0..960a6659a7 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1102,6 +1102,7 @@ test_stats(void) { time_t now = 1281533250; /* 2010-08-11 13:27:30 UTC */ char *s = NULL; + int i; /* We shouldn't collect exit stats without initializing them. */ rep_hist_note_exit_stream_opened(80); @@ -1124,6 +1125,22 @@ test_stats(void) "exit-streams-opened 80=4,443=4,other=0\n", s); tor_free(s); + /* Add a few bytes on 10 more ports and ensure that only the top 10 + * ports are contained in the history string. */ + for (i = 50; i < 60; i++) { + rep_hist_note_exit_bytes(i, i, i); + rep_hist_note_exit_stream_opened(i); + } + s = rep_hist_format_exit_stats(now + 86400); + test_streq("exit-stats-end 2010-08-12 13:27:30 (86400 s)\n" + "exit-kibibytes-written 52=1,53=1,54=1,55=1,56=1,57=1,58=1," + "59=1,80=1,443=1,other=1\n" + "exit-kibibytes-read 52=1,53=1,54=1,55=1,56=1,57=1,58=1," + "59=1,80=10,443=20,other=1\n" + "exit-streams-opened 52=4,53=4,54=4,55=4,56=4,57=4,58=4," + "59=4,80=4,443=4,other=4\n", s); + tor_free(s); + /* Stop collecting stats, add some bytes, and ensure we don't generate * a history string. */ rep_hist_exit_stats_term(); |