@@ -1594,125 +1594,148 @@ pub mod test {
1594
1594
// struct size tests
1595
1595
#[ test]
1596
1596
fn test_uv_ll_struct_size_uv_tcp_t( ) {
1597
- let foreign_handle_size =
1598
- :: uv_ll:: rustrt:: rust_uv_helper_uv_tcp_t_size( ) ;
1599
- let rust_handle_size = sys:: size_of:: <uv_tcp_t>( ) ;
1600
- let output = fmt!( "uv_tcp_t -- foreign: %u rust: %u",
1601
- foreign_handle_size as uint, rust_handle_size) ;
1602
- log( debug, output) ;
1603
- assert foreign_handle_size as uint == rust_handle_size;
1597
+ unsafe {
1598
+ let foreign_handle_size =
1599
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_tcp_t_size( ) ;
1600
+ let rust_handle_size = sys:: size_of:: <uv_tcp_t>( ) ;
1601
+ let output = fmt!( "uv_tcp_t -- foreign: %u rust: %u",
1602
+ foreign_handle_size as uint, rust_handle_size) ;
1603
+ log( debug, output) ;
1604
+ assert foreign_handle_size as uint == rust_handle_size;
1605
+ }
1604
1606
}
1605
1607
#[ test]
1606
1608
fn test_uv_ll_struct_size_uv_connect_t( ) {
1607
- let foreign_handle_size =
1608
- :: uv_ll:: rustrt:: rust_uv_helper_uv_connect_t_size( ) ;
1609
- let rust_handle_size = sys:: size_of:: <uv_connect_t>( ) ;
1610
- let output = fmt!( "uv_connect_t -- foreign: %u rust: %u",
1611
- foreign_handle_size as uint, rust_handle_size) ;
1612
- log( debug, output) ;
1613
- assert foreign_handle_size as uint == rust_handle_size;
1609
+ unsafe {
1610
+ let foreign_handle_size =
1611
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_connect_t_size( ) ;
1612
+ let rust_handle_size = sys:: size_of:: <uv_connect_t>( ) ;
1613
+ let output = fmt!( "uv_connect_t -- foreign: %u rust: %u",
1614
+ foreign_handle_size as uint, rust_handle_size) ;
1615
+ log( debug, output) ;
1616
+ assert foreign_handle_size as uint == rust_handle_size;
1617
+ }
1614
1618
}
1615
1619
#[ test]
1616
1620
fn test_uv_ll_struct_size_uv_buf_t( ) {
1617
- let foreign_handle_size =
1618
- :: uv_ll:: rustrt:: rust_uv_helper_uv_buf_t_size( ) ;
1619
- let rust_handle_size = sys:: size_of:: <uv_buf_t>( ) ;
1620
- let output = fmt!( "uv_buf_t -- foreign: %u rust: %u",
1621
- foreign_handle_size as uint, rust_handle_size) ;
1622
- log( debug, output) ;
1623
- assert foreign_handle_size as uint == rust_handle_size;
1621
+ unsafe {
1622
+ let foreign_handle_size =
1623
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_buf_t_size( ) ;
1624
+ let rust_handle_size = sys:: size_of:: <uv_buf_t>( ) ;
1625
+ let output = fmt!( "uv_buf_t -- foreign: %u rust: %u",
1626
+ foreign_handle_size as uint, rust_handle_size) ;
1627
+ log( debug, output) ;
1628
+ assert foreign_handle_size as uint == rust_handle_size;
1629
+ }
1624
1630
}
1625
1631
#[ test]
1626
1632
fn test_uv_ll_struct_size_uv_write_t( ) {
1627
- let foreign_handle_size =
1628
- :: uv_ll:: rustrt:: rust_uv_helper_uv_write_t_size( ) ;
1629
- let rust_handle_size = sys:: size_of:: <uv_write_t>( ) ;
1630
- let output = fmt!( "uv_write_t -- foreign: %u rust: %u",
1631
- foreign_handle_size as uint, rust_handle_size) ;
1632
- log( debug, output) ;
1633
- assert foreign_handle_size as uint == rust_handle_size;
1633
+ unsafe {
1634
+ let foreign_handle_size =
1635
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_write_t_size( ) ;
1636
+ let rust_handle_size = sys:: size_of:: <uv_write_t>( ) ;
1637
+ let output = fmt!( "uv_write_t -- foreign: %u rust: %u",
1638
+ foreign_handle_size as uint, rust_handle_size) ;
1639
+ log( debug, output) ;
1640
+ assert foreign_handle_size as uint == rust_handle_size;
1641
+ }
1634
1642
}
1635
1643
1636
1644
#[ test]
1637
1645
fn test_uv_ll_struct_size_sockaddr_in( ) {
1638
- let foreign_handle_size =
1639
- :: uv_ll:: rustrt:: rust_uv_helper_sockaddr_in_size( ) ;
1640
- let rust_handle_size = sys:: size_of:: <sockaddr_in>( ) ;
1641
- let output = fmt!( "sockaddr_in -- foreign: %u rust: %u",
1642
- foreign_handle_size as uint, rust_handle_size) ;
1643
- log( debug, output) ;
1644
- assert foreign_handle_size as uint == rust_handle_size;
1646
+ unsafe {
1647
+ let foreign_handle_size =
1648
+ :: uv_ll:: rustrt:: rust_uv_helper_sockaddr_in_size( ) ;
1649
+ let rust_handle_size = sys:: size_of:: <sockaddr_in>( ) ;
1650
+ let output = fmt!( "sockaddr_in -- foreign: %u rust: %u",
1651
+ foreign_handle_size as uint, rust_handle_size) ;
1652
+ log( debug, output) ;
1653
+ assert foreign_handle_size as uint == rust_handle_size;
1654
+ }
1645
1655
}
1646
1656
#[ test]
1647
1657
fn test_uv_ll_struct_size_sockaddr_in6( ) {
1648
- let foreign_handle_size =
1649
- :: uv_ll:: rustrt:: rust_uv_helper_sockaddr_in6_size( ) ;
1650
- let rust_handle_size = sys:: size_of:: <sockaddr_in6>( ) ;
1651
- let output = fmt!( "sockaddr_in6 -- foreign: %u rust: %u",
1652
- foreign_handle_size as uint, rust_handle_size) ;
1653
- log( debug, output) ;
1654
- // FIXME #1645 .. rust appears to pad structs to the nearest byte..?
1655
- // .. can't get the uv::ll::sockaddr_in6 to == 28 :/
1656
- // .. so the type always appears to be 32 in size.. which is
1657
- // good, i guess.. better too big than too little
1658
- assert ( 4 u+foreign_handle_size as uint) == rust_handle_size;
1658
+ unsafe {
1659
+ let foreign_handle_size =
1660
+ :: uv_ll:: rustrt:: rust_uv_helper_sockaddr_in6_size( ) ;
1661
+ let rust_handle_size = sys:: size_of:: <sockaddr_in6>( ) ;
1662
+ let output = fmt!( "sockaddr_in6 -- foreign: %u rust: %u",
1663
+ foreign_handle_size as uint, rust_handle_size) ;
1664
+ log( debug, output) ;
1665
+ // FIXME #1645 .. rust appears to pad structs to the nearest
1666
+ // byte..?
1667
+ // .. can't get the uv::ll::sockaddr_in6 to == 28 :/
1668
+ // .. so the type always appears to be 32 in size.. which is
1669
+ // good, i guess.. better too big than too little
1670
+ assert ( 4 u+foreign_handle_size as uint) == rust_handle_size;
1671
+ }
1659
1672
}
1660
1673
#[ test]
1661
1674
#[ ignore( reason = "questionable size calculations") ]
1662
1675
fn test_uv_ll_struct_size_addr_in( ) {
1663
- let foreign_handle_size =
1664
- :: uv_ll:: rustrt:: rust_uv_helper_addr_in_size( ) ;
1665
- let rust_handle_size = sys:: size_of:: <addr_in>( ) ;
1666
- let output = fmt!( "addr_in -- foreign: %u rust: %u",
1667
- foreign_handle_size as uint, rust_handle_size) ;
1668
- log( debug, output) ;
1669
- // FIXME #1645 .. see note above about struct padding
1670
- assert ( 4 u+foreign_handle_size as uint) == rust_handle_size;
1676
+ unsafe {
1677
+ let foreign_handle_size =
1678
+ :: uv_ll:: rustrt:: rust_uv_helper_addr_in_size( ) ;
1679
+ let rust_handle_size = sys:: size_of:: <addr_in>( ) ;
1680
+ let output = fmt!( "addr_in -- foreign: %u rust: %u",
1681
+ foreign_handle_size as uint, rust_handle_size) ;
1682
+ log( debug, output) ;
1683
+ // FIXME #1645 .. see note above about struct padding
1684
+ assert ( 4 u+foreign_handle_size as uint) == rust_handle_size;
1685
+ }
1671
1686
}
1672
1687
1673
1688
#[ test]
1674
1689
fn test_uv_ll_struct_size_uv_async_t( ) {
1675
- let foreign_handle_size =
1676
- :: uv_ll:: rustrt:: rust_uv_helper_uv_async_t_size( ) ;
1677
- let rust_handle_size = sys:: size_of:: <uv_async_t>( ) ;
1678
- let output = fmt!( "uv_async_t -- foreign: %u rust: %u",
1679
- foreign_handle_size as uint, rust_handle_size) ;
1680
- log( debug, output) ;
1681
- assert foreign_handle_size as uint == rust_handle_size;
1690
+ unsafe {
1691
+ let foreign_handle_size =
1692
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_async_t_size( ) ;
1693
+ let rust_handle_size = sys:: size_of:: <uv_async_t>( ) ;
1694
+ let output = fmt!( "uv_async_t -- foreign: %u rust: %u",
1695
+ foreign_handle_size as uint, rust_handle_size) ;
1696
+ log( debug, output) ;
1697
+ assert foreign_handle_size as uint == rust_handle_size;
1698
+ }
1682
1699
}
1683
1700
1684
1701
#[ test]
1685
1702
fn test_uv_ll_struct_size_uv_timer_t( ) {
1686
- let foreign_handle_size =
1687
- :: uv_ll:: rustrt:: rust_uv_helper_uv_timer_t_size( ) ;
1688
- let rust_handle_size = sys:: size_of:: <uv_timer_t>( ) ;
1689
- let output = fmt!( "uv_timer_t -- foreign: %u rust: %u",
1690
- foreign_handle_size as uint, rust_handle_size) ;
1691
- log( debug, output) ;
1692
- assert foreign_handle_size as uint == rust_handle_size;
1703
+ unsafe {
1704
+ let foreign_handle_size =
1705
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_timer_t_size( ) ;
1706
+ let rust_handle_size = sys:: size_of:: <uv_timer_t>( ) ;
1707
+ let output = fmt!( "uv_timer_t -- foreign: %u rust: %u",
1708
+ foreign_handle_size as uint, rust_handle_size) ;
1709
+ log( debug, output) ;
1710
+ assert foreign_handle_size as uint == rust_handle_size;
1711
+ }
1693
1712
}
1694
1713
1695
1714
#[ test]
1696
1715
#[ ignore( cfg( target_os = "win32") ) ]
1697
1716
fn test_uv_ll_struct_size_uv_getaddrinfo_t( ) {
1698
- let foreign_handle_size =
1699
- :: uv_ll:: rustrt:: rust_uv_helper_uv_getaddrinfo_t_size( ) ;
1700
- let rust_handle_size = sys:: size_of:: <uv_getaddrinfo_t>( ) ;
1701
- let output = fmt!( "uv_getaddrinfo_t -- foreign: %u rust: %u",
1702
- foreign_handle_size as uint, rust_handle_size) ;
1703
- log( debug, output) ;
1704
- assert foreign_handle_size as uint == rust_handle_size;
1717
+ unsafe {
1718
+ let foreign_handle_size =
1719
+ :: uv_ll:: rustrt:: rust_uv_helper_uv_getaddrinfo_t_size( ) ;
1720
+ let rust_handle_size = sys:: size_of:: <uv_getaddrinfo_t>( ) ;
1721
+ let output = fmt!( "uv_getaddrinfo_t -- foreign: %u rust: %u",
1722
+ foreign_handle_size as uint, rust_handle_size) ;
1723
+ log( debug, output) ;
1724
+ assert foreign_handle_size as uint == rust_handle_size;
1725
+ }
1705
1726
}
1706
1727
#[ test]
1707
1728
#[ ignore( cfg( target_os = "macos") ) ]
1708
1729
#[ ignore( cfg( target_os = "win32") ) ]
1709
1730
fn test_uv_ll_struct_size_addrinfo( ) {
1710
- let foreign_handle_size =
1711
- :: uv_ll:: rustrt:: rust_uv_helper_addrinfo_size( ) ;
1712
- let rust_handle_size = sys:: size_of:: <addrinfo>( ) ;
1713
- let output = fmt!( "addrinfo -- foreign: %u rust: %u",
1714
- foreign_handle_size as uint, rust_handle_size) ;
1715
- log( debug, output) ;
1716
- assert foreign_handle_size as uint == rust_handle_size;
1731
+ unsafe {
1732
+ let foreign_handle_size =
1733
+ :: uv_ll:: rustrt:: rust_uv_helper_addrinfo_size( ) ;
1734
+ let rust_handle_size = sys:: size_of:: <addrinfo>( ) ;
1735
+ let output = fmt!( "addrinfo -- foreign: %u rust: %u",
1736
+ foreign_handle_size as uint, rust_handle_size) ;
1737
+ log( debug, output) ;
1738
+ assert foreign_handle_size as uint == rust_handle_size;
1739
+ }
1717
1740
}
1718
1741
}
0 commit comments