test


Log

Author Commit Date CI Message
Nick Mathewson f89168e7 2010-05-08T19:11:50 Make test for bufferevent_connect_hostname system-neutral Previously, the be5_outcome field for the dns error would be set to something dependent on our system resolver. It turns out that you can't rely on nameservers to really give you an NEXIST answer for xyz.example.com nowadays: too many of them are annoyingly broken and like to redirect you to their locked-in portals. This patch changes the bufferevent_connect_hostname test so that it makes sure that the dns_error of be5_outcome is "whatever you would get from resolving the target hostname"
Nick Mathewson 88a543fc 2010-05-08T19:09:09 Make unit test for add_file able to tell "error" from "done" Importantly, we don't actually want to call evbuffer_write() when the buffer is empty. This makes it an error to ever get a -1 return value from evbuffer_add_file(), which makes it safe for us to test the return value.
Nick Mathewson 384d1245 2010-05-08T17:15:52 Fix bench_http build on win32.
Nick Mathewson 05de45d6 2010-05-08T16:47:07 add more (currently skipped) add_file tests on win32
Nick Mathewson dcdae6b7 2010-05-08T16:34:18 Make evbuffer_add_file() work on windows Right now only the add_file() mode is supported, when it would be nicer to have mmap support. Perhaps for Libevent 2.1.x.
Nick Mathewson b4f12a17 2010-05-08T14:49:59 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.)
Nick Mathewson f37cd4c2 2010-04-21T12:25:29 Detect broken unsetenv at unit-test runtime If we have an unsetenv function that doesn't work, we can't run the main/base_environ unit test, so we should skip it.
Nick Mathewson a62c8433 2010-05-06T14:16:50 Merge commit 'chrisd/connect-hostname-report-err'
Nick Mathewson c16e6844 2010-05-04T13:27:36 Rename current_base symbol to event_global_current_base_ The "current_base" symbol was never actually declared in an exported header; it's hideously deprecated, and it was the one remaining exported symbol (fwict) that was prefixed with neither ev nor bufferevent nor _ev nor _bufferevent. codesearch.google.com turns up no actual attempts to use our current_base from outside libevent.
Nick Mathewson cb670740 2010-04-28T11:51:56 Make debug mode catch mixed ET and non-ET events on an fd Of the backends that support edge-triggered IO, most (all?) do not support attempts to mix edge-triggered and level-triggered IO on the same FD. With debugging mode enabled, we now detect and refuse attempts to add a level-triggered IO event to an fd that already has an edge-triggered IO event, and vice versa.
Christopher Davis 0ef40706 2010-04-24T00:06:38 Report DNS error when lookup fails during bufferevent_socket_connect_hostname.
Nick Mathewson 96730d31 2010-04-23T23:13:26 Make http_base_test stop leaking an event_base.
Nick Mathewson b1c79500 2010-04-23T14:42:25 Make evdns logging threadsafe The old logging code was littered with places where we stored messages in static char[] fields. This is fine in a single-threaded program, but if you ever tried to log evdns messages from two threads at once, you'd hit a race. This patch also refactors evdns's debug_ntop function into a more useful evutil_sockaddr_port_format() function, with unit tests.
Christopher Davis 39b870b8 2010-04-22T21:49:05 Add dns/search_cancel unit test.
Sebastian Sjöberg 899c1dcc 2010-04-14T15:42:57 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)
Giuseppe Scrivano 10c4c904 2010-04-12T12:50:17 Do not inhibit automake dependencies generation It fixes make parallel builds.
Nick Mathewson 1234b95a 2010-04-09T17:19:39 Test another case of evbuffer_prepend
Nick Mathewson 8c83e995 2010-04-09T16:40:53 Add more unit tests for evbuffer_expand
Nick Mathewson 06a4443a 2010-04-09T15:28:26 Unit-test every evbuffer_add_file() implementation. Previously, we'd only test the default one, even if the others were still compiled in.
Nick Mathewson d5ebcf37 2010-03-30T16:47:37 Rewrite evbuffer_expand and its users The previous evbuffer_expand was not only incorrect; it was inefficient too. On all questions of time vs memory tradeoffs, it chose to burn time in order to avoid wasting memory. The new code tries to be a little more balanced: it only resizes an existing chain when doing so doesn't require too much copying, and when failing to do so would waste a lot of the chain's space. This patch also rewrites evbuffer_chain_insert to work properly with last_with_datap, and adds a few convenience functions to buffer.c.
Nick Mathewson b7442f8e 2010-03-26T23:18:40 Replace last_with_data with a slightly smarter version To implement evbuffer_expand() properly, you need to be able to replace the last chunk that has data, which means that we need to keep track of the the next pointer pointing to the last_with_data chunk, not the last_with_data chunk itself.
Nick Mathewson 7960af51 2010-03-22T13:37:39 Merge branch 'build'
Nick Mathewson b557b175 2010-03-21T13:28:48 Detect and refuse reentrant event_base_loop() calls Calling event_base_loop on a base from inside a callback invoked by that same base, or from two threads at once, has long been a way to get exceedingly hard-to-diagnose errors. This patch adds code to detect such reentrant invocatinos, and exit quickly with a warning that should explain what went wrong.
Nick Mathewson 33874b05 2010-03-16T13:37:15 Make 'main/many_events' test 70 fds, not 64. This is mainly intended to ensure that we don't get hung up on the 64-handle limit that lots of O(n) Windows functions (but FWICT not select) like to enforce.
Nick Mathewson 274a7bd9 2010-03-13T00:55:39 Fix some memory leaks in the unit tests These don't matter except inasmuch as they give real memory leaks a place to hide. Found with valgrind
Nick Mathewson 68dc742b 2010-03-12T20:38:25 Fix a write of uninitialized RAM in regression tests Not actually harmful, but not something we should be doing. Found by valgrind.
Nick Mathewson 0d047c3f 2010-03-13T00:29:15 Fix an obnoxious typo in the bufferevent_timeout_filter test We were using the same bufferevent as the child of two filtering parents, orphaning another. This made one get freed twice, and the other not at all. Possible fix for bug 2963306 spotted by Doug Cuthbertson.
Nick Mathewson b660edf9 2010-03-12T13:22:47 Remove redundant stuff from EXTRA_DIST To a first approximation, sources that are mentioned anywhere in an automake file don't need to get mentioned in EXTRA_DIST.
Nick Mathewson 426c8fbe 2010-03-12T13:09:28 Support the standard 'make check' target in place of 'make verify' Based on patch 2816088 from Zack Weinberg
Nick Mathewson 17da042d 2010-03-11T15:39:44 Add some glass-box tests for the last_with_data code.
Nick Mathewson 6f47bd12 2010-03-10T23:28:51 Remove previous_to_last from evbuffer
Nick Mathewson c8ac57f1 2010-03-10T23:24:14 Use last_with_data in place of previous_to_last This actually makes some of the code a lot simpler. The only ones that actually used previous_to_last for anything were reserving and committing space.
Nick Mathewson 2a6d2a1e 2010-03-10T22:16:14 Revise evbuffer to add last_with_data This is the first patch in a series to replace previous_to_last with last_with_data. Currently, we can only use two partially empty chains at the end of an evbuffer, so if we have one with 511 bytes free, and another with 512 bytes free, and we try to do a 1024 byte read, we can't just stick another chain on the end: we need to reallocate the last one. That's stupid and inefficient. Instead, this patch adds a last_with_data pointer to eventually replace previous_to_last. Instead of pointing to the penultimated chain (if any) as previous_to_last does, last_with_data points to the last chain that has any data in it, if any. If all chains are empty, last_with_data points to the first chain. If there are no chains, last_with_data is NULL. The next step is to start using last_with_data everywhere that we currently use previous_to_last. When that's done, we can remove previous_to_last and the code that maintains it.
Nick Mathewson 2c2618d8 2010-03-05T13:00:15 more whitespace normalization
Nick Mathewson c7cf6f00 2010-03-05T12:47:46 Replace users of "int fd" with "evutil_socket_t fd" in portable code Remeber, win32 has a socket type that's actually a handle, so if there's a chance that code is run on win32, we can't use "int" as the socket type. This isn't a blind search-and-replace: sometimes an fd is really in fact for a file, and not a socket at all.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Christopher Davis 1273d2f5 2010-03-02T15:16:28 VC has no getopt(), so do without in bench_http.
Christopher Davis 4ac38a5c 2010-03-02T14:34:30 Get bench_http to work on Windows; add a switch to enable IOCP.
Nick Mathewson 7ffd3875 2010-02-24T13:40:06 Delete stack-alloced event in new unit test before returning.
Nick Mathewson f3dfe462 2010-02-23T23:59:26 Use new timeval diff comparison function in bufferevent test
Nick Mathewson 8fcb7a1b 2010-02-23T23:55:32 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.
Nick Mathewson c02bfe12 2010-02-23T16:36:52 Add a test for timeouts on filtering bufferevents.
Nick Mathewson d3288293 2010-02-20T18:44:35 Provide consistent, tested semantics for bufferevent timeouts The different bufferevent implementations had different behavior for their timeouts. Some of them kept re-triggering the timeouts indefinitely; some disabled the event immediately the first time a timeout triggered. Some of them made the timeouts only count when the bufferevent was actively trying to read or write; some did not. The new behavior is modeled after old socket bufferevents, since they were here first and their behavior is relatively sane. Basically, each timeout disables the bufferevent's corresponding read or write operation when it fires. Timeouts are stopped whenever we suspend writing or reading, and reset whenever we unsuspend writing or reading. Calling bufferevent_enable resets a timeout, as does changing the timeout value.
Nick Mathewson 4faeaea9 2010-02-19T03:39:50 Clean up formatting: function/keyword spacing consistency. - Keywords always have a space before a paren. Functions never do. - No more than 3 blank lines in a row.
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 8fdf09c0 2010-02-18T17:08:50 Clean up formatting: Disallow space-before-tab.
Nick Mathewson b72be50d 2010-02-18T13:52:04 Add some headers to fix freebsd compilation
Nick Mathewson 48a29b68 2010-02-18T01:43:37 Add a unit test for secure rng. Mostly, this is just to make sure our arc4random_buf() implementation isn't dumb.
Nick Mathewson ca46d25b 2010-02-17T23:02:28 Merge branch 'arc4random'
Niels Provos 2f782af3 2010-02-13T17:04:17 validate close cb on server when client connection closes
Niels Provos e8a9782c 2010-02-13T16:59:37 clean up terminate_chunked test
Nick Mathewson d4de062e 2010-02-10T17:19:18 Add an arc4random implementation for use by evdns Previously, evdns was at the mercy of the user for providing a good entropy source; without one, it would be vulnerable to various active attacks. This patch adds a port of OpenBSD's arc4random() calls to Libevent [port by Chris Davis], and wraps it up a little bit so we can use it more safely.
Nick Mathewson 1dd7e6dc 2010-02-05T01:16:23 Remove the 'flags' argument from evdns_base_set_option() The 'flags' argument made sense when passed to evdns_(base_)?parse_resolv_conf when it said which parts of the resolv.conf file to obey. But for evdns_set_option(), it was really silly, since you wouldn't be calling evdns_set_option() unless you actually wanted to set the option. Its meaning was basically, "set this to DNS_OPTIONS_ALL unless you want a funny surprise." evdns_base_set_option was new in 2.0.1-alpha, so we aren't committed to keeping it source-compatible.
Nick Mathewson a7a94310 2010-02-03T23:49:22 Fix some additional -DUNICODE issues on win32. Brodie's patch didn't catch the ones that were new since 1.4.
Nick Mathewson e2d15d81 2010-02-03T17:52:55 Merge remote branch 'niels/http_chunk'
Niels Provos 93d73691 2010-02-03T14:34:56 do not fail while sending on http connections the client closed. when sending chunked requests via multiple calls to evhttp_send_reply_chunk, the client may close the connection before the server is done sending. this used to cause a crash. we introduce a new function evhttp_request_get_connection() that allows the server to determine if the request is still associated with a connection. If it's not, evhttp_request_free() needs to be called explicitly or the user can call evhttp_send_reply_end() which just frees the request, too.
Nick Mathewson 60742d58 2010-02-03T17:01:45 Add the rest of the integer limits, and add a test for them.
Nick Mathewson 5c7a7bca 2010-01-23T20:07:05 Fix windows and msvc build
Nick Mathewson 918e9c5e 2010-01-23T16:38:36 Fix a number of warnings from gcc -pedantic
Nick Mathewson e2ca403f 2010-01-23T16:23:45 Make it compile under gcc --std=c89.
Nick Mathewson 7296971b 2009-12-29T16:38:03 Detect setenv/unsetenv; skip main/base_environ test if we can't fake them. Previously, we assumed that we would have setenv/unsetenv everywhere but WIN32, where we could fake them with putenv. This isn't so: some other non-windows systems lack setenv/unsetenv, and some of them lack putenv too. The first part of the solution, then, is to detect setenv/unsetenv/ putenv from configure.in, and to fake setenv/unsetenv with putenv whenever we have the latter but not one of the former. But what should we do when we don't even have putenv? We could do elaborate tricks to manipulate the environ pointer, but since we're only doing this for the unit tests, let's just skip the one test in question that uses setenv/unsetenv.
Nick Mathewson 97a8c790 2010-01-22T00:34:21 Fix compilation of rate-limit code when threading support is disabled
Nick Mathewson 8d4aaf90 2010-01-20T12:56:54 Don't use a bind address for nameservers on loopback If the user sets a bind address to use for nameservers, and a nameserver happens to be on 127.0.0.1, the nameserver will generally fail. This patch alters this behavior so that the bind address is only applied when the nameserver is on a non-loopback address.
Niels Provos 78a50fe0 2010-01-14T17:39:54 forgot to add void to test function
Niels Provos 26714ca1 2010-01-14T17:05:00 add a test for evhttp_connection_base_new with a dns_base
Niels Provos b8226390 2010-01-14T16:53:25 move dns utility functions into a separate file so that we can use them for http testing
Nick Mathewson a334b31c 2010-01-14T14:46:16 More unit tests for getaddrinfo_async: v4timeout and cancel. One covers the case where the v4 request times out but the v6 request doesn't. The other makes sure that cancelling a request actually works.
Nick Mathewson 94131e92 2010-01-12T15:58:36 Fix test.sh on shells without echo -n Some systems have a version of /bin/sh whose builtin echo doesn't support the -n option used in test/test.sh. /bin/echo, however, usually does. This patch makes us use /bin/echo for echo -n whenever it is present. Also, our use of echo -n really only made sense when suppressing all test output. Since test output isn't suppressed when logging to a file, this pach makes us stop using echo -n when logging to a file.
Pavel Plesov 6cc79c6b 2010-01-11T19:04:11 Add unit-test for bad_request bug fixed in 1.4 recently. This is a partial forward-port from 4fd2dd9d83a000b6. There's no need to forward-port the bugfix, since the test passes with http.c as-is. I believe we fixed this while we were porting evhttp to bufferevent. --nickm
Nick Mathewson 72dd6667 2009-12-07T17:21:41 evdns_getaddrinfo() now supports the /etc/hosts file. The regular blocking evutil_getaddrinfo() already supported /etc/hosts by falling back to getaddrinfo() or gethostbyname(). But evdns_getaddrinfo() had no such facility. Now it does. The data structure here isn't very clever. I guess people with huge /etc/hosts files will either need to get out of the 1980s, or submit a patch to this code so that it uses a hashtable instead of a linked list. Includes basic unit tests.
Nick Mathewson ba2945f9 2010-01-06T17:59:44 Merge branch 'ratelimit' Conflicts: bufferevent_async.c
Nick Mathewson 165d30e3 2009-12-30T14:29:56 Fix compilation of rate-limiting code on win32.
Nick Mathewson 885b4273 2009-12-30T13:50:52 Fix test-ratelim compilation on Linux. I'd forgotten to include time.h, and to link against libm.
Nick Mathewson 0b151a9f 2009-12-29T18:11:52 Whitespace fixes in test.sh
Nick Mathewson 7dfbe94a 2009-12-29T18:07:51 Allow test.sh to be run as ./test/test.sh
Nick Mathewson c382de64 2009-12-29T17:59:55 Allow the user to redirect the verbose output of test/test.sh to a file By default, the test.sh script still suppresses the output of all the tests it invokes. Now, however, you can have that output written to a file specified in the TEST_OUTPUT_FILE shell variable.
Nick Mathewson 1e56a32d 2009-12-29T16:04:16 Make the initial nameserver probe timeout configurable. When we decide that a nameserver is down, we stop sending queries to it, except to periodically probe it to see if it has come back up. Our previous probe sechedule was an ad-hoc and hard-wired "10 seconds, one minute, 5 minues, 15 minutes, 1 hour, 1 hour, 1 hour...". There was nothing wrong with having it be ad-hoc, but making it hard-wired served no good purpose. Now the user can set the initial timeout via a new "initial-probe-timeout:" option; future timeouts back off by a factor of 3 on every failure to a maximum of 1 hour. As a side-benefit, this lets us cut the runtime of the dns/retry test from about 40 seconds to about 3 seconds. Faster unit tests are always a good thing.
Nick Mathewson f0c0124e 2009-12-23T07:54:13 Testing code for bufferevent rate-limiting. This is not part of the regression tests, since running it necessarily takes a while. There is a new test-ratelim test; run it with '-h' for an argument to see its options.
Nick Mathewson 4a5b5343 2009-12-23T07:48:43 Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect(). Previously, we weren't remembering that we wanted to re-add the read event once the connect was finished. Now we are.
unknown c51bb3c3 2009-12-21T16:36:40 Fix a few locking issues on windows.
Sebastian Hahn 70cdfe49 2009-12-06T02:59:19 Fix compile on Snow Leopard with gcc warnings enabled
Nick Mathewson 7ae94450 2009-12-04T16:37:43 Fix a snow leopard compile warning in the unit tests. Reported by Sebastian Hahn.
unknown 31687b4d 2009-12-02T01:22:07 Fix regress_iocp.c usage of old lock allocation macros.
Nick Mathewson d84d8385 2009-11-27T15:24:32 Fix two use-after-free bugs in unit tests spoted by lock debugging
Nick Mathewson 347952ff 2009-11-27T15:20:43 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.
Niels Provos 986500de 2009-11-19T22:02:33 nick found a race condition in the pthreads test case svn:r1554
Nick Mathewson 7511b6a9 2009-11-19T00:21:38 Fix a spelling error and remove some dead code svn:r1551
Nick Mathewson 07ce7f99 2009-11-18T21:17:00 Make our failing-connection bufferevent test more tolerant. I thought we had a way to do connect() that would never fail immediately, but always wait for a moment before failing. It turns out that on FreeBSD it can fail immediately. This is not FreeBSD's fault, or even a real bug anywhere but in the unit test. svn:r1549
Nick Mathewson 9bf124bf 2009-11-18T21:16:47 Build correctly with mm replacement turned off. svn:r1547
Nick Mathewson d7d1f1da 2009-11-17T20:31:09 Move responsibility for IOCP callback into bufferevent_async. This patch from Chris Davis saves some callback depth, and adds proper ref-counting to bufferevents when there's a deferred evbuffer callback inflight. It could use a couple more comments to really nail down what its invariants are. svn:r1543
Nick Mathewson 625a261a 2009-11-17T02:40:14 OpenBSD demands that sys/types.h be included before sys/socket.h svn:r1539
Nick Mathewson 888007f9 2009-11-17T02:38:19 Windows *does* have getservbyname, no matter what autoconf says. TODO: figure out why autoconf is confused about this. svn:r1538
Nick Mathewson 86f57420 2009-11-16T22:25:46 Add two implementations of getaddrinfo: one blocking and one nonblocking. The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively. There are fairly extensive unit tests. I believe this code conforms to RFC3493 pretty closely, but there are probably more issues. It should get tested on more platforms. This code means we can dump the well-intentioned but weirdly-implemented bufferevent_evdns and evutil_resolve code. svn:r1537
Nick Mathewson 72bafc17 2009-11-16T22:23:55 Remove the stupid brokenness where DNS option names needed to end with a colon. svn:r1536
Nick Mathewson c79a45e0 2009-11-14T21:54:30 Fix a couple of event_debug calls. svn:r1527
Nick Mathewson b2fe4aed 2009-11-09T18:36:34 Unit tests for got_break and got_exit. svn:r1521
Nick Mathewson 693c24ef 2009-11-09T17:16:30 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
Nick Mathewson 784b8773 2009-11-06T21:46:57 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
Nick Mathewson ac633aeb 2009-11-05T21:22:23 Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons. svn:r1510
Nick Mathewson 4ca9efea 2009-11-05T20:40:11 Add nmake files to build with MSVC. Right now, they just make static libraries and unit tests. They probably set lots of options wrong. svn:r1507