Commit Graph

1210 Commits

Author SHA1 Message Date
Ben Noordhuis
5a3b8f9fce test: fix spawn_setgid_fails and spawn_setuid_fails
Don't try to set a bogus UID or GID and expect to get a meaningful
error. The test expected EPERM but SunOS returns EINVAL because the
id is outside of the range of valid user/group ids.

Try to switch to UID/GID 0. Give up privileges first if we're root,
else the setuid/setgid system call will succeed when it's expected
to fail.
2013-07-02 16:32:42 +02:00
Ben Noordhuis
d0be852cb1 test: fix fs_chown when running as root
chown(2) to root is expected to fail - unless you're root, of course.
2013-07-02 13:39:28 +02:00
Ben Noordhuis
d4f6165346 test: fix fs_fstat test on sunos
The tests are no longer compiled with -D_XOPEN_SOURCE=500 when building
with autotools. Tell the test explicitly that SunOS systems are
expected to have nanosecond fstat(2) granularity.
2013-07-02 13:34:19 +02:00
Ben Noordhuis
ddd7e04fd6 build: switch to autotools
Switch to the build tool everyone loves to hate.  The Makefile has
served us well over the years but it's been acquiring more and more
features that autotools gives us for free, like easy static+shared
library building, sane install targets, and so on.

This commit drops MinGW support.  If there is demand for it, we'll
re-add it.
2013-07-02 01:21:16 +02:00
Saúl Ibarra Corretgé
f9e6029b82 unix, windows: add extra fields to uv_stat_t 2013-06-28 00:42:37 +02:00
Ben Noordhuis
ce2458c053 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	test/test-fs.c
	test/test-list.h
2013-06-26 10:35:41 +02:00
Ben Noordhuis
5841852703 test: add 'start timer from check handle' test
Check that a timer that is started from a check handle gets picked up
correctly, i.e. that it influences the timeout used in the next tick
of the event loop.
2013-06-26 13:56:32 +02:00
Ben Noordhuis
488b43ecc5 test: fix signed/unsigned compiler warning 2013-06-26 13:40:40 +02:00
Ben Noordhuis
6607e70253 test: open stdout fd in write-only mode
Fixes #771.
2013-06-18 23:53:03 +02:00
Ben Noordhuis
ede83188f3 test: don't use S_IREAD and S_IWRITE
They're BSD-isms and obsolete ones at that. Replace with S_IRUSR and
S_IWUSR. Alias as _S_IREAD and _S_IWRITE on Windows because the '90s
never ended in Redmond, WA.
2013-05-31 12:50:19 +02:00
Bert Belder
081f7018ec test: use c-style comments
Fixes a compilation problem on OS X caused by the use of c++-style
comments in test-osx-select.c.
2013-05-29 18:32:25 +03:00
Ben Noordhuis
f6d8ba3c9a unix, windows: run expired timers in run-once mode
Before this commit, creating an event loop, starting a timer and
calling uv_run(UV_RUN_ONCE) blocked in uv_run() until the timer
expired - but didn't actually run the timer.
2013-05-30 00:33:23 +02:00
Ben Noordhuis
8ef9592a95 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	ChangeLog
	src/unix/stream.c
	src/version.c
2013-05-29 23:32:07 +02:00
Bert Belder
b5cd78ea05 test: reflect new idle semantics in test
Update the `idle_starvation` test to verify not only that idle callbacks
are called, but also that they are called once per loop iteration.
2013-05-29 22:52:06 +02:00
Bert Belder
961202d1c2 Merge branch 'v0.10'
Conflicts:
	ChangeLog
	config-unix.mk
	src/version.c
2013-05-14 17:03:24 -07:00
Miroslav Bajtoš
0564ee4a66 test, sunos: disable process_title test
Disable unit test failing due to missing implementation
of uv_(set|get)_process_title for Sun OS (SmartOS).

Based on discussion with @tjfontaine, such implementation is difficult
if possible at all and it won't be done anytime soon. Thus there is
no point in keeping the failing test around.
2013-05-14 13:36:32 +02:00
Ben Noordhuis
7d9c5572b8 Merge remote-tracking branch 'origin/v0.10' 2013-05-12 14:53:19 +02:00
Miroslav Bajtoš
fe2a3150c0 test: add error logging to tty unit test 2013-05-08 17:20:20 -07:00
Miroslav Bajtoš
af6e865a07 test: fix process_title failing on linux
Shorten the test string from 40 to 38 characters because the title
length is limited to 39 characters.

