Skip to content
Snippets Groups Projects
Commit 19440b9e authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Make test_workqueue.c faster, and on-by-default.

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.
parent 65a1e27b
No related branches found
No related tags found
No related merge requests found
o Testing:
- The test_workqueue program now runs faster, and is enabled by
default as a part of "make check".
......@@ -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.
......
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment