summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix util/mm_calloc_enomem under FreeBSDAzat Khuzhin2023-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It looks like the compiler optimizes this call out with tt_assert(): (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bb0 <+0>: push %rbp 0x0000000000293bb1 <+1>: mov %rsp,%rbp 0x0000000000293bb4 <+4>: call 0x29f510 <__error@plt> 0x0000000000293bb9 <+9>: movl $0x0,(%rax) 0x0000000000293bbf <+15>: call 0x2990e0 <tinytest_set_test_failed_> 0x0000000000293bc4 <+20>: mov $0x2168e4,%edi 0x0000000000293bc9 <+25>: mov $0x220582,%esi 0x0000000000293bce <+30>: mov $0x20d893,%edx 0x0000000000293bd3 <+35>: mov $0x53a,%ecx 0x0000000000293bd8 <+40>: xor %eax,%eax 0x0000000000293bda <+42>: call 0x29f3b0 <printf@plt> 0x0000000000293bdf <+47>: mov $0x20da72,%edi 0x0000000000293be4 <+52>: mov $0x20f731,%esi 0x0000000000293be9 <+57>: xor %eax,%eax 0x0000000000293beb <+59>: pop %rbp 0x0000000000293bec <+60>: jmp 0x29f3b0 <printf@plt> While with tt_ptr_op() it does not: (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bd0 <+0>: push %rbp 0x0000000000293bd1 <+1>: mov %rsp,%rbp 0x0000000000293bd4 <+4>: push %rbx 0x0000000000293bd5 <+5>: push %rax 0x0000000000293bd6 <+6>: call 0x29f610 <__error@plt> 0x0000000000293bdb <+11>: movl $0x0,(%rax) 0x0000000000293be1 <+17>: mov $0xffffffffffffffff,%rdi 0x0000000000293be8 <+24>: mov $0xffffffffffffffff,%rsi 0x0000000000293bef <+31>: call 0x2a01c0 <calloc@plt> 0x0000000000293bf4 <+36>: test %rax,%rax 0x0000000000293bf7 <+39>: je 0x293c2b <test_event_calloc_enomem+91>
* test: add missing include of arpa/inet.h for ntohs in regress_ws.cAzat Khuzhin2023-05-141-0/+3
| | | | This will fix one warning in FreeBSD
* Suppress -Wmacro-redefined for htonll/ntohll in OSXAzat Khuzhin2023-05-141-0/+2
| | | | | | | | | | | | | | | | | OSX: test/regress_ws.c:61:9: warning: 'htonll' macro redefined [-Wmacro-redefined] #define htonll(x) \ ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_endian.h:141:9: note: previous definition is here #define htonll(x) __DARWIN_OSSwapInt64(x) ^ test/regress_ws.c:65:9: warning: 'ntohll' macro redefined [-Wmacro-redefined] #define ntohll(x) htonll(x) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_endian.h:140:9: note: previous definition is here #define ntohll(x) __DARWIN_OSSwapInt64(x) ^
* Fix -Wtautological-constant-out-of-range-compare in regress_http under OSXAzat Khuzhin2023-05-141-1/+2
| | | | | | | | compiler warning: test/regress_http.c:968:38: warning: result of comparison of constant 65536 with expression of type 'enum evhttp_cmd_type' is always true [-Wtautological-constant-out-of-range-compare] if (evhttp_request_get_command(req) != EVHTTP_REQ_CUSTOM) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
* Fix building with -Wstack-protector due to VLA and fobid themAzat Khuzhin2023-04-041-11/+6
| | | | | | | | It is not a thankless task to fix such issues on and on, let's just prohibit this cases, and our build with -Werror on CI will show new issues from now on. Fixes: #1434
* test: fix potential null dereference in https_bind_ssl_bevcb (#1428)Zhipeng Xue2023-03-041-0/+4
| | | Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* test: enable allocator_may_return_null=1 for calloc with ENOMEM testAzat Khuzhin2023-02-121-5/+14
|
* test: handle -v as --verbose for regressAzat Khuzhin2023-02-121-2/+2
|
* test: add del_wait/del_notify tests for windowsAzat Khuzhin2023-02-121-92/+93
| | | | Test manually, since CI is too slow
* test: fix leaks in bufferevent_pair_release_lock (#1413)Azat Khuzhin2023-02-121-26/+2
|
* test: fix debug locks in case new lock gots old addressAzat Khuzhin2023-02-121-1/+9
| | | | Refs: #1407
* test: suppress logs from the tests that produce them under normal circumstancesAzat Khuzhin2023-02-121-2/+2
|
* test: fix TT_* flags valuesAzat Khuzhin2023-02-121-2/+2
|
* Fixes some new warnings under clang-15Azat Khuzhin2023-01-271-5/+0
| | | | | | | | | | | | | | | | | | - -Wdeprecated-non-prototype /src/le/libevent/strlcpy.c:48:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] event_strlcpy_(dst, src, siz) - -Wstrict-prototypes /src/le/libevent/evthread.c:82:70: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] struct evthread_condition_callbacks *evthread_get_condition_callbacks() - -Wunused-but-set-variable /src/le/libevent/test/regress_buffer.c:130:6: warning: variable 'n' set but not used [-Wunused-but-set-variable] int n = 0; ^
* Allow evdns_base_new to succeed with no nameservers configuredDaniel Kempenich2023-01-272-2/+40
| | | | | | If resolv.conf has no nameservers, evdns_base_new can still succeed with the default of using the name server from localhost matching the man page documentation for resolv.conf.
* Replace magic numbers with consts for evdns_base_resolv_conf_parse() errorsDaniel Kempenich2023-01-271-2/+4
|
* signal: new signal handling backend based on signalfdDmitry Antipov2022-11-121-1/+11
| | | | | | | | Linux-specific signal handling backend based on signalfd(2) system call, and public function event_base_get_signal_method() to obtain an underlying kernel signal handling mechanism. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* ws: fix compile error on centos 7 - very old compiler (#1359)Leon George2022-10-231-2/+4
| | | | | | | | | | | | | | * http: fix typo * ws: fix comile error On CentOS: CC ws.lo ws.c: In function 'get_ws_frame': ws.c:244:3: error: 'for' loop initial declarations are only allowed in C99 mode for (int i = 0; i < payload_len; i++) { ^ ws.c:244:3: note: use option -std=c99 or -std=gnu99 to compile your code
* Add locks for server WS, fixes #1357Dmitry Ilyin2022-10-121-1/+1
|
* Fix memleak in regress testsDmitry Ilyin2022-10-041-6/+6
|
* Add helpers and all regress tests are passedDmitry Ilyin2022-10-043-20/+3
|
* Fix socketpair failure when temporary directory has non-latin characterzhenhaonong2022-09-262-6/+28
|
* Add minimal WebSocket server implementation for evhttp (#1322)Dmitry Ilyin2022-09-125-4/+400
| | | | | | | | | | | | | | This adds few functions to use evhttp-based webserver to handle incoming WebSockets connections. We've tried to use both libevent and libwebsockets in our application, but found that we need to have different ports at the same time to handle standard HTTP and WebSockets traffic. This change can help to stick only with libevent library. Implementation was inspired by modified Libevent source code in ipush project [1]. [1]: https://github.com/sqfasd/ipush/tree/master/deps/libevent-2.0.21-stable Also, WebSocket-based chat server was added as a sample.
* test: fix util/getaddrinfo for netbsd (v2)Azat Khuzhin2022-08-141-3/+3
| | | | | Fixes: c198b0ce ("test: fix util/getaddrinfo for netbsd") Fixes: #1316
* Merge pull request #1315 from yogo1212/http_per_socket_bebcbAzat Khuzhin2022-08-142-0/+98
|\ | | | | | | | | | | In it's current form, libevent requires multiple struct evhttp objects to be created in order to enable listening on sockets with more than one type of encryption. This change allows specifying per-socket how the associated bufferevents should be created. Thus, it becomes possible to have multiple listening sockets with different encryption parameters using only one evttp.
| * http: allow setting bevcb per socketLeon M. George2022-08-131-0/+93
| | | | | | | | | | Co-authored-by: Azat Khuzhin <azat@libevent.org> v2: remove handling of HTTP_BIND_IPV6
| * test: allow to run init_ssl() multiple timesAzat Khuzhin2022-08-131-0/+5
| |
* | test: fix util/getaddrinfo for netbsdAzat Khuzhin2022-08-131-1/+2
|/ | | | Fixes: #1316
* test: add a comment for init_ssl() about suppressions for LSanAzat Khuzhin2022-08-131-0/+1
|
* test: fix unused variable in rand test (catched by newer clang)Azat Khuzhin2022-07-121-4/+1
|
* test: increase timeout significantly in dns/getaddrinfo_cancel_stress (for TSan)Azat Khuzhin2022-07-111-1/+9
| | | | Fixes: #1304
* evdns: accept domains up to 254 long (previosly only 63 long was accepted)Azat Khuzhin2022-07-101-1/+34
| | | | | | | | | | | | | | | | | Previously evdns was using HOST_NAME_MAX, and define it to 255 *only* if it not set, however it does set on linux: $ egrep -r define.*HOST_NAME_MAX /usr/include/bits /usr/include/bits/local_lim.h:#define HOST_NAME_MAX 64 /usr/include/bits/posix1_lim.h:#define _POSIX_HOST_NAME_MAX 255 /usr/include/bits/confname.h:#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX But 64 should be the limit of the host component, not for the whole hostname, as also noted by @ploxiln So use our own EVDNS_NAME_MAX const, which is set to 255. Fixes: #1280
* test: make dns/getaddrinfo_cancel_stress more deterministicAzat Khuzhin2022-07-101-3/+4
| | | | | Fixes: #1271 Follow-up for: 90bcf2d660b9b43cb8e747421d4938f08f935bd7
* test: suppress warning for already defined SSL_get_peer_certificateAzat Khuzhin2022-07-101-0/+2
| | | | | | | | | | | | | | | | | build report: [1/2] Building C object CMakeFiles/regress.dir/test/regress_mbedtls.c.o /src/le/libevent/test/regress_mbedtls.c:50: warning: "SSL_get_peer_certificate" redefined 50 | #define SSL_get_peer_certificate mbedtls_ssl_get_peer_cert | In file included from /src/le/libevent/test/regress.h:139, from /src/le/libevent/test/regress_mbedtls.c:35: /src/oss/openssl/include/openssl/ssl.h:1799: note: this is the location of the previous definition 1799 | # define SSL_get_peer_certificate SSL_get1_peer_certificate | [2/2] Linking C executable bin/regress But this should be cleaned up.
* Use OPENSSL_VERSION_NUMBER over OPENSSL_VERSION_MAJOR (for compatibility)Azat Khuzhin2022-07-101-1/+1
| | | | | | | | Since OpenSSL 3.0 there is new OPENSSL_VERSION_MAJOR, but previous releases does not have it. So let's use plain old OPENSSL_VERSION_NUMBER to avoid more preprocessor macros.
* Initial OpenSSL 3.0 supportWilliam Marlow2022-07-092-0/+10
| | | | | | | * Don't use deprecated functions when building against OpenSSL 3.0. * Recognise that OpenSSL 3.0 can signal a dirty shutdown as a protocol. error in addition to the expected IO error produced by OpenSSL 1.1.1 * Update regress_mbedtls.c for compatibility with OpenSSL 3
* Initial Mbed-TLS 3 support to get the GitHub Actions working againWilliam Marlow2022-07-091-2/+25
| | | | | | | | mingw has upgraded to Mbed-TLS 3.1.0, so all the mingw tests that need Mbed-TLS currently don't work. v2: add missing mbedtls/version.h into test/regress_mbedtls.c v3: suppress #warning "Including compat-2.x.h is deprecated" for mbedtls/compat-2.x.h
* test: ignore -Walloc-size-larger-than error for calloc() returns ENOMEMAzat Khuzhin2022-07-091-1/+10
| | | | | | | | | | | | | | Compiler report: /home/runner/work/libevent/libevent/test/regress_util.c: In function ‘test_event_calloc’: /home/runner/work/libevent/libevent/test/regress_util.c:1318:4: error: argument 2 value ‘9223372036854775815’ exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] p = mm_calloc(EV_SIZE_MAX/2, EV_SIZE_MAX/2 + 8); In file included from /home/runner/work/libevent/libevent/test/../util-internal.h:37:0, from /home/runner/work/libevent/libevent/test/regress_util.c:30: /usr/include/stdlib.h:541:14: note: in a call to allocation function ‘calloc’ declared here extern void *calloc (size_t __nmemb, size_t __size) v2: clang on CI does not have this option
* OpenSSL 3 fixes: Disable TLS 1.3 when testing renegotiation supportPeter Edwards2022-06-272-1/+22
| | | | | | TLS 1.3 does not support renegotation - it has been removed from the protocol. Disable TLS 1.3 when testing this, so we negotiate an older protocol version
* OpenSSL 3 fixes: use SHA256 instead of SHA1Peter Edwards2022-06-271-1/+1
| | | | | OpenSSL 3.x does not support signing certificates with SHA1 by default. Use SHA256 instead.
* regress_ssl: Use intptr_t when shoving an int into a void *Jessica Clarke2021-12-211-2/+2
| | | | | | | | | | | | | | | | Currently the code uses long, but long does not always have the same representation as a pointer, such as on 64-bit Windows where long is only 32-bit due to its unususal LLP64 ABI, but also on CHERI, and thus Arm's prototype Morello architecture, where C language pointers are represented as hardware capabilities, which have bounds, permissions and other metadata to enforce spatial memory safety. Both of these cases warn when casting a long to a pointer (Windows due to long being shorter and thus it being likely you've truncated the address, and CHERI due to long not having any capability metadata like pointers and thus it being likely you've stripped the metadata, with the resulting "null-derived" capability destined to trap if dereferenced), and in both cases casting to intptr_t as the intermediate type instead will get rid of those warnings.
* test: fix leak in http/cancel_*server_timeout testsAzat Khuzhin2021-12-211-7/+17
| | | | Fixes: #1242
* feat: add `evdns_base_get_nameserver_fd` methodYongsheng Xu2021-12-101-0/+3
| | | | To get underlying udp socket fd.
* Fix deadlock in case of evconnlistener_disable() in parallel with callbackmoonlightsh2021-12-071-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've got an issue when stop evconnlistener not in the event_base_loop() thread. evconnlistener_disable() acquired lev->lock, if the same time, user callbacks is runing, the event thread released lock, after callback finished, it try to aquire the lock again, I think this makes conflict: Here is backtraces: thread 1: 0 __lll_lock_wait (futex=futex@entry=0x555555559a60, private=0) at lowlevellock.c:52 1 0x00007ffff7f2a131 in __GI___pthread_mutex_lock (mutex=0x555555559a60) at ../nptl/pthread_mutex_lock.c:115 2 0x00007ffff7f424c9 in evthread_posix_lock (mode=0, lock_=0x555555559a60) at evthread_pthread.c:79 3 0x00007ffff7f7dc12 in listener_read_cb (fd=7, what=2, p=0x5555555599a0) at listener.c:439 4 0x00007ffff7f6d758 in event_persist_closure (base=0x555555559370, ev=0x5555555599d8) at event.c:1645 5 0x00007ffff7f6da60 in event_process_active_single_queue (base=0x555555559370, activeq=0x5555555597e0, max_to_process=2147483647, endtime=0x0) at event.c:1704 6 0x00007ffff7f6e018 in event_process_active (base=0x555555559370) at event.c:1805 7 0x00007ffff7f6e92a in event_base_loop (base=0x555555559370, flags=0) at event.c:2047 8 0x0000555555555449 in main () at test_listen.c:67 thread 2: 0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555555559858) at ../sysdeps/nptl/futex-internal.h:183 1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555555559800, cond=0x555555559830) at pthread_cond_wait.c:508 2 __pthread_cond_wait (cond=0x555555559830, mutex=0x555555559800) at pthread_cond_wait.c:638 3 0x00007ffff7f426f3 in evthread_posix_cond_wait (cond_=0x555555559830, lock_=0x555555559800, tv=0x0) at evthread_pthread.c:162 4 0x00007ffff7f70bc5 in event_del_nolock_ (ev=0x5555555599d8, blocking=2) at event.c:2934 5 0x00007ffff7f70748 in event_del_ (ev=0x5555555599d8, blocking=2) at event.c:2821 6 0x00007ffff7f707a1 in event_del (ev=0x5555555599d8) at event.c:2830 7 0x00007ffff7f7d76e in event_listener_disable (lev=0x5555555599a0) at listener.c:343 8 0x00007ffff7f7d6e5 in evconnlistener_disable (lev=0x5555555599a0) at listener.c:325 9 0x00005555555552c3 in disable_thread (arg=0x5555555599a0) at test_listen.c:27 10 0x00007ffff7f27609 in start_thread (arg=<optimized out>) at pthread_create.c:477 11 0x00007ffff7e4e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
* build: remove inconsistently used x-prefix comparisonsfanquake2021-11-241-1/+1
| | | | | | | | | | | Given that these are already used inconsistently with `test` checks, it makes sense to consolidate to not use the x-prefix comparisons at all. In any case, it would be nice to think we no longer have to work around a problem that existed in shells many, many years ago. More info: https://github.com/koalaman/shellcheck/wiki/SC2268 https://www.vidarholen.net/contents/blog/?p=1035
* evutil: Fix evutil_freeaddrinfoTomas Gonzalez2021-11-041-0/+9
| | | | | | | | | | | | | | | During testing on win32, util/getaddrinfo failed with NULL hint info r = evutil_getaddrinfo("www.google.com", NULL, NULL, &ai); throwing a critical heap exception when evutil_freeaddrinfo is called. This is because of improper use of freeaddrinfo when nodes within the ai structure are allocated using mm_malloc or mm_calloc (EVUTIL_AI_LIBEVENT_ALLOCATED) This adds the flag in apply_socktype_protocol_hack and walks the linked list in evutil_freeaddrinfo removing linked list nodes that are custom allocated before calling freeaddrinfo.
* test: retriable tests are marked failed only when all attempts have failedThomas Perrot2021-10-022-8/+7
| | | | Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
* test: add --retries-delay (and set to 1 second by default)Azat Khuzhin2021-09-191-2/+23
| | | | | | In attemp to address failures of dns/tcp_* tests under windows [1]. [1]: https://github.com/azat/libevent/runs/3644218468?check_suite_focus=true
* test: add --retries argumentAzat Khuzhin2021-09-191-4/+12
|
* test/regress_http: mark data_length_constraints as retriableAzat Khuzhin2021-09-191-1/+1
| | | | CI: https://github.com/libevent/libevent/runs/3643914024?check_suite_focus=true