Truncation of long titles was introduced intentionally by commit
a0c1d84 (see discussion in joyent/node#5006).
2013-05-08 17:20:20 -07:00
Ben Noordhuis
ce580cc057 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	ChangeLog
2013-05-08 15:46:54 -07:00
Miroslav Bajtoš
2c21050956 test: add RETURN_SKIP and RETURN_TODO macros
Added two new flags to identify tests that are intentionally ignored
(usually because we don't want to implement the tested functionality
on current platform) and test serving as TODO list (usually indicating
that the tested functionality should be implemented on current plaform
in the near future.)
2013-05-08 15:43:54 -07:00
Ben Noordhuis
ebdeaed2e3 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	ChangeLog
	src/version.c
2013-05-02 09:22:39 +02:00
Fedor Indutny
ac4e7e7ff2 stream: fix small nit in select hack, add test 2013-04-27 18:50:55 +02:00
Saúl Ibarra Corretgé
a92b66fe33 unix, windows: add uv_has_ref() function 2013-04-17 15:31:08 +02:00
Ben Kelly
14aa6153be unix, win: add netmask to uv_interface_address
Include the netmask when returning information about the OS network
interfaces.

This commit provides implementations for windows and those unix
platforms using getifaddrs().

AIX was not implemented because it requires the use of ioctls and I do
not have an AIX development/test environment.  The windows code was
developed using mingw on winxp as I do not have access to visual studio.

Tested on darwin (ipv4/ipv6) and winxp (ipv4 only).  Needs testing on
newer windows using ipv6 and other unix platforms.
2013-04-10 14:48:23 +02:00
Ben Noordhuis
f78bcfbd6a Merge remote-tracking branch 'origin/v0.10' 2013-04-10 14:24:18 +02:00
Fedor Indutny
895e77639e unix: don't write more than IOV_MAX iovecs
Write no more than `IOV_MAX` chunks with `writev()` at
once, otherwise `writev()` returns EINVAL.
2013-04-08 19:51:30 +04:00
Ben Noordhuis
23947fdabb Merge remote-tracking branch 'origin/v0.10' 2013-03-29 15:57:10 +01:00
Saúl Ibarra Corretgé
a9a23dc28e unix: don't clear flags after closing UDP handle 2013-03-28 16:08:42 +01:00
Ben Noordhuis
76d831e4c8 unix: getaddrinfo_cb status arg should be 0 or -1
The documentation in uv.h states that the status argument to the
uv_getaddrinfo() callback is either 0 or -1 but uv-unix actually
passed it the addrinfo error code. Rectify that and add a regression
test.

Fixes #754.
2013-03-26 22:30:46 +01:00
Ben Noordhuis
eca008a386 Merge remote-tracking branch 'origin/v0.10' 2013-03-23 19:15:45 +01:00
Ben Noordhuis
9b619396d9 unix: make timers handle large timeouts
This commit fixes two closely related integer overflow bugs:

* Timers with a timeout > INT_MAX cause uv__next_timeout() to return
  a negative value.

* Timers with very large timeouts (close or equal to ULLONG_MAX) run on
  the next tick.

In both cases, clamp the values to prevent the overflow from happening.

Fixes joyent/node#5101.
2013-03-21 14:54:36 +01:00
Brian Mazza
77cb29a723 unix: make uv_timer_init() initialize repeat
uv_timer_get_repeat() should return 0 for timers that haven't been
started.
2013-03-19 23:15:30 +01:00
Timothy J Fontaine
499c7976c6 unix, windows: nanosecond resolution for uv_fs_[fl]stat
Closes #739.
2013-03-19 21:48:15 +01:00
Timothy J Fontaine
2f84a57566 test: add tap output for windows 2013-03-11 18:12:25 +01:00
Timothy J Fontaine
49d2ae33ef test: fix tap output even when ok but have output 2013-02-27 22:48:54 +01:00
Ben Noordhuis
1821bba408 test: fix tap output check
Only report as an error when status != 0.

Stops the platform_output test from being reported as having failed
on Jenkins.
2013-02-27 22:20:14 +01:00
Ben Noordhuis
a924f79023 test: remove 'is root?' check
I debug tests regularly as root (because dtrace and dtruss require the
additional privileges). The 'is root?' check gets in the way more often
than it prevents me from doing something silly. Remove it.
2013-02-27 21:35:40 +01:00
Timothy J Fontaine
72bbf5d702 test: don't rewind_cursor when using tap_output 2013-02-25 19:00:16 +01:00
Saúl Ibarra Corretgé
4b957482ba windows: fix uv_stop in ONCE and NOWAIT modes
Same as the fix in 492efb9 but this time for uv-win.
2013-02-25 18:26:58 +01:00
Saúl Ibarra Corretgé
bb3d1e24da unix, windows: add uv_stop, stop running event loop 2013-02-25 16:21:37 +01: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
da0b84d4e8 unix: auto-unref spawn handle on process exit
Consistent, for better or worse, with uv-win.

Fixes #718.
2013-02-22 14:39:40 +01:00
Ben Noordhuis
d6bfedb862 unix, windows: make uv_now() return uint64_t
Using int64_t doesn't make sense here because the return value is never
negative.
2013-02-20 16:58:45 +01:00
Ben Noordhuis
da71649991 unix, windows: make uv_fs_t.statbuf public
Make the statbuf field public. This means you no longer have to use
req->ptr - though that still works and will continue to work for the
foreseeable future.

Fixes #704.
2013-02-10 17:50:03 +01:00
Shigeki Ohtsu
fadfeaf6ec unix,windows: fix timer order in case of same timeout
Compare start_id of timer handles when they have the same timeout.
start_id is allocated with loop->timer_counter in uv_timer_start.
2013-02-10 17:46:22 +01:00
Andrius Bentkus
017e2d5fde unix, windows: make uv_*_bind() error codes consistent
Just like uv_tcp_connect() it should return an EINVAL when the handle
is of an invalid type or when the network address is faulty.
2013-01-18 12:18:23 +01:00
Ben Noordhuis
e7f384f853 test: make threadpool tests valgrind-compliant
Delete the event loop after the test to stop valgrind from complaining
about memory leaks.
2013-01-16 23:59:58 +01: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
Ben Noordhuis
4cbd5c7b32 test: remove bad tcp_write_error test
It makes the assumption that if you try to write to a localhost socket
often enough, eventually its send queue will fill up - which doesn't
happen if the machine it's running on is fast enough.
2013-01-16 00:31:21 +01:00
Ben Noordhuis
9aab5d4837 Revert "unix: improve uv_guess_handle() implementation"
This reverts commit 98bcddc8dd.

It's making a lot of tests in the node.js test suite fail.
2013-01-11 13:40:25 +01:00
Ben Leslie
98bcddc8dd unix: improve uv_guess_handle() implementation
uv_guess_handle is currently squelching both fifo and all
sockets on to the UV_NAMED_PIPE type. Rather than treating
all sockets as UV_NAMED_PIPE, use getsockopt() and
getsockaddr() to determine if the socket is an AF_UNIX
stream (in which case return UV_NAMED_PIPE), or an AF_INET
stream (in which case return UV_TCP), or an AF_INET datagram
socket (in which case return UV_UDP).

Additionally, currently all other file descriptor types are
squelched to the UV_FILE type. Instead, only file descriptors
that are marked as regular files are treated as UV_FILE. All
other types (such as directories, character and block devices)
are now treated as UV_UNKNOWN_HANDLE.
2013-01-08 05:26:58 +01:00
Ben Noordhuis
f24335d498 test: fix #if defined checks
Same as edd1007 but this time for the tests.
2013-01-06 22:36:54 +01:00
Ben Noordhuis
fb725c0893 test: simplify tcp_ref2b
Said test doesn't need its own close callback, it can piggyback on the
common close callback.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
ccb96b67df test: remove unused function declaration 2013-01-06 22:31:48 +01:00
Ben Noordhuis
847182cdf1 test, bench: make functions/variables static
Make functions and variables that are local to the compilation unit
static. Remove what turns out to be unused.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
7ff6f29b85 test, bench: ANSI-fy function prototypes
Replace `void f()` with `void f(void)`; the former means "a function
that takes any number of arguments, including none" while the latter
is what is actually intended: a function taking no arguments.

The first form also isn't strictly conforming ANSI/ISO C.
2013-01-06 22:31:48 +01:00
Ben Noordhuis
1f52fc1c5a test: remove consumer_producer test
It fails intermittently on Travis for no other reason than that Travis
is occasionally slow. Reduce the number of false positives, remove the
test.
2013-01-06 19:19:23 +01:00
Ben Noordhuis
92a19a19dd unix: ensure done_cb gets called after uv_cancel()
Wake up the event loop with uv_async_send() when a request is cancelled.
Ensures the done_cb is run on the next tick of the event loop.

Not sending a wakeup signal results in the done_cb not getting called until
another request completes, which may be a long time coming when it's the only
request in the queue or when other requests are executing long-running jobs.

Fixes #669.
2012-12-28 18:09:39 +01:00
Saúl Ibarra Corretgé
33d5c497a6 prepare/idle/check: don't allow NULL callback 2012-12-24 17:05:01 +01:00
Ben Noordhuis
5af43ba446 bench: add 'million async handles' benchmark 2012-12-24 12:19:10 +01:00
Ben Noordhuis
1c722d6c22 test: make fmt() not leak memory 2012-12-24 12:03:25 +01:00
Saúl Ibarra Corretgé
0820be7008 Implemented uv_run2
Allows for running the event loop in 3 modes:
  * default: loop runs until the refcount drops to zero
  * once: poll for events only once and block until one is handled
  * nowait: poll for events only once but don't block if there are
    no pending events
2012-12-18 16:11:23 +01:00
Ben Noordhuis
c6c5b7a901 Merge branch 'v0.8' 2012-12-14 12:07:31 +01:00
Andrew Shaffer
49977386e9 sunos: properly disarm PORT_LOADED fsevent watcher
Fixes a segmentation fault when the watched entity is changed after the watcher
has been closed.
2012-12-14 12:02:57 +01:00
Ben Noordhuis
a3b57dd598 test, bench: remove unused includes 2012-12-14 11:48:04 +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
Ben Noordhuis
e079a99abd unix: fix event loop stall
Fix a rather obscure bug where the event loop stalls when an I/O watcher is
stopped while an artificial event, generated with uv__io_feed(), is pending.
2012-12-13 20:17:12 +01:00
Ben Noordhuis
92fb84b751 unix: rework uv_cancel() api
Bert Belder informs me the current approach where a request is immediately
cancelled, is impossible to implement on Windows.

Rework the API to always invoke the "done" callback with an UV_ECANCELED error
code.
2012-12-13 13:46:38 +01:00
Ben Noordhuis
52c8a8617d unix: add uv_cancel() 2012-12-09 15:12:42 +01:00
Shigeki Ohtsu
fa11db905a test: fix finished consumer number check 2012-11-29 15:40:00 +01:00
Ben Noordhuis
4a69c4bb5f unix: change uv_backend_timeout() prototype
* change return value to signed int
* constify loop argument
2012-11-28 17:02:30 +01:00
Fedor Indutny
09a7f85b70 unix: add uv_backend_fd() and uv_backend_timeout()
This can be used in conjuction with uv_run_once() to poll in one thread and run
the event loop's event callbacks in another.

Useful for embedding libuv's event loop in another event loop.
2012-11-28 16:30:50 +01:00
Shigeki Ohtsu
0cca5391ba unix, windows: disallow NULL worker in thread pool
See #629.
2012-11-24 01:09:49 +01:00
Ben Noordhuis
d8a8379751 test: disable fs event test on dragonflybsd
Disable the fs_event_close_in_callback test on DragonFlyBSD, like we do on the
other BSDs.

The test doesn't work with kqueue-based file notifications, the event is
generated before the file is watched. Maybe we should remove it altogether.
2012-11-20 00:46:12 +01:00
Ben Noordhuis
190db15638 unix: set proper loop errno for udp write req cb
Harmonize with stream.c and tcp.c: when a handle is closed that has pending
writes queued up, run the callbacks with loop->err.code set to UV_ECANCELED,
not UV_EINTR.
2012-11-19 04:02:42 +01:00
Ben Noordhuis
59a2c63931 bench: remove dead and buggy code
Pipe accept benchmarks have never been implemented, remove the code path.

Said code path also contained a bug: it tried to bind to the same pipe that is
bound to a few lines down.
2012-11-16 02:24:23 +01:00
Ben Noordhuis
a28bc88708 bench: print benchmark name in async/async_pummel 2012-11-16 02:24:22 +01:00
Ben Noordhuis
c252bcb3f0 bench: fix loop starvation bug
Don't keep writing until the write queue fills up. On fast systems (mine), that
never happens - the data is sent out as fast as the benchmark generates it.
2012-11-15 01:02:07 +01:00
Ben Noordhuis
09b022232a bench: report proper benchmark name 2012-11-13 17:47:47 +01:00
Ben Noordhuis
b9c8d19637 bench: close timer handles before deleting loop
Fixes a segmentation fault / use-after-free.
2012-11-13 15:56:55 +01:00
Ben Noordhuis
3243e9ae67 test: fix (harmless) typo in function name 2012-11-12 18:17:13 +01:00
Ben Noordhuis
625340066e test: fix close of uninitialized handle
The test closes all handles after 1000 ms but the remote peer handle may not
have been initialized by then (very unlikely but not quite impossible).
2012-11-11 03:24:25 +01:00
Ben Noordhuis
0a7e36dcf1 test: add UV_RUN_AS_ROOT check 2012-11-11 03:24:22 +01:00
Ben Noordhuis
bef3ea4818 bench: squelch -Wstrict-aliasing warnings 2012-11-09 03:51:47 +01:00
Ben Noordhuis
2d1f17fecb test: work around valgrind bug 2012-11-09 01:57:58 +01:00
Ben Noordhuis
91faa3e688 test: fix compiler warning
Fix the following warning by not using a static variable:

  test/test-fs-poll.c:79: warning: ‘static’ is not at beginning of declaration
2012-11-07 16:20:18 +01:00
Ben Noordhuis
a320d46440 test: fix type casting style issue 2012-11-07 05:50:30 +01:00
Ben Noordhuis
2affa60e19 test: remove unnecessary #ifdef _WIN32
This is a back-port of commit 4d17337 from the master branch.
2012-11-06 00:35:39 +01:00
Ben Noordhuis
7759bd63cd test: remove unnecessary #ifdef _WIN32 2012-11-06 00:32:04 +01:00
Bert Belder
4c9e42d0e6 windows: un-break the build
It was broken in fb64948.
2012-11-05 22:13:38 +01:00
Bert Belder
6620e614ac windows: un-break the build
It was broken in 1d85815.
2012-11-05 22:11:22 +01:00
Charlie McConnell
fb64948746 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.

This is a back-port of commit 1d85815 from the master branch.
2012-11-03 01:41:10 +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
dcce1eab3b test: fix -Wmissing-field-initializers warnings 2012-11-02 14:34:28 +01:00
Ben Noordhuis
894a8523cb test: fix signed/unsigned comparison warnings 2012-11-02 14:32:14 +01:00
Ben Noordhuis
b8aa5b9bf2 test: don't assert on UV_EPIPE in echo-server.c
UV_EPIPE is not an error per se, it simply indicates that the other end of the
connection - i.e. the test case - has gone away.

Pro-actively ignore UV_ECANCELED errors. They're not actually emitted right now
because there's only ever one pending write but let's be forward compatible.
2012-11-01 15:39:11 +01:00
Bert Belder
149b16f123 windows: closing handles should always keep the loop alive
This makes the tcp-ref2 and udp-ref2 tests pass again.
Also adds another reference count test.
2012-10-25 15:10:29 +02:00
Bert Belder
0dbab84529 benchmark: async_pummel should not call uv_async_send on closed handle
This fixes an assertion that triggered in debug builds on Windows.
2012-10-24 21:36:57 +02:00
Bert Belder
a54b9e2921 benchmark: timed_udp_pummel should not write to closed udp handle
This fixes intermittent assertion failures when running the benchmark.
2012-10-24 21:36:57 +02:00
saghul
61ecb3415d win: support compilation with Visual Studio 2008 2012-10-23 22:55:25 +02:00
Bert Belder
1e32cb01b5 unix: support signal handlers outside the main loop 2012-10-17 01:25:02 +02:00
Bert Belder
47eb03490a test: move loop cleanup code to the individual tests 2012-10-17 01:24:49 +02:00
Bert Belder
28eb619c65 windows: don't run signal tests
They are dummy tests on windows, running them is misleading.
Also remove duplicate 'test-signal.c' entry from uv.gyp.
2012-10-16 17:23:04 +02:00
Bert Belder
c5e1140779 tests: fix some compile warnings on windows 2012-10-16 17:22:54 +02:00
Hiroaki Nakamura
36b1e1a57c test: change 10e8 to 1e9
It is clearer and used everywhere else.
2012-10-16 00:07:46 +02:00
Bert Belder
4900912d44 windows: fix application crashed popup in debug version
This is a backport of 2 patches by Ting-Yu Lin and Hiroaki Nakamura.
2012-10-10 17:15:25 +02:00
Hiroaki Nakamura
acea3028c5 unix, windows: add thread barrier support 2012-10-09 17:30:52 +02:00
Hiroaki Nakamura
2684f876a9 windows: don't set CRT debug mode on MinGW 2012-10-09 17:00:02 +02:00
Shigeki Ohtsu
f7c991f1ce test: add consumer-producer test for condvar 2012-10-07 23:17:31 +02:00
Ting-Yu Lin
8f1ec32865 windows: fix application crashed popup in debug version 2012-10-07 15:43:03 +02:00
Hiroaki Nakamura
976c8a4387 Add support for condition variables on all platforms 2012-10-05 13:03:55 +02:00
Shigeki Ohtsu
01337af65d test, windows: fix duplicated windows.h
including windows.h before winsock2.h cause build error
2012-10-03 03:46:49 +02:00
Ben Noordhuis
d796c3b6f4 test: fix windows #include bug
Fixes a "'AF_IPX' : macro redefinition" warning when compiling test/runner.c.
2012-10-03 00:58:04 +02:00
Ben Noordhuis
b88f8b40d6 test: fix uninitialized memory warning, use calloc
Fixes the following valgrind warning:

  ==29019== Syscall param writev(vector[...]) points to uninitialised byte(s)
  ==29019==    at 0x584270B: writev (writev.c:51)
  ==29019==    by 0x449BB2: uv__write (stream.c:733)
  ==29019==    by 0x44AE91: uv_write2 (stream.c:1159)
  ==29019==    by 0x44AF25: uv_write (stream.c:1180)
  ==29019==    by 0x42CCAA: connect_cb (test-tcp-writealot.c:129)
  ==29019==    by 0x44AC05: uv__stream_connect (stream.c:1097)
  ==29019==    by 0x44AA25: uv__stream_io (stream.c:1050)
  ==29019==    by 0x437430: uv__io_rw (core.c:539)
  ==29019==    by 0x43C3D9: ev_invoke_pending (ev.c:2145)
  ==29019==    by 0x436EC5: uv__poll (core.c:260)
  ==29019==    by 0x436F0F: uv__run (core.c:269)
  ==29019==    by 0x436F6E: uv_run (core.c:277)
  ==29019==  Address 0x5f15040 is 0 bytes inside a block of size 94,371,840 alloc'd
  ==29019==    at 0x4C2C5EF: malloc (vg_replace_malloc.c:270)
  ==29019==    by 0x42CDED: run_test_tcp_writealot (test-tcp-writealot.c:148)
  ==29019==    by 0x406551: run_test_part (runner.c:302)
  ==29019==    by 0x405384: main (run-tests.c:57)
2012-10-03 00:23:38 +02:00
Ben Noordhuis
c6c691f323 test: join worker thread at exit in test-async.c 2012-10-02 23:54:19 +02:00
Ben Noordhuis
5135cfc45b test: fix memory leak in test-getsockname.c 2012-10-02 23:45:27 +02:00
Ben Noordhuis
f89986b153 test: fix memory leaks in test-fs-event.c 2012-10-02 23:19:53 +02:00
Ben Noordhuis
e474a2a420 test: fix memory leak in test-fs.c 2012-10-02 23:10:59 +02:00
Ben Noordhuis
8399cb1fc3 test: fix memory leaks in fs_symlink test 2012-10-01 23:54:34 +02:00
Ben Noordhuis
7320633c4b unix: remove uv_fs_stat windows compat hack
uv_fs_stat and uv_fs_lstat removed the trailing backslash (if any) from the path
in order to please a test case that was written for Windows. Remove the
compatibility hack and fix the test.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
678e95a443 test: close handle in ref tests
Everything that gets reported by valgrind now is an actual memory leak.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
45b5e79f8e test: fix memory leak in tcp_ping_pong 2012-10-01 22:53:59 +02:00
Ben Noordhuis
f090297f62 test: delete default loop after test run
Delete the default event loop after the test completes. Keeps valgrind happy.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
4e268f7718 test: add valgrind support
Run tests through valgrind when UV_USE_VALGRIND=1 is set in the environment.
2012-10-01 22:53:59 +02:00
Ben Noordhuis
48f98424bd test: fix error message in runner 2012-10-01 22:53:59 +02:00
Ben Noordhuis
1923abda94 test: add uv_fs_readlink test 2012-10-01 22:53:59 +02:00
Fedor Indutny
778144f0b5 darwin: emit relative path in fsevents 2012-09-18 00:29:29 +02:00
Ben Noordhuis
37dc7472d7 test: fix aliasing warning in dns-server.c 2012-09-17 23:48:19 +02:00
Ben Noordhuis
29f44c7564 bench: let client close connection in tcp_multi_accept{2,4,8} 2012-09-17 23:22:04 +02:00
Ben Noordhuis
a8c6da8dfa bench: add idle delay to tcp_multi_accept{2,4,8} 2012-09-17 23:22:04 +02:00
Ben Noordhuis
b74b1c4c56 bench: add tcp accept benchmarks 2012-09-17 23:22:04 +02:00
Saúl Ibarra Corretgé
cc1c1912ca unix, windows: add uv_tcp_open and uv_udp_open 2012-09-17 18:09:51 +02:00
Andrew Paprocki
900ad30b43 aix: add initial platform support for aix using gcc/gxlc
Adds initial libuv build/platform support for AIX. Builds work using gcc or the
IBM XL C compiler using its gxlc wrapper. Platform support is added for
uv_hrtime, uv_exepath, uv_get_free_memory, uv_get_total_memory, uv_loadavg,
uv_uptime, uv_cpu_info, uv_interface_addresses.
2012-09-14 01:23:28 +02:00
Fedor Indutny
f8e7513a06 darwin: use FSEvents to watch directory changes 2012-09-12 23:38:57 +02:00
Shigeki Ohtsu
09faee40eb windows: fix environment_creation test
abc945bc04 fails environment_creation test
2012-08-29 04:31:25 +02:00
Bert Belder
621a4e36f7 test: add test for uv_is_active and uv_is_closing 2012-08-27 23:57:48 +02:00
Ben Noordhuis
c77d08eb92 bench: add timed and non-timed udp pummel benchmarks 2012-08-25 22:37:18 +02:00
Ben Noordhuis
28ff1422e8 Merge branch 'v0.8'
Conflicts:
	src/fs-poll.c
2012-08-20 18:11:43 +02:00
Ben Noordhuis
b5ad44d103 test: add uv_fs_poll_t to benchmark-sizes.c 2012-08-20 16:31:54 +02:00
Bert Belder
7c3ba514e7 windows: use WCHAR consistently 2012-08-13 22:31:48 +02:00
Bert Belder
aa69f34d53 windows: report spawn errors to the exit callback
Formerly spawn errors would be reported as a message printed to the
process' stderr, to match unix behaviour. Unix has now been fixed to
be more sensible, so this hack can now be removed.

This also fixes a race condition that could occur when the user closes
a process handle before the exit callback has been made.
2012-08-13 22:31:47 +02:00
Bert Belder
80eae82104 test: spawn failures are reported by setting the exit code to -1 2012-08-13 22:31:47 +02:00
Bert Belder
1b8307637b test: fix intermittent failure of tcp_unexpected_read on windows 2012-08-13 22:31:46 +02:00
Bert Belder
c85672eb13 test: avoid compiler complaints about implicit double-to-int cast 2012-08-13 22:31:45 +02:00
Bert Belder
762c85c3ef windows: un-break the build 2012-08-13 22:31:45 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
ee50db6e36 unix, windows: preliminary signal handler support
* a no-op on Windows for now
* only supports the main loop on UNIX (again, for now)
2012-08-10 02:00:07 +02:00
Ben Noordhuis
13467a40d4 unix: retrieve execve() errors in process.c
Make the forked child process send the errno to its parent process when it
fails to spawn a new process.
2012-08-08 23:19:50 +02:00
Bert Belder
35c4858231 Remove c-ares tests and benchmarks 2012-08-07 01:03:51 +02:00
Bert Belder
32da23988b Merge branch 'v0.8'
Conflicts:
	src/unix/sunos.c
2012-08-05 23:51:04 +02:00
Bert Belder
1d5eb91474 Avoid compiler warning 2012-07-30 11:00:37 +02:00
Ben Noordhuis
be1032431d Merge branch 'v0.8' 2012-07-29 03:13:21 +02:00
Ben Noordhuis
ec76a42515 test: add uv_loop_t to benchmark-sizes.c 2012-07-28 14:56:36 +02:00
Ben Noordhuis
4fe369b179 test: add uv_fs_event_t to benchmark-sizes.c 2012-07-28 14:48:47 +02:00
Ben Noordhuis
b5b8ead808 test: add failing fs_event test
Watches the same file twice. Fails on Linux with a segmentation fault.
2012-07-28 14:40:03 +02:00
Ben Noordhuis
cf05c5f0d6 Raise UV_ECANCELED on premature close.
Set the error code to the more appropriate UV_ECANCELED instead of UV_EINTR
when the handle is closed and there are in-flight requests.
2012-07-27 15:13:29 +02:00
Ben Noordhuis
94355e4718 unix: fix format string vulnerability in freebsd.c
uv_set_process_title() was susceptible to a format string vulnerability:

  $ node -e 'process.title = Array(42).join("%s")'
  Segmentation fault: 11 (core dumped)

The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
but valgrind complains loudly about reads from and writes to uninitialized
memory in libc. It's not a libuv bug because the test case below triggers the
same warnings:

  #include <sys/types.h>
  #include <unistd.h>

  int main(void)
  {
    setproctitle("%s", "test");
    return 0;
  }

That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).

