diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-02-02 17:39:47 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-02-02 17:39:47 -0800 |
| commit | c485301d210872c38fe840c58d27d97c4e97d7a5 (patch) | |
| tree | 855b61543430b2488e4284e11f2ce83d971e1d49 /src | |
| parent | 6784b18303741ff7713950957f7250616d31aeab (diff) | |
| download | rust-c485301d210872c38fe840c58d27d97c4e97d7a5.tar.gz rust-c485301d210872c38fe840c58d27d97c4e97d7a5.zip | |
Update libuv.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/etc/gyp-uv | 52 | ||||
| -rw-r--r-- | src/etc/x86.supp | 11 | ||||
| -rw-r--r-- | src/libstd/uv.rs | 78 | ||||
| -rw-r--r-- | src/libstd/uvtmp.rs | 130 | ||||
| m--------- | src/libuv | 0 |
5 files changed, 127 insertions, 144 deletions
diff --git a/src/etc/gyp-uv b/src/etc/gyp-uv index 3e91401d189..e64ed4f3059 100755 --- a/src/etc/gyp-uv +++ b/src/etc/gyp-uv @@ -2,55 +2,61 @@ # This script generates rust compatible makefiles from libuv. When upgrading # libuv, do: +# # cd $RUST_DIR -# rm -r mk/libuv -# cd $LIBUV_DIR -# git archive --prefix libuv/ $REVISION > libuv.tar.gz -# cd $RUST_DIR/src/rt -# rm -r libuv -# tar -xvf $LIBUV_DIR/libuv.tar.gz -# mkdir -p libuv/build -# svn co http://gyp.googlecode.com/svn/trunk libuv/build/gyp +# cd src/libuv +# git checkout master +# git pull +# svn co http://gyp.googlecode.com/svn/trunk build/gyp # cd ../.. -# ./src/etc/gyp_uv +# rm -r mk/libuv +# ./src/etc/gyp-uv +# +# Note: you must not run gyp on windows. It will get the backslashes +# incorrect in its rules, and not work. set -e cd `dirname $0` cd ../.. +GYPFILE=src/libuv/uv.gyp +INCLUDES="-I src/libuv/common.gypi" + for ARCH in ia32 x86_64 do - args="--depth . -Dlibrary=static_library -Dtarget_arch=$ARCH" + ARGS="$GYPFILE \ + $INCLUDES \ + --depth . \ + -Dcomponent=static_library \ + -Dlibrary=static_library \ + -Dtarget_arch=$ARCH" - ./src/libuv/build/gyp/gyp src/libuv/uv.gyp $args \ + ./src/libuv/build/gyp/gyp $ARGS \ -f make-mac \ --generator-output mk/libuv/$ARCH/mac \ -DOS=mac - ./src/libuv/build/gyp/gyp src/libuv/uv.gyp $args \ + ./src/libuv/build/gyp/gyp $ARGS \ -f make-linux \ --generator-output mk/libuv/$ARCH/unix \ -DOS=linux - ./src/libuv/build/gyp/gyp src/libuv/uv.gyp $args \ + ./src/libuv/build/gyp/gyp $ARGS \ -f make-linux \ --generator-output mk/libuv/$ARCH/win \ -DOS=win - # Comment out the gyp auto regeneration - for os in mac unix win; do - sed -i \ - -e 's/^\(Makefile: $(srcdir)\/src\/rt\/libuv\/uv\.gyp\)/#\1/' \ - mk/libuv/$ARCH/$os/Makefile - - sed -i \ - -e 's/^\( $(call do_cmd,regen_makefile)\)/#\1/' \ - mk/libuv/$ARCH/$os/Makefile - done done # On Mac, GYP hardcodes a -arch i386 into the output. Fix that. sed -i \ -e 's/-arch i386/-arch x86_64/' \ mk/libuv/x86_64/mac/src/libuv/*.mk + +MKFILES=$(find mk/libuv -name \*.mk -o -name Makefile) + +# Comment out the gyp auto regeneration +perl -i -p -e 's@^(Makefile:.*)@#\1@go' $MKFILES +perl -i -p -e 's@^(Makefile:.*)@#\1@go' $MKFILES +perl -i -p -e 's@(.*regen_makefile.*)@#\1@go' $MKFILES diff --git a/src/etc/x86.supp b/src/etc/x86.supp index 7c9e611c9c1..7748f8f3261 100644 --- a/src/etc/x86.supp +++ b/src/etc/x86.supp @@ -369,11 +369,7 @@ libuv-0-byte-realloc1 Memcheck:Leak fun:malloc - fun:realloc - fun:ev_realloc_emul - fun:ev_realloc - fun:epoll_destroy - fun:ev_loop_destroy + ... fun:uv_loop_delete } @@ -381,9 +377,6 @@ libuv-0-byte-realloc2 Memcheck:Leak fun:malloc - fun:realloc - fun:ev_realloc_emul - fun:ev_realloc - fun:ev_loop_destroy + ... fun:uv_loop_delete } diff --git a/src/libstd/uv.rs b/src/libstd/uv.rs index d04331e00b3..27f2a3c54a8 100644 --- a/src/libstd/uv.rs +++ b/src/libstd/uv.rs @@ -107,7 +107,7 @@ fn unref(loop: *loop_t) { fn sanity_check() { fn check_size(t: str, uv: ctypes::size_t, rust: ctypes::size_t) { #debug("size of %s: uv: %u, rust: %u", t, uv, rust); - assert uv == rust; + assert uv <= rust; } check_size("idle_t", helpers::rust_uv_size_of_idle_t(), @@ -144,53 +144,45 @@ fn idle_new() -> idle_t { } } -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "freebsd")] -// FIXME: We're out of date on libuv and not testing -// it on windows presently. This needs to change. -mod os { +#[cfg(test)] +mod tests { - #[cfg(test)] - mod tests { + #[test] + fn test_sanity_check() { + sanity_check(); + } + + // From test-ref.c + mod test_ref { + + #[test] + fn ref() { + let loop = loop_new(); + run(loop); + loop_delete(loop); + } #[test] - fn test_sanity_check() { - sanity_check(); + fn idle_ref() { + let loop = loop_new(); + let h = idle_new(); + idle_init(loop, ptr::addr_of(h)); + idle_start(ptr::addr_of(h), ptr::null()); + unref(loop); + run(loop); + loop_delete(loop); } - // From test-ref.c - mod test_ref { - - #[test] - fn ref() { - let loop = loop_new(); - run(loop); - loop_delete(loop); - } - - #[test] - fn idle_ref() { - let loop = loop_new(); - let h = idle_new(); - idle_init(loop, ptr::addr_of(h)); - idle_start(ptr::addr_of(h), ptr::null()); - unref(loop); - run(loop); - loop_delete(loop); - } - - #[test] - fn async_ref() { - /* - let loop = loop_new(); - let h = async_new(); - async_init(loop, ptr::addr_of(h), ptr::null()); - unref(loop); - run(loop); - loop_delete(loop); - */ - } + #[test] + fn async_ref() { + /* + let loop = loop_new(); + let h = async_new(); + async_init(loop, ptr::addr_of(h), ptr::null()); + unref(loop); + run(loop); + loop_delete(loop); + */ } } } diff --git a/src/libstd/uvtmp.rs b/src/libstd/uvtmp.rs index e7de8ec1dc8..d18a59031ea 100644 --- a/src/libstd/uvtmp.rs +++ b/src/libstd/uvtmp.rs @@ -95,82 +95,74 @@ fn get_req_id(cd: connect_data) -> u32 { ret rustrt::rust_uvtmp_get_req_id(cd); } -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "freebsd")] -// FIXME: We're out of date on libuv and not testing -// it on windows presently. This needs to change. -mod os { - - #[test] - fn test_start_stop() { - let thread = create_thread(); - start_thread(thread); - join_thread(thread); - delete_thread(thread); - } +#[test] +fn test_start_stop() { + let thread = create_thread(); + start_thread(thread); + join_thread(thread); + delete_thread(thread); +} - #[test] - #[ignore] - fn test_connect() { - let thread = create_thread(); - start_thread(thread); - let port = comm::port(); - let chan = comm::chan(port); - connect(thread, 0u32, "74.125.224.146", chan); - alt comm::recv(port) { - connected(cd) { - close_connection(thread, 0u32); - } - _ { fail "test_connect: port isn't connected"; } - } - join_thread(thread); - delete_thread(thread); +#[test] +#[ignore] +fn test_connect() { + let thread = create_thread(); + start_thread(thread); + let port = comm::port(); + let chan = comm::chan(port); + connect(thread, 0u32, "74.125.224.146", chan); + alt comm::recv(port) { + connected(cd) { + close_connection(thread, 0u32); + } + _ { fail "test_connect: port isn't connected"; } } + join_thread(thread); + delete_thread(thread); +} - #[test] - #[ignore] - fn test_http() { - let thread = create_thread(); - start_thread(thread); - let port = comm::port(); - let chan = comm::chan(port); - connect(thread, 0u32, "74.125.224.146", chan); +#[test] +#[ignore] +fn test_http() { + let thread = create_thread(); + start_thread(thread); + let port = comm::port(); + let chan = comm::chan(port); + connect(thread, 0u32, "74.125.224.146", chan); + alt comm::recv(port) { + connected(cd) { + write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan); alt comm::recv(port) { - connected(cd) { - write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan); - alt comm::recv(port) { - wrote(cd) { - read_start(thread, 0u32, chan); - let keep_going = true; - while keep_going { - alt comm::recv(port) { - read(_, buf, -1) { - keep_going = false; - delete_buf(buf); - } - read(_, buf, len) { - unsafe { - log(error, len); - let buf = vec::unsafe::from_buf(buf, - len as uint); - let str = str::from_bytes(buf); - #error("read something"); - io::println(str); - } - delete_buf(buf); - } - _ { fail "test_http: protocol error"; } + wrote(cd) { + read_start(thread, 0u32, chan); + let keep_going = true; + while keep_going { + alt comm::recv(port) { + read(_, buf, -1) { + keep_going = false; + delete_buf(buf); + } + read(_, buf, len) { + unsafe { + log(error, len); + let buf = vec::unsafe::from_buf(buf, + len as uint); + let str = str::from_bytes(buf); + #error("read something"); + io::println(str); } + delete_buf(buf); + } + _ { fail "test_http: protocol error"; } } - close_connection(thread, 0u32); - } - _ { fail "test_http: expected `wrote`"; } } + close_connection(thread, 0u32); } - _ { fail "test_http: port not connected"; } + _ { fail "test_http: expected `wrote`"; } } - join_thread(thread); - delete_thread(thread); + } + _ { fail "test_http: port not connected"; } } -} \ No newline at end of file + join_thread(thread); + delete_thread(thread); +} diff --git a/src/libuv b/src/libuv -Subproject f1859eb841be2fe48512bc10e64556383f408b0 +Subproject 1170ffba3ac5191930b40c897d4569a9d8a296a |
