Update libuv.
This commit is contained in:
parent
6784b18303
commit
c485301d21
49 changed files with 1406 additions and 3643 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 test_sanity_check() {
|
||||
sanity_check();
|
||||
fn ref() {
|
||||
let loop = loop_new();
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
}
|
||||
|
||||
// From test-ref.c
|
||||
mod test_ref {
|
||||
#[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 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);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
#[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) {
|
||||
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_connect: port isn't connected"; }
|
||||
_ { fail "test_http: expected `wrote`"; }
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
_ { fail "test_http: port not connected"; }
|
||||
}
|
||||
|
||||
#[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) {
|
||||
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`"; }
|
||||
}
|
||||
}
|
||||
_ { fail "test_http: port not connected"; }
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f1859eb841be2fe48512bc10e64556383f408b01
|
||||
Subproject commit 1170ffba3ac5191930b40c897d4569a9d8a296a3
|
||||
Loading…
Add table
Add a link
Reference in a new issue