This commit reapplies commit a9f6f06, which got reverted in 69a6afe. The revert
turned out to be unnecessary.
2012-07-19 16:26:54 +02:00
Ben Noordhuis
69a6afea63 unix: undo changes to uv_set_process_title()
It's making node.js crash when run as root. Backtrace:

  (gdb) bt
  #0  0x00007fff856e3ff9 in __findenv ()
  #1  0x00007fff856e404c in getenv ()
  #2  0x000000010004c850 in loop_init (loop=0x10045a792, flags=8) at ev.c:1707
  #3  0x000000010004cb3b in ev_backend [inlined] () at /Users/tjfontaine/Development/node/deps/uv/src/unix/ev/ev.c:2090
  #4  0x000000010004cb3b in ev_default_loop (flags=1606417108) at ev.c:2092
  #5  0x000000010004e5c6 in uv__loop_init (loop=0x10066e330, default_loop=1) at loop.c:52
  #6  0x0000000100044367 in uv_default_loop () at core.c:196
  #7  0x0000000100004625 in node::Init (argc=1606417456, argv=0x100b0f490) at node.cc:2761
  #8  0x000000010000797d in node::Start (argc=1606417600, argv=0x0) at node.cc:2888
  #9  0x0000000100000ca4 in start ()

This reverts commits:

  b49d6f7 unix: fix uv_set_process_title()
  a9f6f06 unix: fix format string vulnerability in freebsd.c
  a87abc7 unix: avoid buffer overflow in proctitle.c
  dc97d44 unix: move uv_set_process_title() to proctitle.c
2012-07-18 22:54:39 +02:00
Ben Noordhuis
a9f6f06fea unix: fix format string vulnerability in freebsd.c
uv_set_process_title() was susceptible to a format string vulnerability:

  $ node -e 'process.title = Array(42).join("%s")'
  Segmentation fault: 11 (core dumped)

The fix is trivial - call setproctitle("%s", s) instead of setproctitle(s) -
but valgrind complains loudly about reads from and writes to uninitialized
memory in libc. It's not a libuv bug because the test case below triggers the
same warnings:

  #include <stdio.h>
  #include <stdlib.h>
  #include <sys/types.h>
  #include <unistd.h>

  int main(void)
  {
    setproctitle("%s", "test");
    return 0;
  }

