]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make test_workqueue.c faster, and on-by-default.
authorNick Mathewson <nickm@torproject.org>
Fri, 3 Jul 2015 18:37:16 +0000 (14:37 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 3 Jul 2015 18:38:14 +0000 (14:38 -0400)
Instead of having a 30-second timer be the only way to end the test,
add a 2 second shutdown timer when the test is actually about to be over.

changes/faster-workqueue-test [new file with mode: 0644]
src/test/include.am
src/test/test_workqueue.c

diff --git a/changes/faster-workqueue-test b/changes/faster-workqueue-test
new file mode 100644 (file)
index 0000000..16489e4
--- /dev/null
@@ -0,0 +1,3 @@
+  o Testing:
+    - The test_workqueue program now runs faster, and is enabled by
+      default as a part of "make check".
index 0ef556a9bf4227e9c9f6dc44a045e399121d7c3b..7406c84a1fe91cf61e772a7edff74316e7aabe0f 100644 (file)
@@ -6,7 +6,7 @@ TESTSCRIPTS += src/test/test_ntor.sh src/test/test_bt.sh
 endif
 
 TESTS += src/test/test src/test/test-slow src/test/test-memwipe \
-       $(TESTSCRIPTS)
+       src/test/test_workqueue $(TESTSCRIPTS)
 
 ### This is a lovely feature, but it requires automake >= 1.12, and Tor
 ###  doesn't require that yet.  Below is a kludge to work around.
index 77053b0760b174c592b5ff87321527de7f5ac3d8..edefb292c0d32f3efab6b9d58f6111100e0dda4e 100644 (file)
@@ -214,6 +214,7 @@ add_n_work_items(threadpool_t *tp, int n)
   while (n_queued++ < n) {
     ent = add_work(tp);
     if (! ent) {
+      puts("Z");
       tor_event_base_loopexit(tor_libevent_get_base(), NULL);
       return -1;
     }
@@ -287,6 +288,10 @@ replysock_readable_cb(tor_socket_t sock, short what, void *arg)
     shutting_down = 1;
     threadpool_queue_update(tp, NULL,
                              workqueue_do_shutdown, NULL, NULL);
+    {
+      struct timeval limit = { 2, 0 };
+      tor_event_base_loopexit(tor_libevent_get_base(), &limit);
+    }
   }
 }
 
@@ -392,7 +397,7 @@ main(int argc, char **argv)
   }
 
   {
-    struct timeval limit = { 30, 0 };
+    struct timeval limit = { 180, 0 };
     tor_event_base_loopexit(tor_libevent_get_base(), &limit);
   }