libstd: Fix std test. rs=busted
This commit is contained in:
parent
ad2fc50ca1
commit
9b3452e10a
@ -161,12 +161,14 @@ mod tests {
|
||||
use core::libc;
|
||||
|
||||
fn malloc(n: size_t) -> CVec<u8> {
|
||||
let mem = libc::malloc(n);
|
||||
unsafe {
|
||||
let mem = libc::malloc(n);
|
||||
|
||||
assert mem as int != 0;
|
||||
assert mem as int != 0;
|
||||
|
||||
return unsafe { c_vec_with_dtor(mem as *mut u8, n as uint,
|
||||
||free(mem)) };
|
||||
return unsafe { c_vec_with_dtor(mem as *mut u8, n as uint,
|
||||
|| unsafe { free(mem) }) };
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1594,125 +1594,148 @@ pub mod test {
|
||||
// struct size tests
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_tcp_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_tcp_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_tcp_t>();
|
||||
let output = fmt!("uv_tcp_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_tcp_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_tcp_t>();
|
||||
let output = fmt!("uv_tcp_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_connect_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_connect_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_connect_t>();
|
||||
let output = fmt!("uv_connect_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_connect_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_connect_t>();
|
||||
let output = fmt!("uv_connect_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_buf_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_buf_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_buf_t>();
|
||||
let output = fmt!("uv_buf_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_buf_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_buf_t>();
|
||||
let output = fmt!("uv_buf_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_write_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_write_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_write_t>();
|
||||
let output = fmt!("uv_write_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_write_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_write_t>();
|
||||
let output = fmt!("uv_write_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_sockaddr_in() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_sockaddr_in_size();
|
||||
let rust_handle_size = sys::size_of::<sockaddr_in>();
|
||||
let output = fmt!("sockaddr_in -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_sockaddr_in_size();
|
||||
let rust_handle_size = sys::size_of::<sockaddr_in>();
|
||||
let output = fmt!("sockaddr_in -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_sockaddr_in6() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_sockaddr_in6_size();
|
||||
let rust_handle_size = sys::size_of::<sockaddr_in6>();
|
||||
let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
// FIXME #1645 .. rust appears to pad structs to the nearest byte..?
|
||||
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
||||
// .. so the type always appears to be 32 in size.. which is
|
||||
// good, i guess.. better too big than too little
|
||||
assert (4u+foreign_handle_size as uint) == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_sockaddr_in6_size();
|
||||
let rust_handle_size = sys::size_of::<sockaddr_in6>();
|
||||
let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
// FIXME #1645 .. rust appears to pad structs to the nearest
|
||||
// byte..?
|
||||
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
||||
// .. so the type always appears to be 32 in size.. which is
|
||||
// good, i guess.. better too big than too little
|
||||
assert (4u+foreign_handle_size as uint) == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
#[ignore(reason = "questionable size calculations")]
|
||||
fn test_uv_ll_struct_size_addr_in() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_addr_in_size();
|
||||
let rust_handle_size = sys::size_of::<addr_in>();
|
||||
let output = fmt!("addr_in -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
// FIXME #1645 .. see note above about struct padding
|
||||
assert (4u+foreign_handle_size as uint) == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_addr_in_size();
|
||||
let rust_handle_size = sys::size_of::<addr_in>();
|
||||
let output = fmt!("addr_in -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
// FIXME #1645 .. see note above about struct padding
|
||||
assert (4u+foreign_handle_size as uint) == rust_handle_size;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_async_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_async_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_async_t>();
|
||||
let output = fmt!("uv_async_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_async_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_async_t>();
|
||||
let output = fmt!("uv_async_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uv_ll_struct_size_uv_timer_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_timer_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_timer_t>();
|
||||
let output = fmt!("uv_timer_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_timer_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_timer_t>();
|
||||
let output = fmt!("uv_timer_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore(cfg(target_os = "win32"))]
|
||||
fn test_uv_ll_struct_size_uv_getaddrinfo_t() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_getaddrinfo_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_getaddrinfo_t>();
|
||||
let output = fmt!("uv_getaddrinfo_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_uv_getaddrinfo_t_size();
|
||||
let rust_handle_size = sys::size_of::<uv_getaddrinfo_t>();
|
||||
let output = fmt!("uv_getaddrinfo_t -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
#[ignore(cfg(target_os = "macos"))]
|
||||
#[ignore(cfg(target_os = "win32"))]
|
||||
fn test_uv_ll_struct_size_addrinfo() {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_addrinfo_size();
|
||||
let rust_handle_size = sys::size_of::<addrinfo>();
|
||||
let output = fmt!("addrinfo -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
unsafe {
|
||||
let foreign_handle_size =
|
||||
::uv_ll::rustrt::rust_uv_helper_addrinfo_size();
|
||||
let rust_handle_size = sys::size_of::<addrinfo>();
|
||||
let output = fmt!("addrinfo -- foreign: %u rust: %u",
|
||||
foreign_handle_size as uint, rust_handle_size);
|
||||
log(debug, output);
|
||||
assert foreign_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user