42 Commits

Author SHA1 Message Date
Nick Mathewson
e5c214a423 Fix -Wsigned-compare warnings in test/* 2010-10-14 13:16:41 -04:00
Christopher Davis
2447fe8886 Add event_config_set_num_cpus_hint for tuning thread pools, etc. 2010-09-08 01:22:22 -07:00
Nick Mathewson
d74ae381e0 Make the regress_pthread.c tests work on windows with current test APIs 2010-08-17 13:21:05 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
b4f12a17aa Implement regress_make_tempfile on win32 to test evbuffer_add_file
(Conclusion: evbuffer_add_file is broken on win32, since it
uses recv on a file.)
2010-05-08 16:14:20 -04:00
Sebastian Sjöberg
899c1dcc98 Replace EVUTIL_CLOSESOCKET macro with a function
The EVUTIL_CLOSESOCKET() macro required you to include unistd.h in your
source for POSIX.  We might as well turn it into a function: an extra
function call is going to be cheap in comparison with the system call.

We retain the EVUTIL_CLOSESOCKET() macro as an alias for the new
evutil_closesocket() function.

(commit message from email by Nick and Sebastian)
2010-04-14 15:42:57 -04:00
Nick Mathewson
17efc1cdfa Update all our copyright notices to say "2010" 2010-03-04 01:38:48 -05:00
Nick Mathewson
8fcb7a1b04 Add test for periodic timers that get activated for other reasons
This was already independently verified by the new bufferevent
timeout tests, but it's good to explicitly check that our code
does what it should.
2010-02-23 23:55:32 -05:00
Nick Mathewson
e5bbd40ad7 Clean up formatting: use tabs, not 8-spaces, to indent. 2010-02-18 17:44:09 -05:00
Sebastian Hahn
70cdfe49fa Fix compile on Snow Leopard with gcc warnings enabled 2009-12-06 02:59:19 +01:00
Nick Mathewson
d84d8385cd Fix two use-after-free bugs in unit tests spoted by lock debugging 2009-11-27 17:36:51 -05:00
Nick Mathewson
347952ffe0 Revise the locking API: deprecate the old locking callbacks and add trylock.
Previously, there was no good way to request different kinds of lock
(say, read/write vs writeonly or recursive vs nonrecursive), or for a
lock function to signal failure (which would be important for a
trylock mode).

This patch revises the lock API to be a bit more useful.  The older
lock calls are still supported for now.

We also add a debugging mode to catch common errors in using the
locking APIs.
2009-11-27 17:36:24 -05:00
Nick Mathewson
625a261a53 OpenBSD demands that sys/types.h be included before sys/socket.h
svn:r1539
2009-11-17 02:40:14 +00:00
Nick Mathewson
693c24ef9d Implement queued timeouts for case where many timeouts are the same.
Libevent's current timeout code is relatively optimized for the
randomly scattered timeout case, where events are added with their
timeouts in no particular order.  We add and remove timeouts with
O(lg n) behavior.

Frequently, however, an application will want to have many timeouts
of the same value.  For example, we might have 1000 bufferevents,
each with a 2 second timeout on reading or writing.  If we knew this
were always the case, we could just put timeouts in a queue and get
O(1) add and remove behavior.  Of course, a queue would give O(n)
performance for a scattered timeout pattern, so we don't want to
just switch the implementation.

This patch gives the user the ability to explicitly tag certain
timeout values as being "very common".  These timeout values have a
cookie encoded in the high bits of their tv_usec field to indicate
which queue they belong on.  The queues themselves are each
triggered by an entry in the minheap.

See the regress_main.c code for an example use.

svn:r1517
2009-11-09 17:16:30 +00:00
Nick Mathewson
784b8773a4 We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H
svn:r1516
2009-11-06 21:46:57 +00:00
Nick Mathewson
86db1c851b Commit ConnectEx code to get connect working with async bufferevents.
This is code by Chris Davis, with changes to get the unit tests failing less aggressively.

The unit tests for this code do not completely pass yet; Chris is looking into that.  If they aren't passing by the next release, I'll turn off this code.

svn:r1499
2009-11-04 05:19:26 +00:00
Nick Mathewson
9a772148f2 Compilation and correctness fixes for IOCP listener code.
svn:r1489
2009-11-02 19:31:29 +00:00
Nick Mathewson
5f1d6e640f Add more IOCP tests. They might not pass yet.
svn:r1487
2009-11-02 17:42:16 +00:00
Nick Mathewson
ed0e91e02a New test flag to suppress logging for one test.
svn:r1466
2009-10-27 04:03:50 +00:00
Nick Mathewson
8a3007efb9 More evconnlistener unit tests: bump its coverage from 71% to 83%.
svn:r1392
2009-07-30 17:01:38 +00:00
Nick Mathewson
a826a75800 Some tweaks to Brodie Thesfield's MSVC patch.
svn:r1386
2009-07-28 19:41:48 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
709c21c48c Bufferevent support for openssl.
This code adds a new Bufferevent type that is only compiled when the
openssl library is present.  It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.

There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better.  Sometimes events are
generated needlessly: this will hose performance.

There's a new encrypting proxy in sample/le-proxy.c.

This code has only been tested on OSX, and nowhere else.

svn:r1382
2009-07-28 04:03:57 +00:00
Nick Mathewson
f4775918cd Refactor evtag tests into their own suite.
svn:r1366
2009-07-20 14:55:51 +00:00
Nick Mathewson
61f2a45de1 Add a tinytest flag to initialize threading.
svn:r1357
2009-07-17 20:23:05 +00:00
Nick Mathewson
043515bc52 Stop using C++ style comments.
svn:r1343
2009-07-14 18:50:06 +00:00
Nick Mathewson
ec1468832e Oops: actually commit changes to build and use regress_iocp
svn:r1255
2009-04-30 19:05:43 +00:00
Nick Mathewson
5c104cef51 Add a randomized test for heap correctness.
svn:r1229
2009-04-23 00:33:37 +00:00
Nick Mathewson
ea664bf29a Refactor test wrappers to divide legacy items from useful stuff.
svn:r1212
2009-04-21 18:46:30 +00:00
Nick Mathewson
7cf8a7b0e0 Call the main testcases "main", not "legacy".
svn:r1210
2009-04-21 18:45:59 +00:00
Nick Mathewson
68d0139f19 Refactor the zlib and pthreads tests to appear in the regular tinytest tree structure.
svn:r1141
2009-04-07 04:49:25 +00:00
Nick Mathewson
0afb1f7ffb Glibc mkstemp requires exactly 6 Xs.
svn:r1129
2009-04-01 16:08:34 +00:00
Nick Mathewson
73094d5952 Make tmpfile code compile without warnings
svn:r1123
2009-02-13 13:43:35 +00:00
Niels Provos
79b7799bd1 a simple test for evbuffer_add_file
svn:r1122
2009-02-13 01:42:59 +00:00
Nick Mathewson
ea11f8195f Compile http_connection_retry_test, but mark it skipped on win32.
svn:r1099
2009-02-02 22:17:32 +00:00
Nick Mathewson
ea4b8724c0 checkpoint work on big bufferevent refactoring
svn:r1095
2009-02-02 19:22:13 +00:00
Nick Mathewson
2e3f0f682a Enable the edge-triggered test again
svn:r1092
2009-02-01 02:20:16 +00:00
Nick Mathewson
a30c9eb1ac Move evbuffer tests into their own file.
svn:r1087
2009-02-01 01:07:12 +00:00
Nick Mathewson
fa6ae16992 Convert RPC suite. There are still some places it can exit(1), but those always run forked, so no big deal.
svn:r1083
2009-01-31 18:36:24 +00:00
Nick Mathewson
eac75f91e4 Port DNS tests.
svn:r1081
2009-01-31 07:32:14 +00:00
Nick Mathewson
153093ecc3 Port the HTTP unit tests. Most are still legacy (since they use test_ok so much), but at least they no longer exit(1) on failure
svn:r1076
2009-01-30 17:44:13 +00:00
Nick Mathewson
a8203b3490 Refactor unit tests using my spiffy new "tinytest" framework.
The big win here is that we can get process-level isolation.

This has been tested to work okay on at least Linux and Win32.  Only
the tests in regress.c have been converted wrapped in the new wrapper
functions; the others are still on the old system.

svn:r1073
2009-01-29 23:19:57 +00:00