3672 Commits

Author SHA1 Message Date
Azat Khuzhin
671a24f29b autotools/win32: fix searching ssl library 2016-08-09 15:47:58 +03:00
Azat Khuzhin
6fcfa25d82 appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
This never works, hence green tests in production. and now it works:
https://ci.appveyor.com/project/azat/libevent/build/2.1.5.100/job/eib4xqfb7d3ruo16
(look by /"evthread_win32.c")
2016-08-09 15:47:58 +03:00
Azat Khuzhin
4634b85bf2 appveyor: image already had openssl installed
Fixes messages like "Version mismatch for openssl: compiled with 1000201f but
running with 1000208f" [1].

According to next link:
  http://help.appveyor.com/discussions/questions/1132-openssl-installation-issues
Refs: appveyor/ci#576
[1]: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.95/job/dcy9cfoj3rfo4gdh
2016-08-09 15:47:58 +03:00
Azat Khuzhin
de0c1965ca cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON 2016-08-09 15:47:58 +03:00
Azat Khuzhin
ecb0ec821a cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
There is duplicated "evthread_win32.c" appending to ${SRC_CORE} list, leave
only one that under if EVENT__DISABLE_THREAD_SUPPORT

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.96/job/44q3rgifasny7gek
2016-08-09 15:47:58 +03:00
Azat Khuzhin
e9acc441b7 appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
Link: https://github.com/libevent/libevent/wiki/ReleaseChecklist
2016-08-09 15:47:58 +03:00
Azat Khuzhin
e35f22416a cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
Fixes: 8b228e27f57300be61b57a41a2ec8666b726dc34 ("Lot's of cmake updates")
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
38716c653d cmake: do not use stderr for notifications/version-info
For all except "STATUS" message() will write to stderr, and this also includes
case when you does not have <mode> at all. Plus for every message in stderr
powershell generates exception and make appveyor fails.

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.85/job/i10k7m0t80330mtr
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
1810857425 appveyor: ignore failure of mingw-get
Since according to doc [1], appveyour will fail the build on every powershell's
exception:
  "PowerShell script is considered successful if it finishes without exception."

[1]: https://www.appveyor.com/docs/build-configuration#powershell
2016-08-09 15:47:58 +03:00
Azat Khuzhin
ac90133c16 appveyor: drop shallow_clone, since we use tags for detecting version in cmake 2016-08-09 15:47:58 +03:00
Azat Khuzhin
8f95015543 appveyor: support cmake & autotools using build matrix (like travis-ci has)
This will allow us to avoid possible compilation regressions, and also some
failures in different environments (for example because of different
sizeof(size_t)).

