From 5c7030903774bdde07934718f6b184ff9db2c6de Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Mon, 23 Jan 2017 10:13:18 -0800 Subject: Move new test files out of libbindgen --- .../tests/expectations/tests/16-byte-alignment.rs | 136 --------------------- libbindgen/tests/expectations/tests/issue-410.rs | 41 ------- libbindgen/tests/headers/16-byte-alignment.h | 33 ----- libbindgen/tests/headers/issue-410.hpp | 12 -- tests/expectations/tests/16-byte-alignment.rs | 136 +++++++++++++++++++++ tests/expectations/tests/issue-410.rs | 41 +++++++ tests/headers/16-byte-alignment.h | 33 +++++ tests/headers/issue-410.hpp | 12 ++ 8 files changed, 222 insertions(+), 222 deletions(-) delete mode 100644 libbindgen/tests/expectations/tests/16-byte-alignment.rs delete mode 100644 libbindgen/tests/expectations/tests/issue-410.rs delete mode 100644 libbindgen/tests/headers/16-byte-alignment.h delete mode 100644 libbindgen/tests/headers/issue-410.hpp create mode 100644 tests/expectations/tests/16-byte-alignment.rs create mode 100644 tests/expectations/tests/issue-410.rs create mode 100644 tests/headers/16-byte-alignment.h create mode 100644 tests/headers/issue-410.hpp diff --git a/libbindgen/tests/expectations/tests/16-byte-alignment.rs b/libbindgen/tests/expectations/tests/16-byte-alignment.rs deleted file mode 100644 index b28c0537..00000000 --- a/libbindgen/tests/expectations/tests/16-byte-alignment.rs +++ /dev/null @@ -1,136 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -pub struct __BindgenUnionField(::std::marker::PhantomData); -impl __BindgenUnionField { - #[inline] - pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) } - #[inline] - pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) } - #[inline] - pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) } -} -impl ::std::default::Default for __BindgenUnionField { - #[inline] - fn default() -> Self { Self::new() } -} -impl ::std::clone::Clone for __BindgenUnionField { - #[inline] - fn clone(&self) -> Self { Self::new() } -} -impl ::std::marker::Copy for __BindgenUnionField { } -impl ::std::fmt::Debug for __BindgenUnionField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - fmt.write_str("__BindgenUnionField") - } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv4_tuple { - pub src_addr: u32, - pub dst_addr: u32, - pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv4_tuple__bindgen_ty_1 { - pub __bindgen_anon_1: __BindgenUnionField, - pub sctp_tag: __BindgenUnionField, - pub bindgen_union_field: u32, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { - pub dport: u16, - pub sport: u16, -} -#[test] -fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::() - , 4usize); - assert_eq!(::std::mem::align_of::() - , 2usize); -} -impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::() , - 4usize); - assert_eq!(::std::mem::align_of::() , - 4usize); -} -impl Clone for rte_ipv4_tuple__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_rte_ipv4_tuple() { - assert_eq!(::std::mem::size_of::() , 12usize); - assert_eq!(::std::mem::align_of::() , 4usize); -} -impl Clone for rte_ipv4_tuple { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv6_tuple { - pub src_addr: [u8; 16usize], - pub dst_addr: [u8; 16usize], - pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv6_tuple__bindgen_ty_1 { - pub __bindgen_anon_1: __BindgenUnionField, - pub sctp_tag: __BindgenUnionField, - pub bindgen_union_field: u32, -} -#[repr(C)] -#[derive(Debug, Copy)] -pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { - pub dport: u16, - pub sport: u16, -} -#[test] -fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::() - , 4usize); - assert_eq!(::std::mem::align_of::() - , 2usize); -} -impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::() , - 4usize); - assert_eq!(::std::mem::align_of::() , - 4usize); -} -impl Clone for rte_ipv6_tuple__bindgen_ty_1 { - fn clone(&self) -> Self { *self } -} -#[test] -fn bindgen_test_layout_rte_ipv6_tuple() { - assert_eq!(::std::mem::size_of::() , 36usize); - assert_eq!(::std::mem::align_of::() , 4usize); -} -impl Clone for rte_ipv6_tuple { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Copy)] -pub struct rte_thash_tuple { - pub v4: __BindgenUnionField, - pub v6: __BindgenUnionField, - pub bindgen_union_field: [u8; 48usize], -} -impl Clone for rte_thash_tuple { - fn clone(&self) -> Self { *self } -} diff --git a/libbindgen/tests/expectations/tests/issue-410.rs b/libbindgen/tests/expectations/tests/issue-410.rs deleted file mode 100644 index a5d94960..00000000 --- a/libbindgen/tests/expectations/tests/issue-410.rs +++ /dev/null @@ -1,41 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -pub mod root { - #[allow(unused_imports)] - use self::super::root; - pub mod JS { - #[allow(unused_imports)] - use self::super::super::root; - pub use root::_bindgen_ty_1 as JSWhyMagic; - #[repr(C)] - #[derive(Debug, Copy)] - pub struct Value { - pub _address: u8, - } - #[test] - fn bindgen_test_layout_Value() { - assert_eq!(::std::mem::size_of::() , 1usize); - assert_eq!(::std::mem::align_of::() , 1usize); - } - extern "C" { - #[link_name = "_ZN2JS5Value1aE10JSWhyMagic"] - pub fn Value_a(this: *mut root::JS::Value, - arg1: root::JS::JSWhyMagic); - } - impl Clone for Value { - fn clone(&self) -> Self { *self } - } - impl Value { - #[inline] - pub unsafe fn a(&mut self, arg1: root::JS::JSWhyMagic) { - Value_a(&mut *self, arg1) - } - } - } - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] - pub enum _bindgen_ty_1 { } -} diff --git a/libbindgen/tests/headers/16-byte-alignment.h b/libbindgen/tests/headers/16-byte-alignment.h deleted file mode 100644 index 7a7f7548..00000000 --- a/libbindgen/tests/headers/16-byte-alignment.h +++ /dev/null @@ -1,33 +0,0 @@ - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; - -struct rte_ipv4_tuple { - uint32_t src_addr; - uint32_t dst_addr; - union { - struct { - uint16_t dport; - uint16_t sport; - }; - uint32_t sctp_tag; - }; -}; - -struct rte_ipv6_tuple { - uint8_t src_addr[16]; - uint8_t dst_addr[16]; - union { - struct { - uint16_t dport; - uint16_t sport; - }; - uint32_t sctp_tag; - }; -}; - -union rte_thash_tuple { - struct rte_ipv4_tuple v4; - struct rte_ipv6_tuple v6; -} __attribute__((aligned(16))); diff --git a/libbindgen/tests/headers/issue-410.hpp b/libbindgen/tests/headers/issue-410.hpp deleted file mode 100644 index a7a834cf..00000000 --- a/libbindgen/tests/headers/issue-410.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// bindgen-flags: --enable-cxx-namespaces --whitelist-type JS::Value - -namespace JS { -class Value; -} -typedef enum {} JSWhyMagic; -namespace JS { -class Value { -public: - void a(JSWhyMagic); -}; -} diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs new file mode 100644 index 00000000..b28c0537 --- /dev/null +++ b/tests/expectations/tests/16-byte-alignment.rs @@ -0,0 +1,136 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +#[repr(C)] +pub struct __BindgenUnionField(::std::marker::PhantomData); +impl __BindgenUnionField { + #[inline] + pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) } + #[inline] + pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) } + #[inline] + pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) } +} +impl ::std::default::Default for __BindgenUnionField { + #[inline] + fn default() -> Self { Self::new() } +} +impl ::std::clone::Clone for __BindgenUnionField { + #[inline] + fn clone(&self) -> Self { Self::new() } +} +impl ::std::marker::Copy for __BindgenUnionField { } +impl ::std::fmt::Debug for __BindgenUnionField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fmt.write_str("__BindgenUnionField") + } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv4_tuple { + pub src_addr: u32, + pub dst_addr: u32, + pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv4_tuple__bindgen_ty_1 { + pub __bindgen_anon_1: __BindgenUnionField, + pub sctp_tag: __BindgenUnionField, + pub bindgen_union_field: u32, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { + pub dport: u16, + pub sport: u16, +} +#[test] +fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() { + assert_eq!(::std::mem::size_of::() + , 4usize); + assert_eq!(::std::mem::align_of::() + , 2usize); +} +impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() { + assert_eq!(::std::mem::size_of::() , + 4usize); + assert_eq!(::std::mem::align_of::() , + 4usize); +} +impl Clone for rte_ipv4_tuple__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_rte_ipv4_tuple() { + assert_eq!(::std::mem::size_of::() , 12usize); + assert_eq!(::std::mem::align_of::() , 4usize); +} +impl Clone for rte_ipv4_tuple { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv6_tuple { + pub src_addr: [u8; 16usize], + pub dst_addr: [u8; 16usize], + pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv6_tuple__bindgen_ty_1 { + pub __bindgen_anon_1: __BindgenUnionField, + pub sctp_tag: __BindgenUnionField, + pub bindgen_union_field: u32, +} +#[repr(C)] +#[derive(Debug, Copy)] +pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { + pub dport: u16, + pub sport: u16, +} +#[test] +fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() { + assert_eq!(::std::mem::size_of::() + , 4usize); + assert_eq!(::std::mem::align_of::() + , 2usize); +} +impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() { + assert_eq!(::std::mem::size_of::() , + 4usize); + assert_eq!(::std::mem::align_of::() , + 4usize); +} +impl Clone for rte_ipv6_tuple__bindgen_ty_1 { + fn clone(&self) -> Self { *self } +} +#[test] +fn bindgen_test_layout_rte_ipv6_tuple() { + assert_eq!(::std::mem::size_of::() , 36usize); + assert_eq!(::std::mem::align_of::() , 4usize); +} +impl Clone for rte_ipv6_tuple { + fn clone(&self) -> Self { *self } +} +#[repr(C)] +#[derive(Copy)] +pub struct rte_thash_tuple { + pub v4: __BindgenUnionField, + pub v6: __BindgenUnionField, + pub bindgen_union_field: [u8; 48usize], +} +impl Clone for rte_thash_tuple { + fn clone(&self) -> Self { *self } +} diff --git a/tests/expectations/tests/issue-410.rs b/tests/expectations/tests/issue-410.rs new file mode 100644 index 00000000..a5d94960 --- /dev/null +++ b/tests/expectations/tests/issue-410.rs @@ -0,0 +1,41 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod JS { + #[allow(unused_imports)] + use self::super::super::root; + pub use root::_bindgen_ty_1 as JSWhyMagic; + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Value { + pub _address: u8, + } + #[test] + fn bindgen_test_layout_Value() { + assert_eq!(::std::mem::size_of::() , 1usize); + assert_eq!(::std::mem::align_of::() , 1usize); + } + extern "C" { + #[link_name = "_ZN2JS5Value1aE10JSWhyMagic"] + pub fn Value_a(this: *mut root::JS::Value, + arg1: root::JS::JSWhyMagic); + } + impl Clone for Value { + fn clone(&self) -> Self { *self } + } + impl Value { + #[inline] + pub unsafe fn a(&mut self, arg1: root::JS::JSWhyMagic) { + Value_a(&mut *self, arg1) + } + } + } + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum _bindgen_ty_1 { } +} diff --git a/tests/headers/16-byte-alignment.h b/tests/headers/16-byte-alignment.h new file mode 100644 index 00000000..7a7f7548 --- /dev/null +++ b/tests/headers/16-byte-alignment.h @@ -0,0 +1,33 @@ + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +struct rte_ipv4_tuple { + uint32_t src_addr; + uint32_t dst_addr; + union { + struct { + uint16_t dport; + uint16_t sport; + }; + uint32_t sctp_tag; + }; +}; + +struct rte_ipv6_tuple { + uint8_t src_addr[16]; + uint8_t dst_addr[16]; + union { + struct { + uint16_t dport; + uint16_t sport; + }; + uint32_t sctp_tag; + }; +}; + +union rte_thash_tuple { + struct rte_ipv4_tuple v4; + struct rte_ipv6_tuple v6; +} __attribute__((aligned(16))); diff --git a/tests/headers/issue-410.hpp b/tests/headers/issue-410.hpp new file mode 100644 index 00000000..a7a834cf --- /dev/null +++ b/tests/headers/issue-410.hpp @@ -0,0 +1,12 @@ +// bindgen-flags: --enable-cxx-namespaces --whitelist-type JS::Value + +namespace JS { +class Value; +} +typedef enum {} JSWhyMagic; +namespace JS { +class Value { +public: + void a(JSWhyMagic); +}; +} -- cgit v1.2.3