That's why this commit replaces setproctitle() with sysctl(KERN_PROC_ARGS).
2012-07-13 17:16:38 +02:00
Ben Noordhuis
ad382bcac0 test: add missing return statement 2012-07-09 18:46:57 +02:00
Ben Noordhuis
68b0c85c09 test: allow 80 ms intervals in hrtime test
The hrtimer functionality on my FreeBSD 9 system is fairly coarse, it's usually
just over the 60 ms that we tested for before this commit.
2012-07-03 22:33:10 +02:00
Ben Noordhuis
a2204abc8e bench: improve async_pummel benchmark
Benchmark the performance of uv_async_send() when the handle is contended for
by 1, 2, 4 or 8 threads.
2012-07-02 03:57:15 +02:00
Ben Noordhuis
1d1dd9bb7d test: add 'unexpected read' tcp test
Regression test that verifies that the event loop doesn't busy loop when
the server sends a message and the client isn't reading.
2012-06-30 03:25:52 +02:00
Bert Belder
7628b6597e test: fix test-gethostbyname to not use a DNS server on localhost
Because, you know, not everybody has one.
2012-06-29 05:44:20 +02:00
Bert Belder
e9b17bcc65 Revert "test: improve clean-up in test-fs-event"
There were too many errors in this commits; it totally broke on
Windows. Besides, when the moon is dark, the cleanup code could delete
some random files from my hard drive.

This reverts commit 7573f4a4c4.
2012-06-29 05:29:26 +02:00
Bert Belder
937d2c93ea test: fix test-gethostbyname to not use a DNS server on localhost
Because, you know, not everybody has one.
2012-06-29 05:28:26 +02:00
Ben Noordhuis
c89df5b990 bench: add another async handle benchmark 2012-06-29 03:16:06 +02:00
Ben Noordhuis
f90d428b29 test: fix unused function warning
exit_cb_unexpected() is only used on Windows.
2012-06-29 02:34:12 +02:00
Ben Noordhuis
13747033f8 test: remove unused function poll_cb_fail() 2012-06-29 02:34:09 +02:00
Ben Noordhuis
3b209e7642 bench: add async handle benchmark 2012-06-29 02:29:50 +02:00
Ben Noordhuis
123ca8b87e test: make fmt() function global 2012-06-29 02:29:21 +02:00
Charlie McConnell
f3fd8e3c1b test: prevent running the tests as root 2012-06-26 00:42:11 +02:00
Charlie McConnell
7573f4a4c4 test: improve clean-up in test-fs-event
Failed tests would leave behind extra files, and some tests weren't cleaning up
properly in the first place - this adds a cleanup_watch_dir() helper method to
make all the fs-event tests more consistent.
2012-06-26 00:42:07 +02:00
saghul
431d61af31 win: map ERROR_PRIVILEGE_NOT_HELD to UV_EPERM 2012-06-25 16:37:08 +02:00
Bert Belder
d169ba1a1b Make the stat benchmark run shorter
Man, Windows is so slow...
2012-06-22 01:16:52 +02:00
Ben Noordhuis
5dc024f676 bench: add thread pool I/O benchmark 2012-06-21 22:40:17 +02:00
Ben Noordhuis
14ffaa668d unix, windows: stat: never pass NULL to cb
Never pass NULL to the fs_poll callback, use a zeroed out statbuf instead.

Makes the interface a little more convenient to use.
2012-06-20 17:56:37 +02:00
Ben Noordhuis
6d67cf1952 unix, windows: update uv_fs_poll API
* the callback gets called only once on error, not repeatedly...

* ...unless the error reason changes from e.g. UV_ENOENT to UV_EACCES

* the callback receives pointers to uv_statbuf_t objects so it can inspect what
  changed
2012-06-16 04:54:25 +02:00
Ben Noordhuis
cc7c8542a5 unix, windows: add stat() based file watcher
Monitors a file path for changes. Supersedes ev_stat.
2012-05-31 20:32:24 +02:00
Bert Belder
9a3dff35c0 test: make the test-hrtime less likely to time out 2012-06-14 22:41:41 +02:00
Ben Noordhuis
0ae026dc84 bench: add lots-of-timers benchmark 2012-06-09 18:42:06 +02:00
Maciej Małecki
c92788e503 test: fix test runner progress bar
Make % completed indicator actually show % completed instead of 0 %.
2012-06-09 18:09:26 +02:00
Bert Belder
b5a15f5cdf test: fix test-tcp-shutdown-after-write bug
It was calling uv_read_start before the uv_connect call had completed.
Although we want to allow this in the future, right now it's not
supported.
2012-06-08 03:11:53 +02:00
Ben Noordhuis
59cda86709 unix, test: make NANOSEC a 64 bits unsigned int
Avoids accidental overflow / truncation when it's used in 32 bits arithmetic.
2012-06-07 17:00:01 +02:00
Shigeki Ohtsu
e2aa39aecf test: change uv_hrtime() test to iterate upto 100 2012-06-07 15:42:35 +02:00
Iñaki Baz Castillo
b47af98e00 test: add tcp 'close on failed connect' test
Demonstrates temporary event loop stall with uv-unix. The issue is that pending
requests aren't processed until the next event (I/O, timeout, etc.) happens.

See #446, #447 and #448.
2012-06-07 00:06:24 +02:00
Ben Noordhuis
7d2ea31618 unix: fix event loop stall
Stop libev from entering the epoll_wait/kevent/port_getn/etc. syscall when
there are no active handles left, that will block indefinitely.
2012-06-04 23:36:50 +02:00
Bert Belder
0dff0e7d47 test: avoid compiler warnings due to size_t truncation 2012-06-04 18:04:49 +02:00
Ben Noordhuis
d08070435d test: rename test tcp_dont_connect_after_write
Rename test tcp_dont_connect_after_write to tcp_connect_error_after_write,
teensy tad more descriptive.
2012-06-04 17:35:56 +02:00
Ben Noordhuis
76fa163117 test: add a 'write before connect' test 2012-06-04 17:12:20 +02:00
Ben Noordhuis
97801c6315 test: disable tcp_dont_connect_after_write on windows
For now. See #444.
2012-06-04 16:07:50 +02:00
Ben Noordhuis
b96ed68f46 test: add TCP connect error + write test
Original test contributed by Iñaki Baz Castillo. See #443.
2012-06-04 15:58:32 +02:00
Ben Noordhuis
c76c2066c6 unix, windows: add semaphore functions 2012-06-03 04:04:05 +02: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
4a07b8b7bd test-poll: make spurious wakeup detection slightly less strict 2012-06-02 21:12:10 +02:00
Bert Belder
38a6f9f0d9 test: fix windows-ism in test-poll-close.c 2012-06-01 18:53:11 +02:00
Bert Belder
9759c20e90 test: verify that closing an active poll handle doesn't hang 2012-06-01 18:39:47 +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
Fedor Indutny
f5b5127db0 change spawn() api to allow using existing streams for stdio
This commit also adds support for this api on Unix.
2012-06-01 17:32:27 +02:00
Bert Belder
04a7e5c274 test-spawn.c: remove unused variable 2012-06-01 02:26:25 +02:00
Charlie McConnell
69a923bf93 process: implement UV_PROCESS_DETACHED flag for uv_spawn 2012-06-01 02:24:05 +02:00
Ben Noordhuis
3f37ba859f bench: add new idle loop count benchmark 2012-05-31 02:46:18 +02:00
Ben Noordhuis
171ad8567d unix, windows: add uv_walk()
Lets the libuv user iterate over the open handles. Mostly intended as a
debugging tool or a post-hoc cleanup mechanism.
2012-05-30 02:33:39 +02:00
Ben Noordhuis
12ee388cd9 test: clean up test-loop-handles.c 2012-05-29 17:35:30 +02:00
Ben Noordhuis
ec0c7b8958 test: fix double close in test-loop-handles.c 2012-05-29 17:35:30 +02:00
Fedor Indutny
c0081f0e66 unix: allow specifying FDs to be inherited by a child process
Previously the only option was to create a pipe or an ipc channel. This
patch makes it possible to inherit a handle that is already open in the
parent process. It also makes it possible to set more than just stdin,
stdout and stderr.
2012-05-29 00:05:12 +02:00
Igor Zinkovsky
5a34f19970 windows: allow specifying FDs to be inherited by a child process
Previously the only option was to create a pipe or an ipc channel. This
patch makes it possible to inherit a handle that is already open in the
parent process. There is also room for setting more than just stdin,
stdout and stderr, although this is not supported yet.
2012-05-28 23:59:58 +02:00
Ben Noordhuis
028fef84b8 unix: update timer if already active
uv_timer_start() no longer returns an error when the timer is already active,
now it just updates the timer. Consistent with the uv-win implementation.

Fixes #425.
2012-05-26 02:09:59 +02:00
Ben Noordhuis
ae9d4c2aab test: add 'is active?' checks to test-timer.c 2012-05-26 01:57:49 +02:00
Ben Noordhuis
34445d0741 test: remove stale UNIX socket before running test
Fixes spurious test and benchmark failures.
2012-05-26 01:42:40 +02:00
Ben Noordhuis
28766dcf55 test: remove test-eio-overflow.c
Unreliable, it's timing / system load sensitive.
2012-05-25 01:33:44 +02:00
Ben Noordhuis
890d443558 unix: shave about 100 bytes off uv_udp_send_t 2012-05-23 23:21:08 +02:00
Ben Noordhuis
b69f8efee1 test: remove stale socket in ipc_send_recv_pipe
Fixes spurious test failures.
2012-05-23 21:18:40 +02:00
Ben Noordhuis
cd2a9b4d59 bench: measure ticks per second of idle event loop 2012-05-23 21:05:43 +02:00
Ben Noordhuis
7c8313bd0f unix, windows: make uv_run_once() return a bool
The return value of uv_run_once() now signals if it needs to be called again.

