609 Commits

Author SHA1 Message Date
Nick Mathewson
e06f514d4e Fix signed/unsigned warnings on win32 2010-10-14 13:51:24 -04:00
Nick Mathewson
e5c214a423 Fix -Wsigned-compare warnings in test/* 2010-10-14 13:16:41 -04:00
Nick Mathewson
02f6259fc3 New unit test for ssl bufferevents starting with connected SSLs. 2010-10-14 12:17:28 -04:00
Nick Mathewson
34331e456d The corrected bufferevent filter semantics let us fix our openssl tests 2010-10-14 10:55:04 -04:00
Nick Mathewson
a8148cedcd New evhttp_uri(encode|decode) functions to handle + and NUL characters right
The old evhttp_decode_uri() function would act as tough it was doing
an (illegal, undefined) decode operation on a whole URL at once, and
treat + characters following a ? as different from + characters
preceding one.  But that's not useful: If you are decoding a URI
before splitting off query parameters, you are begging to fail as soon
as somebody gives you a value with an encoded & in it.

The new evhttp_uridecode() function takes an argument that says
whether to decode + signs.  Both uridecode and uriencode also now
support encoding or decoding to strings with internal 0-valued
characters.
2010-10-08 23:58:00 -04:00
Christopher Davis
62b429afa8 Make iocp/listener/error work; don't accept again if lev is disabled. 2010-10-07 18:11:38 -04:00
Nick Mathewson
127d4f2195 Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners 2010-10-07 18:11:19 -04:00
Nick Mathewson
b1756d019d Let evhttp_parse_query return -1 on failure
We already detected certain malformed queries, but we responded by
aborting the query-parsing process half-way through without telling
the user.  Now, if query-parsing fails, no headers are returned, and
evhttp_parse_query returns -1.
2010-10-06 12:30:17 -04:00
Nick Mathewson
5b7a370636 Fix warnings on mingw with gcc 4.5 2010-10-05 14:29:48 -04:00
Nick Mathewson
d49b5e3326 Do not search outside of the system directory for windows DLLs
Hardens against some attacks.
2010-09-27 15:45:34 -04:00
Nick Mathewson
045eef4cde Unit tests for listener error callbacks 2010-09-23 14:23:45 -04:00
Nick Mathewson
4858b7949c Remove the now-useless evsig_caught and evsig_process 2010-09-15 01:54:51 -04:00
Nick Mathewson
720bd933c8 Warn when using the error-prone EV_SIGNAL interface in an error-prone way. Also, fix a couple of race conditions in signal.c
When using the signal.c signal backend, Libevent currently only allows
one event_base to actually receive signals at a time.  (This has been
the behavior since at least 1.4 and probably much earlier.)  Now, we
detect and warn if you're likely to be racing about which signal goes
to which thread.

We also add a lock to control modifications of the evsig_base field,
to avoid race conditions like those found by Jason Toffaletti.

Also, more comments.  Comments are good.
2010-09-15 01:12:01 -04:00
Nick Mathewson
f0bd83ea88 Bump to the latest version of tinytest
This lets us do without libevent-specific code in tinytest.c, and
lets us add a feature to skip individual tests from the command
line.
2010-09-09 16:13:09 -04:00
Nick Mathewson
a5ce9ad4af Make SSL tests cover enabling/disabling EV_READ.
I want my 80% coverage.
2010-09-09 16:01:42 -04:00
Nick Mathewson
2756a10cd9 Add a missing time.h include to test/regress_thread.c 2010-09-09 13:43:31 -04:00
Nick Mathewson
fb36f9a7e5 Fix an uninitialized-variable warning on windows 2010-09-09 13:00:54 -04:00
Christopher Davis
3ec65d6984 Fix a few Windows compile warnings. 2010-09-08 19:55:13 -07:00
Nick Mathewson
25b6a74be6 Merge branch 'tests' 2010-09-08 14:53:57 -04:00
Nick Mathewson
de412948a1 Add a missing header for regress_thread.c 2010-09-08 14:52:24 -04:00
Sebastian Hahn
911e0db8f0 Fix a compile warning in regress_thread.c 2010-09-08 20:29:39 +02:00
Nick Mathewson
3658b1696d Merge remote branch 'chrisd/iocp-fixes4'
Conflicts:
	test/regress_thread.c
2010-09-08 14:12:12 -04:00
Nick Mathewson
9580e282d7 Merge branch 'th_notify_fd_reinit' 2010-09-08 14:00:45 -04:00
Nick Mathewson
ce85280beb Improve testing of when thread-notification occurs 2010-09-08 13:29:06 -04:00
Christopher Davis
17a14f1af2 Only process up to MAX_DEFERRED deferred_cbs at a time.
If threads queue callbacks while event_process_deferred_callbacks is
running, the loop may spin long enough to significantly skew timers.
A unit test stressing this behavior is also in this commit.
2010-09-08 01:22:22 -07:00
Christopher Davis
2447fe8886 Add event_config_set_num_cpus_hint for tuning thread pools, etc. 2010-09-08 01:22:22 -07:00
Christopher Davis
499452f4c2 IOCP-related unit test tweaks 2010-09-08 01:22:22 -07:00
Christopher Davis
d844242f9b Stop IOCP when freeing the event_base. 2010-09-08 01:22:21 -07:00
Nick Mathewson
1115366e95 Fix a few memory leaks in the tests 2010-09-07 10:36:19 -04:00
Nick Mathewson
42090072c1 Move the "function to getsockname() on a listener" to regress_testutils
This reverts commit fab50488fcb741884ccdfa7b83643eac3e5c9cbf.

The function was, on reflection, not important enough to break the feature
freeze, since it's trivial to build on your own.
2010-09-06 15:52:48 -04:00
Shuo Chen
b0f284cb18 Fix event_del(0) instance in bench.c 2010-09-06 10:10:17 -04:00
Nick Mathewson
b5dd8064fc Fix uninitialized port var in http_delete_test. Last one, I hope. 2010-09-03 22:00:25 -04:00
Nick Mathewson
3b3fb7438d Fix uninitialized variables in http_bad_request_test. (oops) 2010-09-03 21:03:25 -04:00
Nick Mathewson
a97320ac57 Allow more than one copy of regression tests to run at once
Mostly this was a matter of just removing all the hardwired ports in
the test code.  The http/connection_retry test is still a little
screwy, though.
2010-09-03 18:48:31 -04:00
Nick Mathewson
041989fb66 Rename regress_pthread.c to regress_thread.c 2010-08-24 12:42:24 -04:00
Nick Mathewson
743f866539 Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code 2010-08-23 11:49:06 -04:00
Nick Mathewson
5fb1095824 Add a unit test for conditions 2010-08-17 13:21:05 -04: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
4022b287f8 Change include order in Makefile.nmake
If there is an event-config.h in include/event2 (either because we
screwed up packaging like in 2.0.6-rc or because we previously tried
building with mingw and we didn't make distclean in the middle), we
want MSVC to find the one one in WIN32-Code/include/event2 first.

Found by Gilad Benjamini.
2010-08-13 11:34:39 -04:00
Nick Mathewson
0bffe43a15 Fix a nasty dangling-event bug when using rate-limiting groups
When we freed a bufferevent that was in a rate-limiting group and
blocked on IO, the process of freeing it caused it to get removed
from the group.  But removing the bufferevent from the group made
its limits get removed, which could make it get un-suspended and in
turn cause its events to get re-added.  Since we would then
immediately _free_ the events, this would result in dangling
pointers.

Fixes bug 3041007.
2010-08-09 12:08:40 -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
28f31a4f8d Fix unit tests with -DUSE_DEBUG enabled
If you were to enable USE_DEBUG and slog through all 700+ MB of
debugging output, you'd find that one of the unit tests failed,
since it tested the debug logging code, but the string it expected
and the string it logged differed by a tab vs 2 spaces.
2010-08-06 16:36:23 -04:00
Nick Mathewson
ea1ea3d6ee Make test-changelist count cpu usage right on win32 2010-08-06 14:06:20 -04:00
Nick Mathewson
9b60209675 Use AF_INET socketpair to test sendfile on Solaris 2010-08-06 13:03:17 -04:00
Nick Mathewson
170ffd2b1d Increase the tolerance in our unit tests for sloppy clocks.
(Apparently openbsd in virtualbox just doesn't keep very accurate time.)
2010-08-05 15:57:30 -04:00
Nick Mathewson
e996b3d411 Make tests quieter on local dns resolver failure 2010-08-05 15:51:16 -04:00
Nick Mathewson
b2c6202d65 Fix an assertion bug in test-ratelim
If the rate limit was low enough, then the echo_conns wouldn't finish
inside the 300 msec we allowed for them to close.  Instead, count the
number of connections we have, and keep waiting until they are all
closed.
2010-08-04 15:52:32 -04:00
Nick Mathewson
42f6b62414 Add option to test-ratelim to test min_share 2010-08-04 15:51:14 -04:00
Nick Mathewson
42a8c71112 Build more cleanly with NetBSDs that dislike toupper(char)
To be fair, when char can be signed, if toupper doesn't take negative
characters, toupper(char) is a very bad idea.  So let's just use the
nice safe EVUTIL_TOUPPER instead.  (It explicitly only upcases ASCII,
but we only use it for identifiers that we know to be ASCII anyway).
2010-07-31 17:10:04 -04:00
Joachim Bauch
840a72fbd5 Fix badly-behaved subtest of dns/bufferevent_connect_hostname
The bufferevent_connect_hostname test was specifying AF_INET, but the
gethostbyname test we were using to see what error to expect was using
PF_UNSPEC, leading to possible divergence of results.
2010-07-29 20:32:40 -04:00