1356 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón
a86f89d333 test: avoid regress hanging in macOS
a backtrace of the process without this patch :
  * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    * frame #0: 0x00007fffb1fb7d96 libsystem_kernel.dylib`kevent + 10
      frame #1: 0x0000000108ed0a58 libevent-2.2.1.dylib`kq_dispatch + 696
      frame #2: 0x0000000108ec53d8 libevent-2.2.1.dylib`event_base_loop + 696
      frame #3: 0x0000000108e1763b regress`test_fork + 1931
      frame #4: 0x0000000108e5c7ad regress`run_legacy_test_fn + 45
      frame #5: 0x0000000108e690aa regress`testcase_run_one + 858
      frame #6: 0x0000000108e6954f regress`tinytest_main + 495
      frame #7: 0x0000000108e5c94b regress`main + 171
      frame #8: 0x00007fffb1e88235 libdyld.dylib`start + 1
      frame #9: 0x00007fffb1e88235 libdyld.dylib`start + 1

Issue: #546
2017-09-11 01:48:35 +03:00
Carlo Marcelo Arenas Belón
63c4bf78d6 test: fix 32bit linux regress 2017-09-01 15:50:36 -07:00
Ondřej Kuzník
cf7f5b0dc4 Fix tests with detached builds
Closes: #524
2017-07-16 21:35:05 +03:00
Azat Khuzhin
15da23cfdb test: do not use .fieldname in structure initializations (fixes win32)
Fixes: #497
2017-05-01 21:57:23 +03:00
Azat Khuzhin
8d89c21258 Add missing print-winsock-errors.c into dist archive
Refs: #497
2017-05-01 21:55:00 +03:00
Azat Khuzhin
5ff83989f3 test: cover that after event_del() callback will not be scheduled again
Refs: #236
Refs: #225
2017-04-30 01:35:03 +03:00
Azat Khuzhin
8acfb0cd21 test: do not return void 2017-03-14 13:21:16 +03:00
Azat Khuzhin
a4b1828d6d test: windows doesn't have WNOWAIT
Fixes: 66a4eb0c3ae3b1f22b084b2d3aeb5c872f37efbd ("Check for WNOWAIT in
waitpid() in runtime (not in cmake/configure)")
2017-03-14 00:04:26 +03:00
Azat Khuzhin
66a4eb0c3a Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
Because checking in cmake breaks cross-compiling.

Introduced-in: 43eb56c7c738e3642f0981e3dd6ab9e082eec798.
Fixes: #482
Fixes: #462
Refs: #475

v2: use waitid() with WNOWAIT
v3: use WNOWAIT only if it available in waitpid(), because not all netbsd
    supports it
2017-03-08 13:31:55 +03:00
Jan Beich
d057c45e8f Unbreak build with LibreSSL after openssl 1.1 support added
Fixes: 3e9e0a0d46e4 ("Make it build using OpenSSL 1.1.0")
Fixes: #445
2017-01-30 00:25:26 +03:00
Jan Beich
77ec05e50d test/bench*: prefix event-config.h macros after 0dda56a48e94 2017-01-29 23:02:41 +03:00
Jan Beich
d9118c8daa test/bench_httpclient: restore SO_LINGER usage after 0dda56a48e94 2017-01-29 23:02:41 +03:00
Azat Khuzhin
ea1d30cac4 test: register different tests in automake
Before this patch we have one test.sh (well test-script.sh), and tooks
very long to run it sequentially, but they are pretty lightweight, so we
should run then in parallel.
2017-01-22 03:22:07 +03:00
Azat Khuzhin
54d7473f91 test: run different tests under different options (in a wrapper) 2017-01-22 03:21:43 +03:00
Azat Khuzhin
d6bafbbeb2 test/dns: replace servname since solaris does not have "http"
Yes, by default solaris (solaris10.dev 5.10 Generic_147148-26 i86pc i386 i86pc)
does not have "http" in /etc/services
2017-01-20 02:16:50 +03:00
Azat Khuzhin
09b6201304 test/ssl: fix bufferevent_getfd() for bufferevent_openssl_filter_new() 2017-01-19 20:53:05 +03:00
Azat Khuzhin
d77fcea15f test/https: separate cases for https client with filtered openssl bufferevent
- http/https_filter_chunk_out # now hang
- http/https_filter_basic     # works, since writes only before connect()
2017-01-19 20:53:05 +03:00
Azat Khuzhin
d047c2412e test/ssl: cover case when we writing to be_openssl after connecting
Right now it fails because of regression for filtered openssl
bufferevent, and by it I mean ssl/bufferevent_filter_write_after_connect
test, and by fails - hang.

Regression-for: da52933550fd4736aa1c213b6de497e2ffc31e34 ("be_openssl:
don't call do_write() directly from outbuf_cb")
2017-01-19 20:53:05 +03:00
Azat Khuzhin
3c7422fc52 test/thread: netbsd is too slow, increase timeout for conditions_simple 2017-01-19 20:51:38 +03:00
Azat Khuzhin
0786253115 test/dns: run async resolving after sync one (to avoid timeouts)
If system resolver (sync one) will respond too slow, then we can fail async
request and evdns will retransmit tham again, but evdns server will accept that
failed requets, so we will have not 2 requests but 4.

Reproduced on centos box sometimes.
2017-01-19 20:50:22 +03:00
Azat Khuzhin
26f416c1a5 test/http: turn off some tests that based on backlog filling (falky)
Since this technique does not work well everywhere, anyway it fails from time
to time.

See: https://travis-ci.org/libevent/libevent/jobs/186426446
2017-01-08 05:22:02 +03:00
Azat Khuzhin
4798de6c64 test: fix util/date_rfc1123 under win32
Refs: #417
v2: check when gmtime() returns NULL
v3: fix overflow cases
2016-12-22 18:10:24 +03:00
Azat Khuzhin
4545807db4 Fix UB in evutil_date_rfc1123()
As pointed in https://github.com/libevent/libevent/pull/417#issuecomment-267860738
  "code is unsafe because in evutil_date_rfc1123() the pointer to the
  automatic variable struct tm cur is used outside the scope it defined."

Checked with `clang -fsanitize=address -fsanitize-address-use-after-scope`
and test that call evutil_date_rfc1123() with tm==NULL
2016-12-22 14:46:38 +03:00
Vis Virial
360aa233f0 add tests for evutil_date_rfc1123(). 2016-12-19 00:58:49 +03:00
Azat Khuzhin
cfe2ab22f2 test/https: fix ssl dirty bypass for https_simple
Tests:
- http/https_simple_dirty # not affected, since dirty is the default
- http/https_simple       # affected

v2: fix compilation with -DEVENT__DISABLE_OPENSSL=ON
2016-12-07 01:30:41 +03:00
Azat Khuzhin
45247e6fd9 test/https: cover multiple request over the same connection
Introduce two new tests:
- http/https_connection         # fail
- http/https_persist_connection # ok

Reported-by: liutao74748@163.com
2016-12-07 01:24:40 +03:00
Azat Khuzhin
e6ae069b48 test/http: sanity check for http_request_empty_done() 2016-12-07 01:24:40 +03:00
Azat Khuzhin
532a47ce1e test: fix building under openssl 1.1 (init functions has been deprecated)
Refs: #397
2016-12-07 01:14:16 +03:00
Azat Khuzhin
336f3b11e5 Fix _FILE_OFFSET_BITS redinition (solaris/autotools)
So firstly include our header (config.h) -- <evconfig-private.h>, and
only after it <sys/types.h> since latest has #ifdef guard, while our
config.h is not inteded for this.

And besides all this thing with LARGE_FILE is a abit awkward, since we
don't nefine _LP64/_LP32 anyway, and so we have next error actually (64bit VS
32bit):
==> solaris: In file included from ./util-internal.h:30:0,
==> solaris:                  from test/regress_ssl.c:49:
  ==> solaris: ./evconfig-private.h:29:0: warning: "_FILE_OFFSET_BITS" redefined
  ==> solaris:  #define _FILE_OFFSET_BITS 64
  ==> solaris:  ^
  ==> solaris: In file included from /usr/include/sys/types.h:17:0,
  ==> solaris:                  from test/regress_ssl.c:38:
  ==> solaris: /opt/csw/lib/gcc/i386-pc-solaris2.10/5.2.0/include-fixed/sys/feature_tests.h:196:0: note: this is the location of the previous definition
  ==> solaris:  #define _FILE_OFFSET_BITS 32
  ==> solaris:  ^

For cmake it commented in: 8b228e27f57300be61b57a41a2ec8666b726dc34
("Lot's of cmake updates")
2016-12-06 13:21:28 +03:00
Azat Khuzhin
253e7fa90c util-internal: fix __func__ redefinition (netbsd)
==> netbsd: In file included from ../listener.c:57:0:
==> netbsd: ../util-internal.h:58:0: warning: "__func__" redefined [enabled by default]
==> netbsd:  #define __func__ EVENT____func__
==> netbsd:  ^
==> netbsd: In file included from /usr/include/amd64/types.h:39:0,
==> netbsd:                  from /usr/include/sys/types.h:45,
==> netbsd:                  from ../listener.c:30:
==> netbsd: /usr/include/sys/cdefs.h:394:0: note: this is the location of the previous definition
==> netbsd:  #define __func__ __PRETTY_FUNCTION__
2016-12-06 12:54:33 +03:00
Azat Khuzhin
2c62062e12 Fix signedness differ for iov_base (solaris) 2016-12-06 12:54:33 +03:00
Philip Prindeville
6bf2061c4b C90 doesn't like declarations intermingled with statements
So move all of the declarations to the top of the offending function.

This patch includes both of issues (Fixes:), from @jeking3 and
@pprindeville

Fixes: #418
Fixes: nmathewson/Libevent#136
2016-12-06 09:56:28 +03:00
Tim Hentenaar
cb0df5cfac test/regress: cover a polling of invalid fd
Test that an event's callback is called if the fd is closed prior to being
polled for activity.

azat: make it run only for poll backend/method, and do not close fd
twice
2016-11-04 03:28:42 +03:00
Thomas Bernard
e983712456 use ev_uint16_t instead of unsigned short for port
Like in `sockaddr_in` structure in /usr/include/netinet/in.h

@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
2016-10-26 01:41:13 +03:00
Kurt Roeckx
3e9e0a0d46 Make it build using OpenSSL 1.1.0
Rebased (azat):
- tabs instead of whitespaces
- make openssl-compat.h safe for complex expressions
- do not call sk_SSL_COMP_free() in 1.1 (fixes double free)

TODO:
- clean methods_bufferevent

Closes: #397 (cherry-picked)
2016-10-16 19:05:24 +03:00
Adam Langley
f9803a6943 Switch from a 512 to 2048-bit RSA key.
The 512 bit key is too small to sign larger hashes. This can cause the
regression tests to fail depending on the defaults in libssl.
2016-10-13 16:12:07 -07:00
Azat Khuzhin
43eb56c7c7 tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris
According to solaris docs:
  "One instance of a SIGCHLD signal is queued for each child process whose
  status has changed. If waitpid() returns because the status of a child
  process is available, and WNOWAIT was not specified in options, any pending
  SIGCHLD signal associated with the process ID of that child process is
  discarded. Any other pending SIGCHLD signals remain pending."

And interesting thing that it works if you add sleep(1) before waitpid(), and
also if you run with --verbose (some race or what).

But linux doesn't support WNOWAIT in waitpid() so add detection into
cmake/autotools.

Fixes: #387
Link: https://bugzilla.redhat.com/show_bug.cgi?id=840782
2016-08-11 17:08:35 +03:00
Azat Khuzhin
16d220cb6f test: replace sleeping with syncing pair in main/fork
About this syncing pair:
- read endpoint, must be blocked, to make it a checkpoint or smth like this
- write endpoint, must be nonblocking, to avoid readcb hung

Refs: #387
2016-08-11 16:18:12 +03:00
Azat Khuzhin
500b6b7577 test/http: do not run tests that based on backlog filling (freebsd)
I cannot find any other solution for now, so simply ignore them for now, we
should think about normal fix for this.

Refs: #388
2016-08-11 00:11:05 +03:00
Azat Khuzhin
4410e9dfb3 test/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb" 2016-08-10 12:07:58 +03:00
Azat Khuzhin
a9e8cd6738 test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
Fixes: ssl/bufferevent_connect_sleep
2016-08-09 15:47:58 +03:00
Azat Khuzhin
d5a2f2f97f test/https_basic: increase timeout for complete write (fixes win32)
Otherwise on win32 we got 2, but test is ok, some timings issue.

Introduced-in: c968eb3
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
2016-08-09 15:47:58 +03:00
Azat Khuzhin
a487706e10 test: fix building with --disable-thread-support under win32 2016-08-09 15:47:58 +03:00
Azat Khuzhin
bb09535bda autoconf: fix --disable-thread-support build under win32
Fixes: https://ci.appveyor.com/project/azat/libevent/build/job/gvud4tcqsd5bnarl
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/5frnb1c3n4quxxqy
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/3wdahbrew7setmoa
2016-08-09 15:47:58 +03:00
Azat Khuzhin
48dab7aa33 test/buffer: cover evbuffer_expand() for overflow
Refs: #306
Refs: #340
2016-06-26 01:59:42 +03:00
Azat Khuzhin
a69e4fadca buffer: Merge branch 'evbuffer-empty-chains-fixes-v4'
This fixes bug with empty-chains and
evbuffer_add_buffer()/evbuffer_remove_buffer().

* evbuffer-empty-chains-fixes-v4:
  buffer: evbuffer_add_buffer(): clean empty chains from destination buffer
  test/buffer: evbuffer_add_buffer() with empty chains
  test/buffer: evbuffer_remove_buffer() with empty chains (prepend)
  test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer())

