summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLinus Nordberg <linus@torproject.org>2012-10-19 23:23:04 +0200
committerLinus Nordberg <linus@torproject.org>2012-10-20 20:56:59 +0200
commitcb51807236844f208b94d53dce7fbc5183180f1d (patch)
tree03e186ed2c977828e32f141e441a82165d54915e /src/test
parentaf175fa7e4ee3ffd1d91d463ba77a3c10d95c654 (diff)
downloadtor-cb51807236844f208b94d53dce7fbc5183180f1d.tar.gz
tor-cb51807236844f208b94d53dce7fbc5183180f1d.zip
Add "IPVersions" to control command "status/clients-seen".
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 0c5e84ddbc..b1f869d37a 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1388,7 +1388,7 @@ test_geoip(void)
{
int i, j;
time_t now = 1281533250; /* 2010-08-11 13:27:30 UTC */
- char *s = NULL;
+ char *s = NULL, *v = NULL;
const char *bridge_stats_1 =
"bridge-stats-end 2010-08-12 13:27:30 (86400 s)\n"
"bridge-ips zz=24,xy=8\n"
@@ -1457,7 +1457,6 @@ test_geoip(void)
"entry-ips \n";
tor_addr_t addr;
struct in6_addr in6;
- int total_ipv4, total_ipv6;
/* Populate the DB a bit. Add these in order, since we can't do the final
* 'sort' step. These aren't very good IP addresses, but they're perfectly
@@ -1542,20 +1541,23 @@ test_geoip(void)
SET_TEST_ADDRESS(i);
geoip_note_client_seen(GEOIP_CLIENT_CONNECT, &addr, now);
}
- s = geoip_get_client_history(GEOIP_CLIENT_CONNECT, &total_ipv4, &total_ipv6);
+ geoip_get_client_history(GEOIP_CLIENT_CONNECT, &s, &v);
test_assert(s);
+ test_assert(v);
test_streq("zz=24,ab=16,xy=8", s);
- test_eq(total_ipv4, 16);
- test_eq(total_ipv6, 16);
+ test_streq("v4=16,v6=16", v);
tor_free(s);
+ tor_free(v);
/* Now clear out all the AB observations. */
geoip_remove_old_clients(now-6000);
- s = geoip_get_client_history(GEOIP_CLIENT_CONNECT, &total_ipv4, &total_ipv6);
+ geoip_get_client_history(GEOIP_CLIENT_CONNECT, &s, &v);
test_assert(s);
+ test_assert(v);
test_streq("zz=24,xy=8", s);
- test_eq(total_ipv4, 16);
- test_eq(total_ipv6, 16);
+ test_streq("v4=16,v6=16", v);
+ tor_free(s);
+ tor_free(v);
/* Start testing bridge statistics by making sure that we don't output
* bridge stats without initializing them. */