For example we can avoid next issues:
- #361
- #314
- #311
(And I'm pretty sure that this is not complete list)

And of course it reduce job for maintainers.
But it also have one downside, appveyor doesn't have such concurrency like
travis-ci, so it can take a while to finish the whole build, but we can resolve
this later, or reduce build matrix to only one for autotools and one for cmake.

Fixes: #364
2016-08-09 15:47:57 +03:00
Azat Khuzhin
8a2c6c7759 Ignore make dist generated files 2016-08-09 15:47:47 +03:00
Mark Mentovai
df6f99e5b5 Check for Mac OS X 10.4 kqueue bug properly
EV_ERROR is a bit in struct kevent::flags. Other bits may be set too.

Actually we have osx builds on travis-ci, but it uses osx 10.9.5, and we don't
have warnings there, since I guess that there is no OR'ing with previous flag
in case of error, while in 10.12 there is OR.

Fixes: #377
Fixes: #376
Link: https://crbug.com/626534
Link: https://travis-ci.org/libevent/libevent/jobs/141033429
2016-07-12 20:06:52 +03:00
Azat Khuzhin
8892f4cbef buffer: don't mix code and declarations 2016-07-07 13:15:41 +03:00
basavesh.as
666db91af0 Fix memory leak in signal-test.c 2016-06-29 15:11:50 +05:30
Mark Ellzey
303161777d
[#372] check for errno.h 2016-06-28 10:37:24 -07:00
Mark Ellzey
e7abef1c4c Merge pull request #367 from neerajbadlani/master
Update gitignore file to ignore cscope gen'ed files
2016-06-26 11:15:58 -07:00
Azat Khuzhin
70040c0989 buffer: Merge branch '340-dig-v2'
All details in this two patches (it's titles), and shortlog is below.

* 340-dig-v2:
  buffer: fix overflow check in evbuffer_expand_singlechain()
  test/buffer: cover evbuffer_expand() for overflow
2016-06-26 01:59:43 +03:00
Azat Khuzhin
a3f4ccd1a1 buffer: fix overflow check in evbuffer_expand_singlechain()
Refs: #306
Fixes: #340
Fixes: 20d6d4458bee5d88bda1511c225c25b2d3198d6c
2016-06-26 01:59:42 +03:00
Azat Khuzhin
48dab7aa33 test/buffer: cover evbuffer_expand() for overflow
Refs: #306
Refs: #340
2016-06-26 01:59:42 +03:00
Mark Ellzey
17cc636223
[Issue #313] set method to ASCII "NULL" if evhttp_method() returns NULL 2016-06-24 18:07:39 -07:00
Neeraj Badlani
0aaa4fbec2 Update gitignore file to ignore cscope gen'ed files 2016-06-22 21:15:53 -07: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
Azat Khuzhin
9b294082fb bufferevent_filter: Merge branch 'be-filter-data-stuck'
Fixes data stuck in filters with active watermarks.

* be-filter-data-stuck:
  test/be_filter: creating test case for data stuck with active watermarks
  be_filter: avoid data stuck under active watermarks
2016-06-19 13:21:15 +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
Eduardo Panisset
b627ad88bf be_filter: avoid data stuck under active watermarks
Suppose we have bufferevent filter attached to bufferevent socket.
Read high watermark for bufferevent filter is configured to 4096 bytes.
Socket receives 4343 bytes. Due to watermark, 4096 bytes are transferred
from socket input buffer to filter input buffer and 247 bytes are left
in bufferevent socket.
Suppose that no more data is received through socket.

At this point 247 bytes will sit forever in input buffer of bufferevent
socket.
The patch attached solves this issue registering read callback to
filter's input buffer if it reaches its read high water mark and data
was left in corresponding underlying's input buffer.

This read callback calls filter process input function as soon as filter
input buffer falls below its read high watermark and there still is data
left in underlying input buffer. Callback is deregistered as soon as
filter input buffer falls below its read high watermark.
2016-06-19 13:04:19 +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
26fd9321cf buffer: evbuffer_add_buffer(): clean empty chains from destination buffer
@EMPanisset reported a problem (#358) with evbuffer_remove_buffer(), but
actually I think that the problem is in evbuffer_add_buffer() which introduces
this empty chain, all other callers (except evbuffer_prepend_buffer(), but it
doesn't have this problem though) should be safe.

And FWIW the only API that allows empty chains is evbuffer_add_reference(), and
we can add check there to avoid such issues, but for now I leaved this without
fixing, since I think that evbuffer_add_reference() with empty chains can be
used as a barrier (but this can be tricky).

Fixes: regress evbuffer/remove_buffer_with_empty2
v2: introduce/fixes evbuffer/add_buffer_with_empty
2016-06-17 17:41:03 +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
Azat Khuzhin
2880ce6a03 test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer())
Using:
- evbuffer_add()
- evbuffer_add_buffer() -- the one that has problem
- evbuffer_add_reference() -- the only one that allows empty chains to be added
- evbuffer_remove_buffer()
2016-06-17 17:20:35 +03:00
Azat Khuzhin
2a4bf29470 test/http: avoid using conditionals with omitted operands (fixes VS2015)
But we need to add VS2015 build on appveyor.

Fixes: #361
Reported-by: @nntrab
2016-06-17 17:04:37 +03:00
Azat Khuzhin
aabf1c2dd1 test/http: don't mix declarations and code (fixes -Wdeclaration-after-statement) 2016-06-17 16:07:15 +03:00
Azat Khuzhin
c08d90ba5a test/buffer: fix leak in test_evbuffer_prepend() 2016-06-17 16:06:12 +03:00
Azat Khuzhin
e7d1e3926b test/buffer: avoid errors with --no-fork (reinitialize static vars) 2016-06-17 15:44:13 +03:00
Rainer Keller
b5ca365626 For non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid
Closes: nmathewson/Libevent#129
2016-06-08 14:31:29 +03:00
Azat Khuzhin
41e54464b9 Merge branch 'travis-ci-os-matrix-v2'
This increases libevent coverage to:
- os:osx

- cmake -DEVENT__DISABLE_MM_REPLACEMENT=ON
- cmake -DEVENT__ENABLE_VERBOSE_DEBUG=ON
- configure --disable-openssl
- configure --disable-thread-support
- configure --disable-malloc-replacement

- fix travis-ci builds under automake >1.11

Possible failures after this patch set (not always, IOW in some builds this
issues aren't real issues):
- some failures but mostly because of timing issues, must be fixed separately.
- https://travis-ci.org/azat/libevent/jobs/129430229 # on brew update
- https://travis-ci.org/azat/libevent/jobs/129430221 # some locking issues

* travis-ci-os-matrix-v2:
  automake: define serial-tests only if automake have this option
  test/automake: don't use paralell test harness (since automake 1.12)
  travis-ci/osx: relink gcc/g++ instead of clang
  travis-ci: enable multi-os mode (osx, linux)
  travis-ci: increase matrix (--disable-foo)
  travis-ci: adjust alignment

Fixes: #356
Travis-CI: https://travis-ci.org/azat/libevent/builds/129430181
2016-05-12 00:48:15 +03:00
Azat Khuzhin
61179dec77 automake: define serial-tests only if automake have this option
P.S. I did try a lot of other ways, but seems that this is the only one that
will work.

Fixes: automake 1.11
Travis-CI: https://travis-ci.org/azat/libevent/jobs/129398265
2016-05-11 16:47:46 +03:00
Azat Khuzhin
44d755e00e test/automake: don't use paralell test harness (since automake 1.12)
Starting from automake 1.2 there is parallel test harness, that redirects all
output to some log, which serial-test doesn't do.
So in case of new runner we can get no output for 10 minutes, for example on my
desktop:
  $ time make verify VERBOSE=1
  PASS: test/test-script.sh
  ============================================================================
  Testsuite summary for libevent 2.1.5-beta
  ============================================================================
  # TOTAL: 1
  # PASS:  1
  # SKIP:  0
  # XFAIL: 0
  # FAIL:  0
  # XPASS: 0
  # ERROR: 0
  ============================================================================

  real    25m31.735s
  user    0m13.753s
  sys     0m7.648s

And this means that this will fail on travis-ci, since it has timeout for 10
minutes. Sure we can use `travis wait 60` instead, but I think that it is
better to fix this by writing result to output, instead of hacking around, so
let's use serial-tests instead of parallel always.
And now it works on travis-ci under linux because it has automake 1.11 while
osx has at least 1.12.

Links:
https://docs.travis-ci.com/user/common-build-problems/
https://www.gnu.org/software/automake/manual/html_node/Serial-Test-Harness.html#Serial-Test-Harness
https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html

CI:
https://travis-ci.org/azat/libevent/jobs/129171497 # ok on linux
https://travis-ci.org/azat/libevent/jobs/129171532 # no output for 10 min on osx
2016-05-11 14:28:47 +03:00
Azat Khuzhin
481481d3f5 travis-ci/osx: relink gcc/g++ instead of clang
Since by default osx replaces /usr/bin/gcc with it's apple clang, while we have
gcc in our build matrix, so use real gcc.
2016-05-10 18:17:25 +03:00
Azat Khuzhin
79917e48ba travis-ci: enable multi-os mode (osx, linux)
- use addons.apt.packages instead of `apt-get install`
- add `brew update`/`brew install ...`

Link: https://docs.travis-ci.com/user/installing-dependencies/
Link: https://docs.travis-ci.com/user/multi-os/
2016-05-10 08:29:56 +03:00
Azat Khuzhin
59649f74c2 travis-ci: increase matrix (--disable-foo)
Use --disable-foo from
https://github.com/libevent/libevent/wiki/ReleaseChecklist
2016-05-09 23:30:56 +03:00
Azat Khuzhin
c8be33952e travis-ci: adjust alignment 2016-05-09 18:58:42 +03:00
Azat Khuzhin
38e0f4a5d6 be_openssl: clear all pending errors before SSL_*() calls
Refs: #350
Reported-by: @CapSel
2016-05-02 15:26:27 +03:00
Azat Khuzhin
ce38993333 Ignore all pkgconfig generated stuff
In the referenced commit new *.pc added, and I think it is better to ignore
them all.

Refs: b8d7c6211a965c19c7c5de414135ff13b5fa2476 ("libevent_core and
libevent_extra also deserve a pkgconfig file")
2016-04-21 02:16:21 +03:00
Azat Khuzhin
e77ff4187f test/buffer: cover n_add_for_cb when evbuffer_prepend() need to allocate buffer
Regression-for: 0abd0393eaf029e1ead8a09b479ea6830f7152ee ("Fix n_add_for_cb in
evbuffer_prepend() in case of new buffer required")
2016-04-21 02:15:08 +03:00
Azat Khuzhin
bd19a28ac4 test/tinytest_macros: add new one tt_nstr_op() 2016-04-21 02:15:08 +03:00
Azat Khuzhin
0abd0393ea Fix n_add_for_cb in evbuffer_prepend() in case of new buffer required
Signed-off-by: @luoming1224
Fixes: #349
2016-04-21 01:59:30 +03:00