Reported-by: Eduardo Panisset <eduardo@anchorfree.com>
2016-06-19 13:24:18 +03:00
Eduardo Panisset
766194b35d test/be_filter: creating test case for data stuck with active watermarks
v2: fix whitespaces
    s/int/size_t/
    use tt_int_op()
    s/malloc/calloc (to avoid possible false-positive)
2016-06-19 13:19:01 +03:00
David Paschich
285188963d Fix bufferevent_pair to properly set BEV_EVENT_{READING,WRITING} on flush.
Here's some fun. From `bufferevent.h`:
  ```
  #define BEV_EVENT_READING	0x01	/**< error encountered while reading */
  #define BEV_EVENT_WRITING	0x02	/**< error encountered while writing */
  ```

And from `event.h`:
  ```
  /** Wait for a socket or FD to become readable */
  #define EV_READ		0x02
  /** Wait for a socket or FD to become writeable */
  #define EV_WRITE	0x04
  ```

Library users have to be very careful to get this right; it turns out, the
library itself got this wrong in the `bufferevent_pair` code. It appears that
in most of the code, only `BEV_EVENT_FINISHED` will indicate whether it's read
or write; on error or timeout, it appears that "both" is assumed and not set in
the callback. I read through all the other places where `BEV_EVENT_FINISHED` is
passed to an event callback; it appears that the pair code is the only spot
that got it wrong.

azat: add TT_FORK to avoid breaking clean env, and rebase commit message
(copied from #359)
Fixes: #359
2016-06-17 18:21:45 +03:00
Azat Khuzhin
a272bc4227 test/buffer: evbuffer_add_buffer() with empty chains
Reported-by: @EMPanisset
Link: https://github.com/libevent/libevent/issues/358#issuecomment-225345697
2016-06-17 17:40:40 +03:00
Azat Khuzhin
f0cfa146d5 test/buffer: evbuffer_remove_buffer() with empty chains (prepend)
Using:
- evbuffer_add()
- evbuffer_prepend_buffer()
- evbuffer_add_reference()
- evbuffer_remove_buffer()
2016-06-17 17:20:35 +03:00