937 Commits

Author SHA1 Message Date
Andrew Sweeney
b083ca0551 Provide on request complete callback facility
This patch provides the ability to receive a callback on the completion of a
request.  The callback takes place immediately before the request's resources
are released.
2014-01-05 20:35:46 -05:00
Nick Mathewson
b4ef3def6f Merge remote-tracking branch 'mistotebe/bufferevent_trigger' 2013-12-24 10:33:58 -05:00
Nick Mathewson
87fa2b004a Unit tests for active_by_fd; unsupport active_by_fd(TIMEOUT)
[It turns out that event_base_active_by_fd(TIMEOUT) didn't actually
work right. Feel free to add it back in as a patch.]
2013-12-23 20:46:38 -05:00
Ondřej Kuzník
a7384c7824 Add an option to trigger bufferevent event callbacks 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
61ee18b8b1 Add an option to trigger bufferevent I/O callbacks 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
4ce242bd00 Add watermark introspection 2013-12-03 23:39:13 +00:00
Azat Khuzhin
4dd500cdf4 regress_http: add tests for evhttp_connection_get_addr() 2013-10-14 11:22:30 -04:00
Azat Khuzhin
611e28b6ee regress_main: logging all if env EVENT_DEBUG_LOGGING_ALL isset 2013-10-01 20:22:27 +04:00
Nick Mathewson
0a051ef93c Merge remote-tracking branch 'rosslagerwall/tree-build' 2013-09-16 12:29:48 -04:00
Ross Lagerwall
243386ccc2 rpcgen: Generate regress.gen.[c,h] in build rather than src dir
Currently an out-of-tree build will either write to the src dir or reuse
the existing regress.gen.[c,h].  But if building from a read-only git
tree (or if the git dir is cleaned), these files will not exist and the
build fails.  So write the files to the build dir.  If the system does
not have python, the regress.gen.[c,h] will be used from the src dir if
they exist.
2013-09-15 21:48:15 +02:00
Nick Mathewson
e193c959de test_evutil_rtrim: add another missing check. 2013-08-06 19:42:20 -04:00
Nick Mathewson
82b6956c1b Finalize tests: add a missing check 2013-08-06 19:39:35 -04:00
Nick Mathewson
f314900dfd DNS tests: add a missing check 2013-08-06 19:38:48 -04:00
Nick Mathewson
87cd6f0186 Fix some crash-on-fail cases in DNS regression tests
Found by coverity.
2013-08-06 19:35:56 -04:00
Nick Mathewson
eba4506abf Add missing check to test_evbuffer_file_segment_add_cleanup_cb 2013-08-06 19:33:45 -04:00
Nick Mathewson
776588468b Fix a logic error in test_evbuffer_freeze 2013-08-06 19:32:21 -04:00
Nick Mathewson
1104d0bee9 Fix a (failure-only) null dereference in the unit tests 2013-08-06 19:31:26 -04:00
Nick Mathewson
7080d55c49 Use void casts to suppress some "unchecked return value" warns 2013-08-06 19:28:53 -04:00
Maxime Henrion
fbc323b76b Add checks for evhttp_connection_get_server() in unit tests.
They validate that this function behave as expected; that is, it returns
NULL for outgoing connections, and returns the HTTP server object that
received the connection for incoming ones.
2013-07-31 21:55:19 -04:00
Mark Ellzey
4b3d5af8e2 Add function to fetch underlying ratelimit cfg
bufferevent_get_token_bucket_cfg() will return the struct ev_token_bucket_cfg
for a bufferevent if available.
2013-07-11 12:31:39 -04:00
Mobai Zhang
0fa107d8cb Added event_base_get_num_events() 2013-07-02 16:01:02 -04:00
Nick Mathewson
e1766a1b6d Actually use the log facility for reporting evdns problems.
Fixes issue #63.  Also refactors the evdns logging and log backend a
bit, so that it wastes a little less code.
2013-05-29 16:26:50 -04:00
Azat Khuzhin
7e876df71b Fix dns/leak_resume_send_err test.
Because we don't cancel request,
and want our callback to recieve DNS_ERR_SHUTDOWN,
we use deferred callback, and there was
- one extra malloc(),
  @see reply_schedule_callback()
- and one missing free
  @see request_finished() (req->handle->pending_cb = 1)
than we don't need to count in testleak_cleanup()

