]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix two problems in the 0.2.8.x unit tests
authorNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:30:48 +0000 (12:30 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2016 17:30:48 +0000 (12:30 -0500)
1. We were sometimes using libevent uninitialized, which is Not Allowed.

2. The malformed-PTR dns test was supposed to get a -1 output... but
   the test was wrong, since it forgot that in-addr.arpa addresses
   are in reverse order.

Bugs not in any released tor.

src/test/test.c
src/test/test_circuitmux.c
src/test/test_dns.c
src/test/testing_common.c

index f12ae21ff06fd0c052c1fbf3eadbd0decdca6d31..d671ac896e39d2161b9b5737b60bc6ae5c4012aa 100644 (file)
@@ -319,11 +319,7 @@ test_circuit_timeout(void *arg)
   int i, runs;
   double close_ms;
   (void)arg;
-  tor_libevent_cfg cfg;
 
-  memset(&cfg, 0, sizeof(cfg));
-
-  tor_libevent_initialize(&cfg);
   initialize_periodic_events();
 
   circuit_build_times_init(&initial);
index 6d93731eea1576090836b77f7050ab51863e44f5..5c72fc656dcdf3262a2ae0845c1a7a31562e8d33 100644 (file)
@@ -36,11 +36,7 @@ test_cmux_destroy_cell_queue(void *arg)
   circuit_t *circ = NULL;
   cell_queue_t *cq = NULL;
   packed_cell_t *pc = NULL;
-  tor_libevent_cfg cfg;
 
-  memset(&cfg, 0, sizeof(cfg));
-
-  tor_libevent_initialize(&cfg);
   scheduler_init();
 
   (void) arg;
index 6fdbe905e0f6e872ff3023dda8ac482525c4879f..5289ca58ff5059e3a9459415f2daa2efe62b4ba6 100644 (file)
@@ -490,7 +490,7 @@ NS(test_main)(void *arg)
 
   (void)arg;
 
-  TO_CONN(exitconn)->address = tor_strdup("127.0.0.1.in-addr.arpa");
+  TO_CONN(exitconn)->address = tor_strdup("1.0.0.127.in-addr.arpa");
 
   NS_MOCK(router_my_exit_policy_is_reject_star);
 
index e20e9e6095542692c020a06f2b7e91b74ac46754..9c7fca05a5a462654efb9855976a678b3ec6c609 100644 (file)
@@ -238,6 +238,11 @@ main(int c, const char **v)
   update_approx_time(time(NULL));
   options = options_new();
   tor_threads_init();
+
+  struct tor_libevent_cfg cfg;
+  memset(&cfg, 0, sizeof(cfg));
+  tor_libevent_initialize(&cfg);
+
   control_initialize_event_queue();
   init_logging(1);
   configure_backtrace_handler(get_version());