diff options
author | Jean-Philippe DUFRAIGNE <j.dufraigne@gmail.com> | 2016-11-05 09:44:24 +0000 |
---|---|---|
committer | Jean-Philippe DUFRAIGNE <j.dufraigne@gmail.com> | 2016-11-05 14:07:52 +0000 |
commit | 2866ab506f0bf1946e7732b0b57567508fd62d28 (patch) | |
tree | ffa958090064c257991afb807c8d80cb1efc7902 /tests/expectations/struct_with_bitfields.rs | |
parent | 9073a4f0538e41a28164809b28e7f38a2ee528fe (diff) |
Speed up integration tests (move building expectations)
Speed up running 'cargo test':
-Before: 2'17s
-After: 30s
Update to use new path:
Makefile, .travis.yml, CONTRIBUTING.md, tests/tests.rs
Delete unused expectation that fail to compile:
tests/expectations/moar_bitfields.rs
tests/expectations/variadic_template_args.rs
For every 'cargo test' run, the bindgen output where built.
We already test that the bindgen output match expectations/*.rs,
so there is no need to check it build unless the expectation is updated.
Move tests/expectations/*.rs to tests/expectations/tests/*.rs and make
tests/expectations a new dev-dependency package. This allow running:
- cargo test -p tests_expectations
In addition to the speed up, we also get a clean output for the build
and test run. In particular, a number of warnings are generated that should
probably be silenced, and eventually enforced modifying travis to build:
- RUSTFLAGS='-D warnings' cargo test -p tests_expectations
The benefit of having it as a new package is that it avoid polluting
the 'cargo test' output that should focus on bindgen.
Diffstat (limited to 'tests/expectations/struct_with_bitfields.rs')
-rw-r--r-- | tests/expectations/struct_with_bitfields.rs | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/tests/expectations/struct_with_bitfields.rs b/tests/expectations/struct_with_bitfields.rs deleted file mode 100644 index 3fb83a47..00000000 --- a/tests/expectations/struct_with_bitfields.rs +++ /dev/null @@ -1,122 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -#[derive(Debug, Copy)] -pub struct bitfield { - pub _bitfield_1: u8, - pub e: ::std::os::raw::c_int, - pub _bitfield_2: u8, - pub _bitfield_3: u32, -} -#[test] -fn bindgen_test_layout_bitfield() { - assert_eq!(::std::mem::size_of::<bitfield>() , 16usize); - assert_eq!(::std::mem::align_of::<bitfield>() , 4usize); -} -impl Clone for bitfield { - fn clone(&self) -> Self { *self } -} -impl bitfield { - #[inline] - pub fn a(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (1usize as u8)) >> - 0u32) as u16) - } - } - #[inline] - pub fn set_a(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(1usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 0u32) & (1usize as u8); - } - #[inline] - pub fn b(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (2usize as u8)) >> - 1u32) as u16) - } - } - #[inline] - pub fn set_b(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(2usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 1u32) & (2usize as u8); - } - #[inline] - pub fn c(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (4usize as u8)) >> - 2u32) as u16) - } - } - #[inline] - pub fn set_c(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(4usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 2u32) & (4usize as u8); - } - #[inline] - pub fn at_offset_3(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (8usize as u8)) >> - 3u32) as u16) - } - } - #[inline] - pub fn set_at_offset_3(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(8usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 3u32) & (8usize as u8); - } - #[inline] - pub fn at_offset_4(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (48usize as u8)) >> - 4u32) as u16) - } - } - #[inline] - pub fn set_at_offset_4(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(48usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 4u32) & (48usize as u8); - } - #[inline] - pub fn d(&self) -> ::std::os::raw::c_ushort { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (192usize as u8)) >> - 6u32) as u16) - } - } - #[inline] - pub fn set_d(&mut self, val: ::std::os::raw::c_ushort) { - self._bitfield_1 &= !(192usize as u8); - self._bitfield_1 |= ((val as u16 as u8) << 6u32) & (192usize as u8); - } - #[inline] - pub fn f(&self) -> ::std::os::raw::c_uint { - unsafe { - ::std::mem::transmute(((self._bitfield_2 & (3usize as u8)) >> - 0u32) as u32) - } - } - #[inline] - pub fn set_f(&mut self, val: ::std::os::raw::c_uint) { - self._bitfield_2 &= !(3usize as u8); - self._bitfield_2 |= ((val as u32 as u8) << 0u32) & (3usize as u8); - } - #[inline] - pub fn g(&self) -> ::std::os::raw::c_uint { - unsafe { - ::std::mem::transmute(((self._bitfield_3 & - (4294967295usize as u32)) >> 0u32) as - u32) - } - } - #[inline] - pub fn set_g(&mut self, val: ::std::os::raw::c_uint) { - self._bitfield_3 &= !(4294967295usize as u32); - self._bitfield_3 |= - ((val as u32 as u32) << 0u32) & (4294967295usize as u32); - } -} |