So just decrement allocated_chunks to 2,
like we already take care about it.
2013-05-13 19:56:00 +00:00
Azat Khuzhin
1cd9ff591d Add tests for evdns_base_resume().
- leak_resume
- leak_cancel_and_resume
- leak_resume_send_err
- leak_cancel_and_resume_send_err
2013-05-13 19:56:00 +00:00
Nick Mathewson
8ab612e396 Whoops. It is gdi.lib, not gdi32.lib. (github issue #61) 2013-05-11 22:21:30 -04:00
Nick Mathewson
5ba8ab76e9 Fix test compilation with nmake: add the gdi.lib dependency
ACK: efekty
2013-05-10 21:38:26 -04:00
Nick Mathewson
85a40040d1 Add regress_finalize to makefile.nmake 2013-05-01 13:37:57 -04:00
Nick Mathewson
5bc290e247 Make http/connection_retry off-by-default 2013-05-01 10:04:08 -04:00
Nick Mathewson
9e3a99cad7 Fix a bug in fixing a bug in out-of-tree test-dumpevents 2013-04-30 20:09:52 -04:00
Nick Mathewson
b48c7bf8a6 Make regress_finalize work with malloc replacement disabled 2013-04-30 14:40:50 -04:00
Nick Mathewson
cbfc35f6b9 Fix some out-of-tree build bugs 2013-04-30 14:26:47 -04:00
Nick Mathewson
702c9aa403 Fix a bug in the new main/event_foreach test
It wasn't making sure that the events weren't internal.
2013-04-26 19:14:05 -04:00
Nick Mathewson
d5967397b0 More unit tests for initializing common timeouts.
Try with: misformed usecs in inputs, and with initializing common timeouts
from other common timeouts.
2013-04-26 17:51:33 -04:00
Nick Mathewson
f09629eac5 A test for event_get_assignment() 2013-04-26 17:46:33 -04:00
Nick Mathewson
30ea2910d5 Unit tests for event_base_gettimeofday_cached() and event_base_update_cache_time() 2013-04-26 17:37:15 -04:00
Nick Mathewson
0b096efee5 New tests for event_base_foreach_event()
Our dump-events code had exercised this a bit, but only via the
nonlocking backend. Also, nothing was checking the "Search for a
specific event" code.
2013-04-26 13:52:51 -04:00
Nick Mathewson
a153874d18 New test for active_later->active transition on event_active
When event_active is called, an active_later event is supposed to become
active now.  We had lacked a test for that.
2013-04-26 13:49:45 -04:00
Nick Mathewson
3555befd1c Merge branch '21_deadlock_fix_v2' 2013-04-26 12:27:05 -04:00
Nick Mathewson
25aac69780 Remove a no-longer-true XXXX comment. 2013-04-26 12:18:38 -04:00
Nick Mathewson
9d893c97fa Add some verbose notes to bufferevent unit tests 2013-04-26 12:18:07 -04:00
Nick Mathewson
8eedeabe50 Implement event_finalize() and related functions to avoid certain deadlocks 2013-04-26 12:18:07 -04:00
Nick Mathewson
b1b054f064 Make all tests pass under EVENT_DEBUG_MODE=1
The fix was easy: the tests that were failing were those tests that
also enabled debug mode themselves. So, let them know when
EVENT_DEBUG_MODE is on, so they won't do that.
2013-04-26 12:12:08 -04:00
Nick Mathewson
b3aca5d96c Merge branch '21_http_error_cb_squashed' 2013-04-25 15:13:24 -04:00
Azat Khuzhin
54cc800536 Drop extra header http_struct.h from regress_http.c 2013-04-25 15:12:20 -04:00
Azat Khuzhin
862c217a29 Add test for EVREQ_HTTP_REQUEST_CANCEL into http_cancel_test() 2013-04-25 15:12:20 -04:00
Azat Khuzhin
7b077194cc Add new error_cb for actual reporting of HTTP request errors.
It is useful to know why you callback called with NULL (i.e. it failed),
for example if you set max_body with evhttp_connection_set_max_body_size()
you must know that it failed because of body was longer than this size.

 (Commit message tweaked by Nick)
2013-04-25 15:11:44 -04:00
Nick Mathewson
1c3147f5e7 Add a test with an active_later event at event_base_free time. 2013-04-10 18:03:16 -04:00
Nick Mathewson
2fad0f3d52 Add an environment variable (EVENT_DEBUG_MODE) to run unit tests in debug mode
Not all tests currently pass with debug mode on.
2013-04-05 15:06:54 -04:00
Nick Mathewson
f935e2159a build test/test-script.sh on systems with a less-featureful $< 2013-03-15 09:33:28 -04:00
Nick Mathewson
787fd7489f Make --disable-libevent-regress work again 2013-03-15 09:33:13 -04:00