Commit Graph

17 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
panran
a4ba1bd73e
test: fix some warnings when compiling tests (#3816)
```
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
note: in expansion of macro 'ASSERT_BASE'
#define ASSERT_EQ(a, b) ASSERT_BASE(a, ==, b, int64_t, PRId64)

warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 3 has type ‘uint32_t’ {aka ‘unsigned int’}
```

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2023-01-19 10:48:13 -06:00
Jameson Nash
bd7fcf1bfc
run test named ip6_sin6_len
This appears to have been missed in the original PR.

Refs: https://github.com/libuv/libuv/pull/2492
Refs: https://github.com/libuv/libuv/issues/2655 (fixes one issue listed)
PR-URL: https://github.com/libuv/libuv/pull/3246
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-07-21 12:39:13 -04:00
Ouyang Yadong
645be48a80 unix: set sin_len and sin6_len
FreeBSD defines `sin_len` and `sin6_len` inside `sockaddr_in` and
`sockaddr_in6`. `sockaddr`s come from `getsockname` and `uv_ip4_addr`
will differ in the first byte if libuv doesn't set `sin_len` correctly.

PR-URL: https://github.com/libuv/libuv/pull/2492
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
2019-10-04 23:58:18 +02:00
Jameson Nash
c5593b51dc warnings: fix code that emits compiler warnings
PR-URL: https://github.com/libuv/libuv/pull/2066
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2018-11-29 11:21:44 -05:00
Pekka Nikander
695afe8322
unix,win: add uv_if_{indextoname,indextoiid}
uv_if_indextoname() is used to convert an IPv6 scope_id
to an interface identifier string such as %eth0 or %lo.

uv_if_indextoiid() returns an IPv6 interface identifier.
On Unix it calls uv_if_indextoname(). On Windows it uses
snprintf() to return the numeric interface identifier as
a string.

Refs: https://github.com/nodejs/node/pull/14500
PR-URL: https://github.com/libuv/libuv/pull/1445
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-06 09:54:47 -05:00
Brad King
6398251aff cygwin: implement support for cygwin and msys2
Cygwin and MSYS2 are POSIX layers implemented on top of Windows.
Use our POSIX `poll(2)` implementation of our poll abstraction.
For most other components we already have dedicated sources
implementing them in terms of APIs available on Cygwin or
providing non-implementations of components not supported.

This leaves only three components that need Cygwin-specific
implementations:

* uv_uptime: implement using sysinfo
* uv_resident_set_memory: add a placeholder returning UV_ENOSYS
* uv_cpu_info: add a placeholder returning UV_ENOSYS

Update our test suite to account for features not available
due to Cygwin platform limitations or our placeholders.

PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-05-21 16:12:21 +02:00
Saúl Ibarra Corretgé
cdc10a907a test: remove LOG and LOGF variadic macros
Initial patch by @simar7, thanks!

PR-URL: https://github.com/libuv/libuv/pull/313
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-12 18:44:34 +02:00
Saúl Ibarra Corretgé
4fac9427e4 unix, windows: fix parsing scoped IPv6 addresses
Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-05-25 23:30:46 +02:00
Saúl Ibarra Corretgé
fa0e1e5071 unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
Fedor Indutny
2b21419242 inet: allow scopeid in uv_inet_pton
We already support it in `uv_ip6_addr` anyway.

See https://github.com/joyent/node/issues/7395
2014-04-14 15:47:50 +04: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
dfce87c94f test: simplify test-ip6-addr.c
Drop the callback-driven approach in favor of a simple loop. Reduces
the line count and makes the flow of execution a little easier to
follow.
2013-08-19 22:37:48 +02:00
Ben Noordhuis
96f32a206b test: replace sprintf() with snprintf()
There is zero risk of overflowing the buffer, it's just a good habit.
2013-08-05 01:16:34 +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
Miroslav Bajtoš
fd45f876ff linux,darwin,win: link-local IPv6 addresses
Modified uv_ip6_addr() to fill sin6_scope_id for link-local addresses.

Fixes #271

Conflicts:
	build.mk
2013-07-04 15:43:20 +02:00