Fixes #427.
2012-05-23 20:49:03 +02:00
Ben Noordhuis
3604b8ddd3 unix: don't unlink UNIX socket on EADDRINUSE
It was a bad idea to start with...
2012-05-23 14:06:32 +02:00
Ben Noordhuis
b19a713cfc test: fix unused variable warning 2012-05-23 12:51:15 +02:00
Ben Noordhuis
7a64ec49ff test: clean up test-tcp-writealot.c
Avoid unnecessary heap allocations, makes it easier to reason about correctness.
2012-05-23 01:50:10 +02:00
Bert Belder
0ef7844b87 Disable test-callback-order
It's not correct.
2012-05-22 17:13:04 +02:00
Bert Belder
25316a3f92 Make the gethostbyname benchmark more precise 2012-05-22 16:11:21 +02:00
Ben Noordhuis
a478847f74 test: add callback order test
Ensure that idle callbacks run before other callbacks.
2012-05-22 16:04:11 +02:00
Igor Zinkovsky
ea8fa31fc0 fix fs_symlink_dir test 2012-05-22 00:23:26 -07:00
Ben Noordhuis
7447048981 test: enable tcp_connect_error_fault test 2012-05-18 01:19:57 +02:00
Ben Noordhuis
538a562cdb test: add tcp connect timeout test 2012-05-18 01:19:56 +02:00
Igor Zinkovsky
60af28abab windows: support junctions with uv_fs_synlink
based on @piscisaureus implementation
2012-05-17 09:53:26 -07: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
ad024040fc test: prevent accidental division by zero 2012-05-07 16:41:05 +02:00
Bert Belder
ef9a9f1f78 Tests: make test-tcp-write-error pass on XP 2012-05-04 13:02:55 -07:00
Ben Noordhuis
5d19aa84f0 unix, win: rework uv_dlopen() API 2012-05-03 19:36:40 +02:00
Bert Belder
b9504f7987 Rename uv_platform_socket_t to uv_os_sock_t 2012-05-03 16:05:05 +02:00
Bert Belder
444ab19be8 Benchmarks: add size of uv_poll_t to benchmark-sizes 2012-05-03 15:52:57 +02:00
Bert Belder
beaf750700 Test: add tests for uv_poll 2012-05-03 15:52:57 +02:00
Erik Dubbelboer
623441685d test-spawn failed to build on linux
- added missing header file
- converted c++ style comment to c style comment
2012-04-28 23:57:59 +02:00
Bert Belder
bfd6d465c7 Test for the uv_spawn's setuid and setgid options 2012-04-28 02:39:18 +02:00
Ben Noordhuis
6c2a2aa250 test: don't assume unref'd timer cb runs 2012-04-18 02:54:57 +02:00
Ben Noordhuis
57ee146985 test: unlink UNIX socket before starting pipe echo server 2012-04-18 02:39:33 +02:00
Ben Noordhuis
976423c643 test: remove unused variable 2012-04-18 02:39:33 +02:00
Ben Noordhuis
f471f06322 test: clean up test-stdio-over-pipes 2012-04-18 02:39:30 +02:00
Ben Noordhuis
32948ab952 test: make variables static in test-gethostbyname.c 2012-04-18 02:36:56 +02:00
Ben Noordhuis
92ec798984 test: stop counter_init from failing when watch_dir exists 2012-04-18 02:36:43 +02:00
Bert Belder
20879c1cf2 test: fix a race condition in 'async' test 2012-04-18 01:28:26 +02:00
Ben Noordhuis
5345ee36f2 test: fix race conditions in test-async 2012-04-17 15:58:29 +02:00
Bert Belder
76364c26de Fix spawn_and_kill_with_std test 2012-04-13 01:59:24 +02:00
Bert Belder
4f0ff3c504 Disable ipc_send_recv_pipe test on Windows
It's not supported yet
2012-04-12 03:33:53 +02:00
Ben Noordhuis
4741a112ad test: disable fs_event_close_in_callback on kqueue-based systems 2012-04-12 02:33:14 +02:00
Bert Belder
2e5e1165ce Tests: don't use %zu placeholder in printf statements
It's not supported by msvcrt.
2012-04-11 22:54:02 +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
ed395e0619 unix: replace handle->next_watcher
Remove the next_watcher and replace it with a linked list. Said list is named
endgame_handles (because the uv-win calls it that) and contains all the handles
that are in the UV_CLOSING state.

The goal of this commit is two-fold:

a) remove a dependency on libev, and
b) share more code with uv-win in the future

A nice side effect is that it shaves a few bytes off a uv_handle_t.
2012-04-04 05:22:20 -07:00
Brian White
9d3c00046f test: ensure valid uptime value 2012-04-01 21:15:51 +02:00
Vladimir Dronnikov
b309f2e2e6 Add uv_is_closing()
Closes #367.
2012-04-01 21:05:50 +02:00
Igor Zinkovsky
70925c3bb9 windows: Enable passing of TCP connections over IPC 2012-03-29 18:18:46 -07:00
Bert Belder
6e0ca3aa8f Merge branch 'v0.6'
Conflicts:
	src/unix/linux/inotify.c
2012-03-27 23:46:23 +02:00
Bert Belder
aff078390f Test: verify that uv_close from an fs event callback works properly 2012-03-27 23:00:26 +02:00
Bert Belder
732cf91d6d Test: verify that no callbacks are made after closing an fs event watcher 2012-03-27 23:00:26 +02:00
Bert Belder
89303f365e Fs event tests: don't fail if a previously failed test left stray files 2012-03-27 23:00:25 +02:00
Bert Belder
7e8fe3ece7 test-fs-event.c: style 2012-03-27 23:00:25 +02:00
Ben Noordhuis
8ce8bfaa40 test: fix format string warnings 2012-03-21 06:26:10 -07:00
Ben Noordhuis
379ca428ef test: fix compiler warnings
* remove unused variables and functions
* replace %llu with %zu when printing size_t variables
2012-03-16 02:46:51 +01:00
Ben Noordhuis
c21184c103 test: make variables in benchmark-ares static 2012-03-16 00:48:06 +01:00
Ben Noordhuis
6031156602 test: silence compiler warning
main_proc is never read without having been initialized first but gcc 4.4.x
fails to infer that.
2012-03-15 16:09:06 +01:00
Ben Noordhuis
6dcce92d44 unix: replace C99/C++ comments, fix build 2012-03-15 01:09:16 +01:00
Ben Noordhuis
8c78cb40ff unix: replace C99/C++ comments, fix build 2012-03-09 09:15:43 -08:00
Ben Noordhuis
e190162975 test: test cross-process handle send/recv 2012-03-09 09:12:53 -08:00
Bert Belder
8ffad48818 Make the thread_create benchmark not time out 2012-03-09 17:53:48 +01:00
Bert Belder
0d6aa2a2e5 Windows: output newline before output from passed tests 2012-03-09 17:15:00 +01: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
3aa6069abf Windows test runner: show process name instead of test name
If a test failed we would previously see:

  Output from process `test_foo`: blah
  Output from process `test_foo`: (nothing)

This commit changes it to:

  Output from process `test_foo`: blah
  Output from process `foo_helper`: (nothing)
2012-03-09 16:31:14 +01:00
Bert Belder
50216706c2 Test runner: fix compiler warnings 2012-03-09 16:31:13 +01:00
Bert Belder
f285caf0b5 Test counters_init: fix compiler warnings 2012-03-09 16:31:13 +01:00
Bert Belder
aafa7db1d4 Test benchmark_pound: fix compilation problem 2012-03-09 16:31:12 +01:00
Bert Belder
abc4f56ff0 Test chown_root: make it pass on windows 2012-03-09 16:31:11 +01:00
Bert Belder
09a0d61e7b Test cwd_and_chdir: don't chdir to "" or "c:"
It should not strip the trailing (back)slash from a root directory.
2012-03-09 16:31:02 +01:00
Bert Belder
422a898a7f Tests: verify that shutdown_cb is always called 2012-03-09 05:00:11 +01:00
Bert Belder
fb65d74c84 Tests: verify that uv_write and uv_shutdown ref the event loop 2012-03-09 05:00:11 +01:00
Bert Belder
87752ac38b Fold trailing whitespace 2012-03-09 05:00:09 +01:00
Bert Belder
e53d7e3a11 Make test-tty pass with redirected stdio 2012-03-08 17:02:05 +01:00
Bert Belder
743cab9f9d Test runner: avoid process_wait failure when the test process didn't start 2012-03-08 16:44:30 +01:00
Brandon Philips
d07f2466d0 test: fs: add tests for read EOF
This fix was merged without tests:
https://github.com/philips/libuv/tree/fix-read-on-windows-to-handle-eof

So take tests from igorzi:
46024bf33d
2012-03-07 14:33:33 +01:00
Shigeki Ohtsu
b55801f225 win, unix: add uv_dlerror() and uv_dlerror_free() 2012-03-02 16:39:21 +01:00
Igor Zinkovsky
702f905f73 test: make pipe_connect_to_file succeed with ECONNREFUSED 2012-03-01 14:32:59 -08:00
Igor Zinkovsky
6bbccf1fe0 windows: return UV_ENOTSOCK when doing uv_pipe_connect to a file 2012-03-01 12:11:29 -08:00
Ben Noordhuis
ec0eff955e Revert b3e0ad4, 149d32c, e99fdf0 and ea9baef.
Detaching doesn't work yet, the setsid() call fails and leaves the child process
attached to the parent's session.

Revert "test: Add test case for spawning detached child processes."
Revert "win: Implement options.detached for uv_spawn() for Windows."
Revert "unix: Implement options.detached for uv_spawn() for unix."
Revert "Add "detached" member to uv_process_options_t to denote whether a child
        process should spawn detached from its parent."

This reverts commit ea9baef95c.
This reverts commit e99fdf0df6.
This reverts commit 149d32cb96.
This reverts commit b3e0ad4db8.
2012-02-28 15:29:05 +01:00
Charlie McConnell
ea9baef95c test: Add test case for spawning detached child processes. 2012-02-24 15:15:00 +01:00
Ben Noordhuis
4240f0d710 test: check uv_fs_*() return values 2012-02-23 05:43:21 -08:00
Ben Noordhuis
a5082e8271 test: add proper type casts 2012-02-23 05:42:45 -08:00
Bert Belder
1d942e2ad4 Merge branch 'v0.6' 2012-02-13 20:02:39 +01:00
Bert Belder
bc8b99097a win: add ERROR_FILENAME_EXCED_RANGE mapping, fix fs_file_nametoolong test 2012-02-13 20:01:36 +01:00
Ben Noordhuis
4e1f2b1f64 Merge remote-tracking branch 'origin/v0.6' 2012-02-12 16:10:05 +01:00
Ben Noordhuis
c5aa86bd39 Remove uv_import() and uv_export().
Not needed anymore now that support for isolates has been removed from Node.

This commit reverts the following commits:

  812e410 test: fix up stream import/export test
  e34dc13 unix: implement uv_import() and uv_export()
  d1a0e8e test: fix undefined macro error
  2ce0058 import/export streams accross loops
2012-02-12 15:49:54 +01:00
Igor Zinkovsky
f9be43a564 support half-duplex pipes 2012-02-09 13:33:15 -08:00
Igor Zinkovsky
53eb9935cb fix windows build 2012-02-09 13:15:37 -08:00
Roman Shtylman
9fa2cf2eac test: add multicast TTL test 2012-02-06 15:02:39 +01:00
Maciej Małecki
0596c59bc3 test: test if UV_ELOOP mapping works 2012-02-03 22:20:14 +01:00
Bert Belder
267e75dda2 Windows: better stat implementation 2012-02-02 17:03:40 +01:00
isaacs
243cfcd078 Merge remote-tracking branch 'ry/v0.6' 2012-01-31 18:00:59 -08:00
Brandon Philips
4cfda74de4 uv.h: add EPERM to errno map to fix regression
EPERM isn't mapped in so chown returns an unknown error. This is a
regression from 0.4.12.

philips:node/ (master*) $ cat chown.js
var fs = require('fs')
fs.chown("/tmp/foobar", 100, 100, function(er){ console.log(er);})

philips:node/ (master*) $ ls -la /tmp/foobar
total 0
drwxr-xr-x   2 root  wheel   68 Jan 24 17:21 .

0.4
---

philips:node/ (master*) $ /usr/local/Cellar/node/0.4.12/bin/node chown.js
{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: 'EPERM, Operation not permitted \'/tmp/foobar\'',
  errno: 1,
  code: 'EPERM',
  path: '/tmp/foobar' }

master
------

philips:node/ (master*) $ ./node chown.js
{ [Error: UNKNOWN, unknown error '/tmp/foobar'] errno: -1, code: 'UNKNOWN', path: '/tmp/foobar' }

AFTER
-----

