Commit Graph

54 Commits

Author SHA1 Message Date
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
Ben Noordhuis
143da93e2d test,unix: fix race in test runner
The test runner inserted a 250 ms delay to give helper processes time to
settle. That's intrinsically race-y and caused tests to intermittently
fail on platforms like AIX.

Instead of a fixed delay, pass a file descriptor to the helper process
and wait until it closes the descriptor. That way we know for sure the
process has started.

Incidentally, this change reduces the running time of the test suite
from 112 to 26 seconds on my machine.

Fixes: https://github.com/libuv/libuv/issues/2041
PR-URL: https://github.com/libuv/libuv/pull/2056
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-30 20:44:16 +01:00
Bert Belder
421d7571a3
test: add test for IPC deadlock on Windows (#1099)
PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 13:01:59 -07:00
John Barboza
c5dd2d4218
unix: keep track of bound sockets sent via spawn
We use the UV_HANDLE_BOUND flag to mark a socket as bound to a
port. We need to do this for sockets that are sent from another
process as well as sockets that created by the process itself.
First check if the port number is non-zero. If yes then mark
it as bound.

PR-URL: https://github.com/libuv/libuv/pull/1348
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-11-20 18:36:26 +01:00
Santiago Gimeno
404ee42706
unix,stream: return error on closed handle passing
Return `EBADF` when trying to send a handle which, while enqueued, was
closed.

Fixes: https://github.com/libuv/libuv/issues/806
PR-URL: https://github.com/libuv/libuv/pull/1352
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2017-06-23 09:38:15 +02:00
Santiago Gimeno
4a71e7747a test: improve spawn_setuid_setgid test
Check that the child process' uid and gid are correctly set.

PR-URL: https://github.com/libuv/libuv/pull/1024
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-03 10:16:59 +02:00
A. Hauptmann
15e4dedace win: remove UV_HANDLE_CONNECTED
UV_HANDLE_CONNECTED was defined, but never used anywhere - outside this if
condition inside uv__stdio_create. So this test can't be true.
UV_HANDLE_CONNECTION was meant.

A test was also added verifying the behaviour.

PR-URL: https://github.com/libuv/libuv/pull/404
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-07-07 09:45:48 +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
Ben Noordhuis
ff29322b99 test: canonicalize test runner path
The get_currentexe test requires a canonicalized argv[0] to check
against.  Before this commit, it failed when argv[0] contained symbolic
links.

Fixes libuv/libuv#18.
2014-12-01 16:20:51 +01:00
Alexis Campailla
6d3a051eb4 windows: relay TCP bind errors via ipc
This is the libuv side of the fix for Node's cluster module on Windows.
https://github.com/joyent/node/issues/7691

Windows and Unix return certain socket errors (i.e. EADDRINUSE) at
different times: bind on Windows, and listen on Unix.
In an effort to hide this difference, libuv on Windows stores such
errors in the bind_error field of uv_tcp_t, to defer raising it at
listen time.
This worked fine except for the case in which a socket is shared in
a Node cluster and a bind error occurs.

A previous attempt to fix this (
d1e6be1460
3da36fe00e
) was flawed becaused in an attempt to relay the error at the JS level
it caused the master to start accepting connections.

With this new approach, libuv itself is relaying the bind errors,
providing for a uniform behavior of uv_tcp_listen.
2014-07-31 17:24:40 +02:00
Fedor Indutny
6abe1e4b95 fs: uv__cloexec() opened fd
Every file descriptor opened using libuv should be automatically marked
as CLOEXEC to prevent it from leaking to a child process. Note that
since we are opening fds in a thread pool, there is a possible race
condition between `uv_spawn()` and the `open()` + `uv__cloexec()`. The
rwlock was added to avoid it.

see https://github.com/joyent/node/issues/6905
2014-02-01 01:02:37 +04:00
Dylan Cali
756087e017 test: support flexibly setting custom task options
Add a single TEST_ENTRY_CUSTOM hook that can be used to override task
entry defaults. Different tests can have different timeouts depending on
what is appropriate for each test. A separate TEST_OUTPUT_ENTRY hook is
no longer necessary.

In order to support per-task timeouts, the timeout field has been moved
into the task_entry_t struct. The default (5000) is now set as part of
TEST_ENTRY.
2014-02-01 00:50:40 +04:00
Timothy J Fontaine
bfe269b8a0 test: add tap output
Given UV_TAP_OUTPUT being set, test result output should use TAP formatting
2013-02-22 23:06:17 +01:00
Ben Noordhuis
f5b6374948 test, bench: replace strlen() with sizeof() 2012-12-14 11:47:54 +01:00
Ben Noordhuis
0a05b31a93 test: fix -Wunused-result warnings 2012-12-14 11:34:17 +01:00
Charlie McConnell
1d858156b4 unix: do not set environ unless one is provided
Currently, `uv_spawn` will set `environ` to the value of `options.env`, even if
`options.env` is `NULL`.  This results in child processes for whom `environ ==
NULL`, which can cause a variety of unexpected issues.
2012-11-03 01:37:22 +01:00
Ben Noordhuis
28ed730bfb test: fix implicit function declaration warnings
Fixes the two following compiler warnings:

  ../test/run-tests.c: In function ‘maybe_run_test’:
  ../test/run-tests.c:117: warning: implicit declaration of function ‘write’
  ../test/run-tests.c:118: warning: implicit declaration of function ‘fsync’
2012-06-03 01:17:24 +02:00
Fedor Indutny
1cd9642cbb test: stdin/out/err should be set to /dev/null when ignored 2012-06-02 21:38:39 +02:00
Bert Belder
87dbffbd8f windows: fix undefined function warning in run-tests.c 2012-06-01 17:49:29 +02:00
Fedor Indutny
dc7a62d114 test: test for uv_spawn with stdio_count == 3 2012-06-01 17:32:34 +02:00
Igor Zinkovsky
70925c3bb9 windows: Enable passing of TCP connections over IPC 2012-03-29 18:18:46 -07:00
Ben Noordhuis
e190162975 test: test cross-process handle send/recv 2012-03-09 09:12:53 -08:00
Bert Belder
e99fba47c8 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/win/pipe.c
	test/run-tests.c
2012-03-09 16:41:12 +01:00
Bert Belder
50216706c2 Test runner: fix compiler warnings 2012-03-09 16:31:13 +01:00
Bert Belder
87752ac38b Fold trailing whitespace 2012-03-09 05:00:09 +01:00
Ben Noordhuis
a5082e8271 test: add proper type casts 2012-02-23 05:42:45 -08:00
Ben Noordhuis
4e1f2b1f64 Merge remote-tracking branch 'origin/v0.6' 2012-02-12 16:10:05 +01:00
Igor Zinkovsky
f9be43a564 support half-duplex pipes 2012-02-09 13:33:15 -08:00
Igor Zinkovsky
0cb2213db0 windows: when sharing a server socket, only call listen in the parent process 2011-10-25 13:23:53 -07:00
Igor Zinkovsky
28234d7336 windows: ref pipe writes to keep the event loop alive 2011-10-20 15:14:55 -07:00
Igor Zinkovsky
54982a23ef windows: stdio over non-overlapped pipes 2011-10-20 15:14:39 -07:00
Igor Zinkovsky
81c4043c83 ipc on windows 2011-10-06 10:17:42 -07:00
Ryan Dahl
bb6b629e6a make test-ipc accept the pending tcp server 2011-10-06 10:17:18 -07:00
Ryan Dahl
dc0f17d3e3 Add server to ipc_helper 2011-10-06 10:17:18 -07:00
Ryan Dahl
6921d2fc07 Add argument to uv_pipe_init for IPC, unix impl 2011-10-06 10:17:07 -07:00
Ben Noordhuis
fbbc085448 Rename COUNTOF() to ARRAY_SIZE().
Consistent with Node, it has an ARRAY_SIZE() macro but not COUNTOF().
2012-01-18 15:48:31 +01:00
Igor Zinkovsky
3d189de699 platform api 2011-12-14 17:50:36 -08:00
Ben Noordhuis
4d7cfe4313 test: remove stale prototype declaration 2011-09-08 00:00:18 +02:00
Ben Noordhuis
7dda111306 test, bench: add --list option to runners, prints available tests 2011-08-06 23:57:28 +02:00
Ben Noordhuis
5a15717144 test: make spawn_helper4 never return
Its whole raison d'être is to sleep until it's killed.
2011-08-02 00:46:44 +02:00
Ben Noordhuis
e56c1d7a60 test: exit with status code 1 in spawn_helper4
Fixes broken test spawn_and_kill.
2011-08-01 22:42:32 +02:00
Ben Noordhuis
31ecdcf3a4 test: move run-test spawn helpers to a separate function 2011-08-01 22:42:32 +02:00
Ben Noordhuis
023f99a609 test: gets(3)? Just say no! 2011-08-01 18:14:14 +02:00
Igor Zinkovsky
d272a2183d Windows: spawn child processes 2011-07-29 19:02:51 -07:00
Ryan Dahl
ddee1821fa Add spawn_stdout test 2011-07-25 17:11:23 -07:00
Ryan Dahl
92bc7b4959 Start uv_spawn()
Unix only at the moment. Lacks test for stdio
2011-07-25 16:19:27 -04:00
Ben Noordhuis
a29b2099ac Make it possible to run individual tests.
Fixes #100.
2011-07-14 02:19:36 +02:00
Ryan Dahl
2f4e65a1b2 Port to Solaris 2011-05-10 06:53:50 +00:00
Ryan Dahl
f0de01379f Use argv[0] if we can't get_executable_path() 2011-05-09 23:12:44 -07:00
Ryan Dahl
8e1645b85f LF after tests complete 2011-05-05 00:21:13 -07:00