Commit Graph

18 Commits

Author SHA1 Message Date
Pleuvens
011a1ac1a3
test: switch to new-style ASSERT_EQ macros (#4159)
Switch from old-style ASSERT macro to new-style ASSERT_EQ,... macros.

Using new-style macros makes it easier to debug test failures

Fixes: https://github.com/libuv/libuv/issues/2974
2023-10-06 19:50:15 +02:00
Trevor Norris
91a7e49846
test: silence more valgrind warnings (#3917)
Pass the loop to MAKE_VALGRIND_HAPPY() so it's explicit on which loop
needs to be cleaned up. Since it asserts on uv_loop_close(), need to
remove a couple of those that were being done before the call.

Cleanup where loop was assigned, so the entire test either uses loop or
uv_default_loop(). Not both.

Also take care of any reqs that may have been left uncleaned.
2023-03-12 14:59:00 +01:00
gengjiawen
1c976110d5
build: test on more platforms via QEMU in CI
This commit runs the test suite via QEMU on GitHub Actions on
a variety of platforms.

Fixes: https://github.com/libuv/libuv/issues/2842
PR-URL: https://github.com/libuv/libuv/pull/2846
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-05-17 10:03:20 -04:00
Ben Noordhuis
aa7b62efd9 win: make uv_udp_init_ex() accept UV_UDP_RECVMMSG
Commit 5736658b ("udp: add flag to enable recvmmsg(2) explicitly") added
the flag but didn't update the validation logic in src/win/udp.c.

This commit moves the validation logic to src/uv-common.c. The flag is
now accepted as a no-op on Windows.

Fixes: https://github.com/libuv/libuv/issues/2806
PR-URL: https://github.com/libuv/libuv/pull/2809
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-04-28 17:57:35 +02:00
cjihrig
0c28363059
win: allow setting udp socket options before bind
Unix allows socket options to be set prior to binding. This
commit aligns Windows with this behavior.

Refs: https://github.com/joyent/libuv/issues/1205
Refs: https://github.com/joyent/libuv/pull/1270
Fixes: https://github.com/libuv/libuv/issues/1842
PR-URL: https://github.com/libuv/libuv/pull/1861
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-06-04 09:19:06 -04:00
John Barboza
1cff5b7557 zos: add support for new platform
- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
    Will redefine backlog in the following way
    * if backlog == 0, set it to 1
    * if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP

PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-08-19 01:34:29 +02:00
Saúl Ibarra Corretgé
69678e27c8 test: skip udp_options6 if there no IPv6 support
PR-URL: https://github.com/libuv/libuv/pull/115
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-05 12:32:57 +01:00
Saúl Ibarra Corretgé
2daee9fbeb unix: fix ttl, multicast ttl and loop options on IPv6
Fixes #93

PR-URL: https://github.com/libuv/libuv/pull/99
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-02 17:34:13 +01:00
Saúl Ibarra Corretgé
386d2141e4 unix, windows: be consistent when binding implictly in UDP
Only these functions will trigger an implicit binding of a UDP handle:
- uv_udp_send
- uv_udp_recv_start
- uv_udp_set_membership

All other functions will return UV_EBADF in case the socket was not
bound.

Note: currently the socket is created and bound at the same time. This
may change in the future.
2014-05-08 15:12:09 +02:00
Ben Noordhuis
bcee403ed2 include: merge uv_udp_bind and uv_udp_bind6
Merge uv_udp_bind6() into uv_udp_bind().  uv_udp_bind() now takes a
const struct sockaddr*.
2013-09-04 03:17:04 +02:00
Ben Noordhuis
525dbb5e31 include: uv_udp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:18 +02:00
Ben Noordhuis
8184076879 include: uv_ip[46]_addr now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:07 +02:00
Ben Noordhuis
3ee4d3f183 unix, windows: return error codes directly
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

    if (uv_foo(loop) < 0) {
      uv_err_t err = uv_last_error(loop);
      fprintf(stderr, "%s\n", uv_strerror(err));
    }

Should be rewritten like this:

    int err = uv_foo(loop);
    if (err < 0)
      fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
2013-07-07 09:51:00 +02:00
Ben Noordhuis
4ba03ddd56 unix, windows: rename uv_run2 to uv_run
This changes the prototype of uv_run() from:

  int uv_run(uv_loop_t* loop);

To:

  int uv_run(uv_loop_t* loop, uv_run_mode mode);

Where `mode` is UV_RUN_DEFAULT, UV_RUN_ONCE or UV_RUN_NOWAIT.

Fixes #683.
2013-01-16 23:35:29 +01:00
Bert Belder
47eb03490a test: move loop cleanup code to the individual tests 2012-10-17 01:24:49 +02:00
Ben Noordhuis
9efa8b3571 unix, windows: rework reference counting scheme
This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.

While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.

That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:

 * timers: ticking
 * sockets: reading, writing or listening
 * processes: always active (for now, subject to change)
 * idle, check, prepare: only active when started

This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.

The Windows implementation was done by Bert Belder.
2012-05-17 07:07:53 +02:00
Ben Noordhuis
42d3533487 unix: fix udp_options test on OS X and Solaris
setsockopt(IP_TTL) will happily let you set a TTL > 255 on OS X, cap it.

-1 or 0 is a valid TTL on Linux but not portable, deny it.
2012-04-11 14:51:46 +00:00
Ben Noordhuis
cd16ba5186 test: add UDP broadcast/multicast/ttl tests 2012-01-31 16:52:27 +01:00