philips:node/ (master*) $ ./node chown.js
{ [Error: EPERM, operation not permitted '/tmp/foobar'] errno: 49, code: 'EPERM', path: '/tmp/foobar' }
2012-01-31 16:37:26 -08:00
Bert Belder
8c8e6532bf test-multicast-join: don't attempt to bind to a multicast address
Does not work on Windows. Bind to a normal interface first, then join the
multicast group instead.
2012-01-31 17:29:21 +01:00
Ben Noordhuis
cd16ba5186 test: add UDP broadcast/multicast/ttl tests 2012-01-31 16:52:27 +01:00
Ben Noordhuis
812e410772 test: fix up stream import/export test 2012-01-30 21:45:04 +01:00
Ben Noordhuis
d1a0e8e7e2 test: fix undefined macro error 2012-01-30 21:44:27 +01:00
Igor Zinkovsky
2ce0058251 import/export streams accross loops 2012-01-30 21:44:27 +01:00
Ben Noordhuis
f9b478cfd8 test: add windows-only uv_fs_stat regression test 2012-01-28 16:52:46 +01:00
Ben Noordhuis
3de0411591 Merge remote-tracking branch 'origin/v0.6' 2012-01-27 22:23:26 +01:00
Ben Noordhuis
3f1bad2050 test: add missing return statement in fs_stat_root 2012-01-27 22:10:20 +01:00
Bert Belder
92b260c065 windows: fix stat("c:\\") regression 2012-01-27 22:09:55 +01:00
Bert Belder
f9252750e7 Fix windows build 2012-01-27 16:29:57 +01:00
Maciej Małecki
24e6c7ec86 unix: map ENAMETOOLONG to UV_ENAMETOOLONG
With tests. Closes #295
2012-01-23 19:33:09 +01:00
Ben Noordhuis
bf8ccfce18 unix: fix segfault in uv_guess_handle()
Fixes #293.
2012-01-17 17:47:33 +01:00
Ben Noordhuis
ac218a7ed5 test: add lots of refcount tests 2012-01-14 00:22:20 +01:00
Ben Noordhuis
dc3b80a50f test: add udp4_echo_server helper 2012-01-14 00:11:43 +01:00
Ben Noordhuis
38fc6ad839 unix: unref fs event watcher
Watchers were being ref-counted twice which wasn't harmful in itself but stopped
uv_unref() from working like you'd expect it to.
2012-01-02 10:42:27 +01:00
Igor Zinkovsky
43e3ac5798 windows: uv_fs_rename to replace the new file if it exists
fixes #283
2011-12-30 15:48:22 -08:00
Shigeki Ohtsu
ba52023ef3 Fix missing increments of loop->counters 2011-12-12 18:01:26 +01:00
Maciej Małecki
b06da4cbab test: make test runner return non-zero in case of failure 2011-12-12 02:08:28 +01:00
Igor Zinkovsky
dceb3e65ca uv_cwd + uv_chdir 2011-12-01 12:27:12 -08:00
Bruce Mitchener
d513d9bb41 Fix typos. 2011-11-30 14:35:13 +01:00
Ben Noordhuis
2bd181a8d2 unix: properly disarm kqueue fs watcher
Fixes "Assertion failed: (revents == EV_LIBUV_KQUEUE_HACK),
function uv__fs_event, file ../src/unix/kqueue.c, line 58."
2011-11-18 01:40:11 +01:00
Ben Noordhuis
d4bfcc28c8 bench: fix compiler warnings 2011-11-11 18:52:34 +01:00
Ben Noordhuis
e2a794e346 test: remove dead code 2011-11-11 18:52:04 +01:00
Igor Zinkovsky
f17d4837a8 windows: turn WSAECONNABORTED from WSARecv to UV_ECONNRESET 2011-11-09 14:57:41 -08:00
Tj Holowaychuk
a378110f9e Add UV_ESRCH
Fixes #239.
2011-11-08 16:36:20 -08:00
Igor Zinkovsky
f1859eb841 windows: convert WSAECONNABORTED to EOF 2011-11-07 16:53:27 -08:00
Ben Noordhuis
c468e2ab88 test: fix memory buffer comparison 2011-11-05 03:09:12 +01:00
Ben Noordhuis
9dc67f5e61 test: don't use _O_RDWR, windows-ism 2011-11-05 03:07:36 +01:00
Bert Belder
1997e10b50 Add flags to uv_fs_event_init 2011-11-05 01:42:08 +01:00
Igor Zinkovsky
faca1402ef make uv_pipe_connect return void 2011-11-04 16:06:53 -07:00
Igor Zinkovsky
fe97c4dc63 windows: honor O_APPEND in uv_fs_open 2011-11-04 12:41:23 -07:00
Ryan Dahl
681bd290e6 UV_EACCESS -> UV_EACCES
In order to match existing Node API. See
https://github.com/joyent/node/pull/2001
2011-11-03 16:17:12 -07:00
Ryan Dahl
0698e3f905 Fix UNIX pipe connect error reporting, add test 2011-11-03 15:47:43 -07:00
Igor Zinkovsky
0fb3769586 windows: don't emit fs-event callback after uv_fs_event handle is closed 2011-11-02 19:10:04 -07:00
Igor Zinkovsky
74b49e821b uv_kill 2011-11-02 14:34:07 -07:00
Igor Zinkovsky
9c6103a479 windows: add tests for uv_tcp_simultaneous_accepts 2011-11-01 01:13:13 -07:00
Igor Zinkovsky
314d0ee4f6 windows: don't fail uv_listen with UV_EALREADY if already listening. fixes #227. 2011-10-26 13:48:53 -07:00
Ben Noordhuis
339a1ad252 test: fix warning: implicit declaration of function ‘memcmp’ 2011-10-26 17:12:05 +02: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
Ben Noordhuis
ec825ffc62 unix: add TCP keepalive and no-delay control knobs 2011-10-21 16:08:26 -07:00
Ben Noordhuis
d396799210 Change return type of uv_get_*_memory() functions
... from double to uint64_t. Limit use of floating point in public API as much
as possible.
2011-10-21 10:09:59 -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
2216d38c29 windows: enable uv_fs_open to open directories 2011-10-12 10:42:41 -07:00
Ben Noordhuis
25a177a2e5 test: assert that readdir on file raises UV_ENOTDIR 2011-10-12 16:43:33 +02:00
Ben Noordhuis
e0a4e72640 sunos: look up free memory with sysconf(_SC_AVPHYS_PAGES) 2011-10-12 00:27:30 +00:00
Ben Noordhuis
7b01ad1685 test: don't assert that total_mem > free_mem
Assertion fails when running in a resource container, like a Solaris zone.
The total reported is the container's hard limit, the free memory that of
the whole system.
2011-10-11 23:49:02 +00:00
Ben Noordhuis
acc98ca922 test: uv_process_kill(proc, 0) should not kill the process 2011-10-11 21:36:54 +02:00
Roman Shtylman
a3d1f6fd6f add uv_udp_set_membership for unix multicast support
- test-udp-multicast-join tests that multicast packets can be received
- stub src/win/udp.c until support added
2011-10-11 21:25:20 +02:00
Ryan Dahl
5656e3c8bd Prepare for writable TTY to be blocking 2011-10-10 13:25:46 -07:00
Ben Noordhuis
41e8574920 unix: don't alloc memory for readdir on empty dir 2011-10-10 16:27:55 +02:00
Ben Noordhuis
04b356ab37 test: fix compiler warnings 2011-10-10 16:07:46 +02:00
Igor Zinkovsky
9f6024a6fa windows: fixes crash in pipe.c 2011-10-07 15:05:01 -07:00
Igor Zinkovsky
0364809fb5 fix fs_utime & fs_futime tests on windows 2011-10-06 16:25:59 -07:00
Ryan Dahl
60c639fd57 Merge branch 'ipc2' 2011-10-06 10:18:13 -07:00
Igor Zinkovsky
81c4043c83 ipc on windows 2011-10-06 10:17:42 -07:00
Ryan Dahl
c920db9fd1 unix: handle passing kind of working 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
27262134cd bench: add batched TCP writes benchmark
Times how long it takes to queue and write out 1,000,000 short strings.
2011-10-06 03:31:58 +02:00
Ben Noordhuis
c7870465aa error reporting: return sensible messages for synthetic errors 2011-10-06 01:17:46 +02:00
Erick Tryzelaar
e3f2631127 unix: bad connect addresses should error with EINVAL 2011-10-04 16:46:39 -07:00
Ben Noordhuis
8e9a3384c9 unix: implement kqueue file watcher API
kqueue fds are not embeddable into other pollsets (select, poll, kqueue).
Hack the libev event loop to receive kqueue events with filter flags intact.
2011-10-04 23:28:36 +02:00
Fedor Indutny
a35591bbfc os: implement loadavg (not working on cygwin/win) 2011-10-04 18:15:14 +02:00
Fedor Indutny
33cb8775bc os: implement memory bindings
* us_get_free_memory
* us_get_total_memory
2011-10-04 18:10:35 +02:00
Ben Noordhuis
6221904013 sunos: fix gyp build 2011-10-02 00:14:44 +00:00
Ryan Dahl
153d3c7c57 unix: allow tty raw mode to be turned off 2011-09-30 11:21:51 -07:00
Igor Zinkovsky
c9ae7a6f95 windows: don't strip the trailing slash from filename if it follows a device name 2011-09-28 12:59:39 -07:00
Igor Zinkovsky
4fb120f649 windows: fix error reporting for uv_fs_ functions 2011-09-28 12:46:37 -07:00
Bert Belder
1d3b880e2f Add uv_tty_t size to benchmark-sizes 2011-09-28 03:43:28 +02:00
Ben Noordhuis
517bfc8902 Merge branch 'v0.6' 2012-01-19 16:22:21 +01:00
Ben Noordhuis
dd7e6f0163 test: don't use malloc/free in test-timer 2012-01-18 19:00:55 +01:00
Ben Noordhuis
6ede034a7e test: #include missing <string.h> 2012-01-18 15:56:43 +01:00
Ben Noordhuis
1161d31aea test: move container_of() macro into task.h 2012-01-18 15:56:40 +01: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
52511b9ddc windows: implement uv_loop_new+uv_loop_delete 2012-01-16 17:07:49 -08:00
Igor Zinkovsky
f5bd21f181 conform to ANSI C 2012-01-16 13:52:45 -08:00
Ben Noordhuis
71f6c0edb8 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/win/util.c
2012-01-16 18:07:49 +01:00
Fedor Indutny
e7758e126f unix: remove eio_set_max_poll_reqs
* added test
2012-01-16 14:49:13 +01:00
Igor Zinkovsky
26512731e3 remove uv_thread_self 2012-01-13 17:24:30 -08:00
Ryan Dahl
51ea46de45 Merge remote branch 'origin/v0.6' 2012-01-09 11:31:13 -08:00
Ryan Dahl
4ad33e9748 Revert "Add uv_pipe_pair for communication between threads"
Not needed. We took a different approach for isolates.

This reverts commit 5cc6090fdf.
2012-01-09 11:22:46 -08:00
Ryan Dahl
5cc6090fdf Add uv_pipe_pair for communication between threads
This is only the Unix implementation and test.
2011-12-29 22:41:08 -08:00
Ben Noordhuis
d6a06b8689 test: eio callbacks should run in their owning threads 2011-12-22 03:42:54 +01:00
Ryan Dahl
a993329c02 add uv_thread_self 2011-12-20 11:34:18 -08:00
Igor Zinkovsky
3d189de699 platform api 2011-12-14 17:50:36 -08:00
mattn
e53cecb8c0 add uv_run_once() 2011-12-14 14:28:35 +01:00
Ben Noordhuis
4c6008f488 Merge branch 'v0.6'
Conflicts:
	test/test-list.h
2011-12-12 18:04:17 +01:00
Ben Noordhuis
bfd51ca022 Merge branch 'v0.6' 2011-12-12 02:15:45 +01:00
Ben Noordhuis
f5c2a4a1ae Merge branch 'v0.6'
Conflicts:
	src/unix/core.c
	src/win/winapi.h
2011-12-02 18:15:04 +01:00
seebees
59f9a736b1 test: process should not wait for stdio before terminating 2011-11-23 17:34:18 +01:00
Ben Noordhuis
b52b8c7128 util: add uv_strlcpy() and uv_strlcat() functions 2011-11-23 17:29:02 +01:00
Ben Noordhuis
45180fea27 bench: add thread creation benchmark 2011-11-21 21:27:36 +01:00
Ben Noordhuis
8e4ed88bbe Wrap platform thread APIs. 2011-11-21 21:04:16 +01:00
Ben Noordhuis
5728bd4549 test: touching a file should generate only one fs event 2011-11-21 18:01:01 +00:00
Ben Noordhuis
1fc1f28093 Wrap platform mutex and rwlock APIs.
Read/write locks are emulated with critical sections on Windows XP and Vista
because those platforms don't have a (complete) native read/write lock API.
2011-11-18 12:42:08 +01:00
Ben Noordhuis
1e0aab06c9 unix: properly disarm kqueue fs watcher
Fixes "Assertion failed: (revents == EV_LIBUV_KQUEUE_HACK),
function uv__fs_event, file ../src/unix/kqueue.c, line 58."
2011-11-18 01:39:30 +01:00
Ryan Dahl
2ebb2272c3 Add tcp reference count tests 2011-09-26 22:51:08 -07:00
Ryan Dahl
3e5aa06c49 Add two timer ref count tests 2011-09-26 22:01:21 -07:00
Igor Zinkovsky
f6a365ed91 fix tcp_write_error for windows 2011-09-26 14:39:02 -07:00
Ryan Dahl
03d0c57ea2 Remove uv_is_tty. Use uv_guess_handle instead. 2011-09-23 10:01:45 -07:00
Erick Tryzelaar
7e8645d101 unix,win: Make uv_freeaddrinfo to clean up addrinfo
Fixes #196
2011-09-23 09:31:01 -07:00
Ryan Dahl
03652596cf unix: add uv_guess_handle and uv_tty_get_winsize 2011-09-22 19:35:46 -07:00
Ben Noordhuis
2a1c32a60c linux: implement file watcher API 2011-09-21 13:23:49 -07:00
Igor Zinkovsky
1e0757ffda windows: file watcher 2011-09-21 13:13:34 -07:00
Ben Noordhuis
2dae0c9e49 test: remove futimes sub-second precision checks, unreliable on freebsd 2011-08-17 07:02:00 +02:00
Ryan Dahl
c1374ba587 Add uv_is_tty() 2011-09-20 11:48:47 -07:00
Erick Tryzelaar
70e1032094 unix: Fix uv_getaddrinfo from deleting invalid data
If the uv_getaddrinfo_t handle is owned by its
data pointer, deleting the data in the callback
could cause uv_getaddrinfo_done to call freeaddrinfo
on an invalid pointer.
2011-09-19 17:11:34 +02:00
Ben Noordhuis
4487531b06 test: check that write_queue_size updates after write error 2011-09-16 16:17:23 -07:00
Ryan Dahl
f00a5e6503 ignore SIGPIPE in tests 2011-09-16 15:36:35 -07:00
Erick Tryzelaar
533418d4da test and bench: assert return values of *_init functions in tests 2011-09-15 22:33:48 +02:00
Erick Tryzelaar
970018156f test: fix compiling with gcc-4.5 2011-09-15 22:33:22 +02:00
Igor Zinkovsky
2931bdcf54 windows: strip '\??\' from readlink path buffer. 2011-09-14 12:58:18 -07:00
Igor Zinkovsky
65c8a727a3 uv_fs_ functions to return result in sync mode 2011-09-14 11:47:49 -07:00
Ben Noordhuis
3c96410902 unix: bring back uv__stream_destroy()
This is the revised version of reverted commit 431195c.
2011-09-14 04:48:56 +02:00
Bert Belder
0dc564a2aa Remove uv_init calls from tests and benchmarks 2011-09-12 11:32:41 -07:00
Erick Tryzelaar
efa1b54076 Subclass uv_getaddrinfo_t from uv_req_t.
This patch also fixes #155. Since we no longer
memset clear the uv_getaddrinfo_t, the user can
now set the `uv_getaddrinfo_t->data` field without
problems.
2011-09-10 01:46:26 -07:00
Ben Noordhuis
ca5346f9ce unix: revert 98b9f58 and 431195c for now, corrupts memory 2011-09-09 23:40:10 +02:00
Igor Zinkovsky
cfa1423f96 fix fs_file_noent on windows 2011-09-08 18:23:19 -07:00
Bert Belder
2d1c672e2d More MinGW fixes 2011-09-08 23:49:46 +02:00
Erick Tryzelaar
1a43429774 Fix test-fs.c for darwin. 2011-09-08 14:22:08 -07:00
Erick Tryzelaar
f4e2d5559f Fix test-get-currentexe on darwin.
Darwin uses _NSGetExecutablePath to determine
the path of an executable, but that can return
an absolute path. This patch tweaks the executable
path to strip off a potential "./" prefix from
argv[0], which fixes the test.
2011-09-08 14:20:06 -07:00
Ben Noordhuis
98b9f582f4 test: make sure that write callbacks run when handle is closed 2011-09-08 19:13:39 +02:00
Ben Noordhuis
90ea007f61 test: fix compiler warnings for test-spawn.c 2011-09-08 00:15:47 +02:00
Ben Noordhuis
5641503ae7 test: fix compiler warnings for test-fs.c
Include <unistd.h> on Unices, fixes warnings about unlink() not being declared.
2011-09-08 00:15:07 +02:00
Ben Noordhuis
4d7cfe4313 test: remove stale prototype declaration 2011-09-08 00:00:18 +02:00
Ben Noordhuis
e8ab5cbe70 test: fix utime and futime tests on windows 2011-09-06 03:48:09 +02:00
Ben Noordhuis
79d9f81881 unix: implement uv_fs_futime, add tests for uv_fs_utime and uv_fs_futime 2011-09-06 02:52:52 +02:00
Ben Noordhuis
b7d88070d8 fs: add UV_ENOENT error code, add test 2011-09-06 00:17:59 +02:00
Igor Zinkovsky
a8017fd8a2 windows: update uv_fs_* functions to work with req.path 2011-09-04 23:58:31 -07:00
Ryan Dahl
a18860aec6 Add uv_fs_t.path on unix and tests
Windows implementation missing https://github.com/joyent/libuv/issues/177
2011-09-04 18:05:11 -07:00
Ryan Dahl
7ccc7470e0 Add test for uv_fs_readdir sync 2011-09-04 16:54:27 -07:00
Ryan Dahl
142a70292b unix: fix fs_chmod 2011-09-04 16:09:45 -07:00
Ben Noordhuis
826db45343 test: fix uv_fs_readdir test
Don't make assumptions about the order in which the
directory entries are returned by the file system.
2011-09-05 00:57:23 +02:00
Peter Bright
7db243dc6f Bring inline with node common.gypi.
Win32 readlink()
2011-09-04 13:24:45 -07:00
Igor Zinkovsky
060026ced3 windows: uv_fs_link + uv_fs_symlink 2011-09-04 13:24:35 -07:00
Bert Belder
12b01e95f9 Specialize uv_xxx_getsockname, add uv_tcp_getpeername 2011-09-04 04:49:13 +02:00
Igor Zinkovsky
cf5ed86a79 windows: implement missing fs functions 2011-09-03 12:23:27 -07:00
Ryan Dahl
9f932f92cf add test fs_chmod, implement uv_fs_fchmod and uv_fs_chmod on unix 2011-09-01 15:36:01 -07:00
Ryan Dahl
2e6035895c Add test for uv_fs_fstat, implement on unix. 2011-09-01 14:15:06 -07:00
Igor Zinkovsky
22197ebf3f windows: include _stat struct into uv_fs_t 2011-09-01 11:54:43 -07:00
Ryan Dahl
836cc204b6 unix: Fix test-gethostbyname 2011-08-31 15:37:16 -07:00
Bert Belder
b44ecf9929 multiplicity: update benchmarks 2011-08-31 05:18:48 +02:00
Bert Belder
8e3a8602ad update tests for multiplicity 2011-08-31 04:19:26 +02:00
Bert Belder
3aec77f9d4 bring back uv_init 2011-08-31 04:19:07 +02:00
Ryan Dahl
56dcaf9b06 unix: multiplicity 2011-08-31 04:18:55 +02:00
Ryan Dahl
a6ed1757ab unix: implement uv_fs_lstat 2011-08-30 01:32:53 -07:00
Ryan Dahl
d20233c7a8 Fix long lines 2011-08-30 00:54:59 -07:00
Ryan Dahl
894c005c42 unix: fix fs_async_sendfile 2011-08-30 00:52:43 -07:00
Ryan Dahl
0e81406bfb unix fs_async_dir works 2011-08-29 22:08:51 -07:00
Ryan Dahl
cf08c168ea Use Windows compatibile flags 2011-08-29 20:50:12 -07:00
Ryan Dahl
5d524fff1a unix passes test fs_file_async 2011-08-29 20:41:45 -07:00
Ryan Dahl
7cad73aa47 Fix build for UNIX 2011-08-26 11:26:24 -07:00
Igor Zinkovsky
25175c7071 uv_fs & uv_work APIs 2011-08-26 11:00:53 -07:00
Ben Noordhuis
738e2da0c1 test: add udp getsockname test 2011-08-25 02:55:49 +02:00
Bert Belder
36c9b791d4 Fix bugs in test-udp-send-and-recv and benchmark-udp-packet-storm 2011-08-24 05:24:07 +02:00
Ben Noordhuis
36ce74f2ca Add UDP support to libuv. 2011-08-24 04:55:01 +02:00
Ben Noordhuis
52024061e4 Make uv_getsockname() operate on uv_handle_t handles. 2011-08-24 04:17:36 +02:00
Bert Belder
cc0b0e6238 Remove trailing whitespace 2011-08-21 21:46:05 +02:00
Ryan Dahl
123119342f pound: only display connect errors on DEBUG 2011-08-18 15:31:54 -07:00
Igor Zinkovsky
f6c25a17ea Fix pipe-pound and clean-up 2011-08-18 15:30:34 -07:00
Ryan Dahl
ac1ce29ad0 Improve pound benchmark by reconnecting in close_cb 2011-08-18 15:30:34 -07:00
Ryan Dahl
e5a938f1f4 Add uv_buf_init() constructor 2011-08-17 17:43:19 -07:00
Jeroen Janssen
507c4ccea6 fixes for unsigned/signed comparison 2011-08-17 13:58:55 +02:00
Igor Zinkovsky
23e9ecb667 fix memory leak in echo server 2011-08-11 18:19:59 -07:00
Bert Belder
2d40e35b7e Style 2011-08-12 02:43:59 +02:00
Ben Noordhuis
d358738954 bench: #undef NANOSEC, defined in time.h on solaris 2011-08-11 23:43:52 +00:00
Peter Bright
3409c9b383 Include important Windows environmental variables even when a blank/custom environment is specified. 2011-08-09 14:29:51 -07:00
Ben Noordhuis
3f8bbb8c0f bench: create separate arrays for TCP and pipe streams
Size and alignment of tcp_conn_rec and pipe_conn_rec may differ
so it's not safe to reuse a single array of conn_rec elements.
2011-08-09 20:02:59 +02:00
Ben Noordhuis
65ed582cae bench: run pound benchmark for at least 5 seconds, track connect failures 2011-08-09 03:16:29 +02:00
Ben Noordhuis
cee3cc6940 bench: use high-res timer in pound benchmark 2011-08-09 01:51:25 +02:00
Igor Zinkovsky
f9eda88fe6 fix for pound benchmark 2011-08-08 15:09:14 -07:00
Ben Noordhuis
7dda111306 test, bench: add --list option to runners, prints available tests 2011-08-06 23:57:28 +02:00
Igor Zinkovsky
a706a66d81 accept benchmark 2011-08-05 18:20:06 -07:00
Peter Bright
d84b249616 Support for unescaped arguments, suitable for use with cmd /c.
Robust argument escaping that hopefully matches Windows' algorithm for unescaping.
2011-08-04 18:22:47 -07:00
Igor Zinkovsky
6d940a3afc windows: remove dependency on rpcrt4 and ole32 libs. fixes https://github.com/joyent/libuv/issues/118 2011-08-01 20:10:55 -07:00
Igor Zinkovsky
c35548a69e fix spawn_and_kill test on windows 2011-08-01 16:50:59 -07:00
Ben Noordhuis
aa37c698ee test: add platform-specific checks for kill-after-spawn test 2011-08-02 00:46:44 +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
Ryan Dahl
e9bee5131a add spawn benchmark 2011-07-30 22:45:03 -07:00
Igor Zinkovsky
3e6611a693 more output 2011-07-29 23:54:52 -07:00
Igor Zinkovsky
d272a2183d Windows: spawn child processes 2011-07-29 19:02:51 -07:00
Ryan Dahl
7108ca8853 uv_spawn requires stdio pipes to be initialized 2011-07-29 15:37:00 -07:00
Ben Noordhuis
78e94e9589 bench: remove unused locals from benchmark-pump.c 2011-07-29 21:07:09 +02:00
Ben Noordhuis
eed6f395d1 pipe: uv_pipe_listen raises UV_EINVAL on unbound socket 2011-07-29 04:22:59 +02: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
Igor Zinkovsky
e7497227bd merge uv_tcp_listen and uv_pipe_listen into uv_listen 2011-07-22 16:57:09 -07:00
Ben Noordhuis
27999e839a test: update BAD_PIPENAME for Unices, check for UV_EACCESS 2011-07-21 19:48:42 +02:00
Ben Noordhuis
7fbe0c3882 test: run-tests helper_name runs helper in same process
Fixes #116.
2011-07-21 19:02:19 +02:00
Bert Belder
1ab28df433 Test that loop refs going down to zero in a prepare callback does not hang the event loop 2011-07-21 14:53:40 +02:00
Bert Belder
9d8c9cce7c Move loop reference tests to their own file 2011-07-21 14:51:56 +02:00
Bert Belder
5f12c30f73 Correct idle_starvation test 2011-07-21 03:28:40 +02:00
Bert Belder
d9612fe0e7 More changes related to uv_close returning void 2011-07-21 03:27:43 +02:00
Ryan Dahl
b931c9313f uv_close returns void 2011-07-20 18:03:48 -07:00
Bert Belder
f0c20aa913 Test: active idle watcher should not block other events 2011-07-21 02:53:27 +02:00
Igor Zinkovsky
afc998759f Add uv_pipe_bind tests 2011-07-21 02:25:10 +02:00
Ryan Dahl
685c083c79 Only sleep on 'make bench' not on 'make test' 2011-07-20 12:18:07 -07:00
Ryan Dahl
b13a446d6c Test for sync tcp and pipe connections 2011-07-20 12:14:21 -07:00
Ben Noordhuis
eb5e00fd1b runner: give helpers a chance to clean up after the test.
Fixes #50.
2011-07-20 21:13:00 +02:00
Ben Noordhuis
6c8acb0ed1 task: flush stderr after printing 2011-07-20 21:00:59 +02:00
Ryan Dahl
b38ba04698 Fix benchmark output for ares and getaddrinfo 2011-07-20 11:53:09 -07:00
Ryan Dahl
abf854597b Don't output progress in 'make bench'
Fixes #115.
2011-07-20 11:44:10 -07:00
Ryan Dahl
a24d6e4bd8 new uv_req_t sizes in benchmark-sizes 2011-07-19 09:35:09 -07:00
Bert Belder
3d2d97dbae Make test-hrtime a little better 2011-07-19 15:01:11 +02:00
Bert Belder
96f2ef6bc6 Make test-getsockname compile with msvc 2011-07-19 15:01:10 +02:00
Ben Noordhuis
c2ad51e39f test-bind-error: fix 'control reaches end of non-void function' 2011-07-19 13:51:31 +02:00
Ryan Dahl
d4563a197a Allow and test for lazy uv_tcp_listen 2011-07-19 02:40:54 -07:00
Ryan Dahl
07b49ce59a add uv_ip4_name and uv_ip6_name 2011-07-18 17:39:04 -07:00
Ben Noordhuis
4eff34da43 uv-unix: pipes API implementation
Based on UNIX sockets to avoid the vagaries of FIFOs
in asynchronous mode. Currently unlinks stale sockets
before binding and cleans them up again after shutdown.
2011-07-19 00:58:02 +02:00
Igor Zinkovsky
4d31f838b0 Windows: handle ERROR_PIPE_BUSY in uv_pipe_connect 2011-07-18 13:02:32 -07:00
Bert Belder
902dd567b1 Benchmarks use the improved request api 2011-07-14 10:46:34 -07:00
Bert Belder
0ea4c87f8b Windows implementation of new request API
This changes uv-win to use the new uv_req subclasses.

It gets rid of the uv_req.flags field. There used to be only request flag
(UV_REQ_PENDING), and it was mostly obsolete; it only had a real purpose for
internal uv_read requests. Now we'll use the UV_HANDLE_READ_PENDING flag on
the handle instead.

This patch also simplifies the accept logic for named pipes on windows. We
no longer have a separate struct to store information about established
connections. Instead we just carry over the windows HANDLE from the accept
request to the client handle in uv_pipe_accept().
2011-07-14 10:46:08 -07:00
Ryan Dahl
abe0b1ea61 Better request API
Instead of uv_shutdown, uv_write, uv_connect taking raw uv_req_t we subclass
uv_req_t into uv_shutdown_t, uv_write_t, and uv_connect_t.

uv_req_init is removed.
2011-07-14 10:45:28 -07:00
Igor Zinkovsky
f5ff869488 allocate windows pipe handles on demand 2011-07-13 20:43:10 -07:00
Ben Noordhuis
9aff11026b runner: bring back benchmark output 2011-07-14 03:33:56 +02:00
Bert Belder
4c2d0545fc Whitespace fixes 2011-07-14 03:00:21 +02:00
Ben Noordhuis
a29b2099ac Make it possible to run individual tests.
Fixes #100.
2011-07-14 02:19:36 +02:00
Ben Noordhuis
9c19391536 test-ping-pong: cast callback to expected prototype. 2011-07-13 18:06:05 +02:00
Ben Noordhuis
afc96b58c8 test-delayed-accept.c: fix type mismatch in comparison. 2011-07-13 18:06:05 +02:00
Ben Noordhuis
1a53b89847 test-hrtime: fix printf() compiler warning. 2011-07-13 18:06:05 +02:00
Ben Noordhuis
0ebd2ce02d test-delayed-accept: remove unused variable. 2011-07-13 18:06:05 +02:00
Ben Noordhuis
d7389e6f89 test-async: remove unused variable. 2011-07-13 18:06:05 +02:00
Ben Noordhuis
4829ad5d04 test-getsockname: fix function prototype, clean up unused variable. 2011-07-13 18:06:05 +02:00
Bert Belder
036d5db16f test-getsockname: minor cleanups 2011-07-13 16:39:54 +02:00
Henry Rawas
6a67b51b4c fix uv_getsockname for listening socket 2011-07-12 22:43:43 +02:00
Henry Rawas
6b32ebc54f uv_getsockname 2011-07-12 09:57:08 -07:00
Igor Zinkovsky
2e49cc56d1 Rename uv_pipe_create to uv_pipe_bind.
Fixes issue #97.
2011-07-11 15:24:35 -07:00
Igor Zinkovsky
b6a6dae34f Named pipes implementation for Windows 2011-07-09 21:41:04 +02:00
Robert Mustacchi
8c00b369b4 C99 compatibility.
Get 99% of the way there for --std=c89 -pedantic for core files. Also cleans
up follow up warnings and others in tests.
2011-07-07 21:39:08 -07:00
Ben Noordhuis
1717d42165 read() and write() return ssize_t, not size_t.
rv < 0 error checks were always false.
2011-07-08 00:40:13 +02:00
Ryan Dahl
ce8ff3031c src/ and include/ directories
Helps #71 but does not update the MSVC files.
2011-07-07 07:52:57 -07:00
Henry Rawas
a4b05abce6 optional IPv6 for echo-server 2011-07-06 17:07:37 -07:00
Ben Noordhuis
9a5b47d915 uv_sleep() takes milliseconds, usleep() microseconds. Convert argument. 2011-07-06 13:53:01 -07:00
Henry Rawas
26880b0c90 win: IPv6 connect 2011-07-05 09:45:57 -07:00
Ben Noordhuis
09bd08ed97 Assert that uv_hrtime() actually sleeps for several microseconds. 2011-07-01 12:28:24 -04:00
Igor Zinkovsky
320057d588 uv_stream_t 2011-07-01 05:28:02 -07:00
Ryan Dahl
5b7cfe4bd4 unbreak 'make bench' 2011-06-28 21:11:33 +02:00
Ryan Dahl
796621c773 Implement c-ares on unix. 2011-06-28 21:08:17 +02:00
Ryan Dahl
fa514948fc Move around uv_hrtime in the header 2011-06-28 14:30:10 +02:00
Ryan Dahl
7b56134f73 Rename uv_get_hrtime, uv_get_exepath to uv_hrtime, uv_exepath 2011-06-28 14:26:28 +02:00
Matt Stevens
caf1a99115 IPv6 support
Fixes #70.
Fixes #19.
2011-06-28 14:11:21 +02:00
Bert Belder
8801925b41 Un-break the unix build 2011-06-25 17:47:46 +02:00
Bert Belder
21969b7a6f benchmark-getaddrinfo: resolve more, use less concurrency 2011-06-25 17:47:39 +02:00
Bert Belder
16f471fa2e Separate uv_getaddrinfo tests 2011-06-25 17:47:39 +02:00
Bert Belder
f04abc966a Avoid type warnings in benchmark-sizes 2011-06-25 17:47:33 +02:00