diff --git a/.travis.yml b/.travis.yml index 28ffd0d706..36bafd7ad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ script: - git add -A - git diff @ - git diff-index --quiet HEAD + - cargo test -p tests_expectations - cargo build --features "$BINDGEN_FEATURES _docs" notifications: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c7e5198c9f..fb3208ff54 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,9 +49,9 @@ $ cargo build --features "llvm_stable _docs" ### Overview Input C/C++ test headers reside in the `tests/headers` directory. The expected -output rust bindings live in `tests/expectations`; for example, +output rust bindings live in `tests/expectations/tests`; for example, `tests/headers/my_header.h`'s expected generated rust bindings would be -`tests/expectations/my_header.rs`. +`tests/expectations/tests/my_header.rs`. The `tests/tools/run-bindgen.py` script runs `bindgen` on the test headers and compares the results to the expectations. @@ -96,6 +96,12 @@ specify the required features at the top of the test header in a similar manner: // bingden-features: llvm_stable ``` +Then verify the new rust bindings compile and its tests pass: + +``` +$ cargo test -p tests_expectations +``` + ## Automatic code formatting There's a `rustfmt.toml` file in the repo. Ideally changes should be consistent diff --git a/Cargo.toml b/Cargo.toml index 65a8033b8d..4e455fa9a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,5 +54,8 @@ _docs = [] name = "bindgen" path = "src/lib.rs" +[dev-dependencies.tests_expectations] +path = "tests/expectations" + [[test]] name = "tests" diff --git a/Makefile b/Makefile index 384ce323c7..90281f7b61 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ TEST_HEADERS := $(wildcard tests/headers/*.h) $(wildcard tests/headers/*.hpp) TEST_TARGETS := $(TEST_HEADERS:.h=.rs) TEST_TARGETS := $(TEST_TARGETS:.hpp=.rs) -TEST_TARGETS := $(patsubst tests/headers/%, tests/expectations/%, $(TEST_TARGETS)) +TEST_TARGETS := $(patsubst tests/headers/%, tests/expectations/tests/%, $(TEST_TARGETS)) BINDGEN := ./target/debug/bindgen @@ -25,10 +25,10 @@ clean-tests: $(RM) $(TEST_TARGETS) # TODO: Add options to add flags and whatnot -tests/expectations/%.rs: tests/headers/%.h +tests/expectations/tests/%.rs: tests/headers/%.h @mkdir -p $(dir $@) ./tests/tools/run-bindgen.py $(BINDGEN) $< $@ -tests/expectations/%.rs: tests/headers/%.hpp +tests/expectations/tests/%.rs: tests/headers/%.hpp @mkdir -p $(dir $@) ./tests/tools/run-bindgen.py $(BINDGEN) $< $@ diff --git a/tests/expectations/Cargo.toml b/tests/expectations/Cargo.toml new file mode 100644 index 0000000000..53f1b14f46 --- /dev/null +++ b/tests/expectations/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "tests_expectations" +description = "bindgen results when ran on ../headers/*" +version = "0.1.0" +authors = [ + "Jyun-Yan You ", + "Emilio Cobos Álvarez ", + "The Servo project developers", +] + +[dependencies] diff --git a/tests/expectations/moar_bitfields.rs b/tests/expectations/moar_bitfields.rs deleted file mode 100644 index 7c034120f0..0000000000 --- a/tests/expectations/moar_bitfields.rs +++ /dev/null @@ -1,48 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(u32)] -pub enum WhenToScroll { - SCROLL_ALWAYS = 0, - SCROLL_IF_NOT_VISIBLE = 1, - SCROLL_IF_NOT_FULLY_VISIBLE = 2, -} -#[repr(C)] -pub struct ScrollAxis { - pub mWhereToScroll: ::std::os::raw::c_short, - pub _bitfield_1: u16, -} -#[test] -fn bindgen_test_layout_ScrollAxis() { - assert_eq!(::std::mem::size_of::() , 4usize); - assert_eq!(::std::mem::align_of::() , 4usize); -} -impl ScrollAxis { - #[inline] - pub fn mWhenToScroll(&self) -> WhenToScroll { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (255usize as u16)) >> - 0u32) as u32) - } - } - #[inline] - pub fn set_mWhenToScroll(&mut self, val: WhenToScroll) { - self._bitfield_1 &= !(255usize as u16); - self._bitfield_1 |= ((val as u32 as u16) << 0u32) & (255usize as u16); - } - #[inline] - pub fn mOnlyIfPerceivedScrollableDirection(&self) -> bool { - unsafe { - ::std::mem::transmute(((self._bitfield_1 & (256usize as u16)) >> - 8u32) as u8) - } - } - #[inline] - pub fn set_mOnlyIfPerceivedScrollableDirection(&mut self, val: bool) { - self._bitfield_1 &= !(256usize as u16); - self._bitfield_1 |= ((val as u8 as u16) << 8u32) & (256usize as u16); - } -} diff --git a/tests/expectations/src/lib.rs b/tests/expectations/src/lib.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/expectations/accessors.rs b/tests/expectations/tests/accessors.rs similarity index 100% rename from tests/expectations/accessors.rs rename to tests/expectations/tests/accessors.rs diff --git a/tests/expectations/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs similarity index 100% rename from tests/expectations/annotation_hide.rs rename to tests/expectations/tests/annotation_hide.rs diff --git a/tests/expectations/anon_enum.rs b/tests/expectations/tests/anon_enum.rs similarity index 100% rename from tests/expectations/anon_enum.rs rename to tests/expectations/tests/anon_enum.rs diff --git a/tests/expectations/anon_enum_whitelist.rs b/tests/expectations/tests/anon_enum_whitelist.rs similarity index 100% rename from tests/expectations/anon_enum_whitelist.rs rename to tests/expectations/tests/anon_enum_whitelist.rs diff --git a/tests/expectations/anon_union.rs b/tests/expectations/tests/anon_union.rs similarity index 100% rename from tests/expectations/anon_union.rs rename to tests/expectations/tests/anon_union.rs diff --git a/tests/expectations/arg_keyword.rs b/tests/expectations/tests/arg_keyword.rs similarity index 100% rename from tests/expectations/arg_keyword.rs rename to tests/expectations/tests/arg_keyword.rs diff --git a/tests/expectations/base-to-derived.rs b/tests/expectations/tests/base-to-derived.rs similarity index 100% rename from tests/expectations/base-to-derived.rs rename to tests/expectations/tests/base-to-derived.rs diff --git a/tests/expectations/blocks.rs b/tests/expectations/tests/blocks.rs similarity index 100% rename from tests/expectations/blocks.rs rename to tests/expectations/tests/blocks.rs diff --git a/tests/expectations/class.rs b/tests/expectations/tests/class.rs similarity index 100% rename from tests/expectations/class.rs rename to tests/expectations/tests/class.rs diff --git a/tests/expectations/class_nested.rs b/tests/expectations/tests/class_nested.rs similarity index 100% rename from tests/expectations/class_nested.rs rename to tests/expectations/tests/class_nested.rs diff --git a/tests/expectations/class_no_members.rs b/tests/expectations/tests/class_no_members.rs similarity index 100% rename from tests/expectations/class_no_members.rs rename to tests/expectations/tests/class_no_members.rs diff --git a/tests/expectations/class_static.rs b/tests/expectations/tests/class_static.rs similarity index 100% rename from tests/expectations/class_static.rs rename to tests/expectations/tests/class_static.rs diff --git a/tests/expectations/class_static_const.rs b/tests/expectations/tests/class_static_const.rs similarity index 100% rename from tests/expectations/class_static_const.rs rename to tests/expectations/tests/class_static_const.rs diff --git a/tests/expectations/class_use_as.rs b/tests/expectations/tests/class_use_as.rs similarity index 100% rename from tests/expectations/class_use_as.rs rename to tests/expectations/tests/class_use_as.rs diff --git a/tests/expectations/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs similarity index 100% rename from tests/expectations/class_with_dtor.rs rename to tests/expectations/tests/class_with_dtor.rs diff --git a/tests/expectations/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs similarity index 100% rename from tests/expectations/class_with_inner_struct.rs rename to tests/expectations/tests/class_with_inner_struct.rs diff --git a/tests/expectations/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs similarity index 100% rename from tests/expectations/class_with_typedef.rs rename to tests/expectations/tests/class_with_typedef.rs diff --git a/tests/expectations/complex.rs b/tests/expectations/tests/complex.rs similarity index 100% rename from tests/expectations/complex.rs rename to tests/expectations/tests/complex.rs diff --git a/tests/expectations/const_enum_unnamed.rs b/tests/expectations/tests/const_enum_unnamed.rs similarity index 100% rename from tests/expectations/const_enum_unnamed.rs rename to tests/expectations/tests/const_enum_unnamed.rs diff --git a/tests/expectations/const_ptr.rs b/tests/expectations/tests/const_ptr.rs similarity index 100% rename from tests/expectations/const_ptr.rs rename to tests/expectations/tests/const_ptr.rs diff --git a/tests/expectations/const_resolved_ty.rs b/tests/expectations/tests/const_resolved_ty.rs similarity index 100% rename from tests/expectations/const_resolved_ty.rs rename to tests/expectations/tests/const_resolved_ty.rs diff --git a/tests/expectations/const_tparam.rs b/tests/expectations/tests/const_tparam.rs similarity index 100% rename from tests/expectations/const_tparam.rs rename to tests/expectations/tests/const_tparam.rs diff --git a/tests/expectations/crtp.rs b/tests/expectations/tests/crtp.rs similarity index 100% rename from tests/expectations/crtp.rs rename to tests/expectations/tests/crtp.rs diff --git a/tests/expectations/decl_extern_int_twice.rs b/tests/expectations/tests/decl_extern_int_twice.rs similarity index 100% rename from tests/expectations/decl_extern_int_twice.rs rename to tests/expectations/tests/decl_extern_int_twice.rs diff --git a/tests/expectations/decl_ptr_to_array.rs b/tests/expectations/tests/decl_ptr_to_array.rs similarity index 100% rename from tests/expectations/decl_ptr_to_array.rs rename to tests/expectations/tests/decl_ptr_to_array.rs diff --git a/tests/expectations/duplicated_constants_in_ns.rs b/tests/expectations/tests/duplicated_constants_in_ns.rs similarity index 100% rename from tests/expectations/duplicated_constants_in_ns.rs rename to tests/expectations/tests/duplicated_constants_in_ns.rs diff --git a/tests/expectations/elaborated.rs b/tests/expectations/tests/elaborated.rs similarity index 100% rename from tests/expectations/elaborated.rs rename to tests/expectations/tests/elaborated.rs diff --git a/tests/expectations/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs similarity index 100% rename from tests/expectations/empty_template_param_name.rs rename to tests/expectations/tests/empty_template_param_name.rs diff --git a/tests/expectations/enum.rs b/tests/expectations/tests/enum.rs similarity index 100% rename from tests/expectations/enum.rs rename to tests/expectations/tests/enum.rs diff --git a/tests/expectations/enum_alias.rs b/tests/expectations/tests/enum_alias.rs similarity index 100% rename from tests/expectations/enum_alias.rs rename to tests/expectations/tests/enum_alias.rs diff --git a/tests/expectations/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs similarity index 100% rename from tests/expectations/enum_and_vtable_mangling.rs rename to tests/expectations/tests/enum_and_vtable_mangling.rs diff --git a/tests/expectations/enum_dupe.rs b/tests/expectations/tests/enum_dupe.rs similarity index 100% rename from tests/expectations/enum_dupe.rs rename to tests/expectations/tests/enum_dupe.rs diff --git a/tests/expectations/enum_explicit_type.rs b/tests/expectations/tests/enum_explicit_type.rs similarity index 100% rename from tests/expectations/enum_explicit_type.rs rename to tests/expectations/tests/enum_explicit_type.rs diff --git a/tests/expectations/enum_negative.rs b/tests/expectations/tests/enum_negative.rs similarity index 100% rename from tests/expectations/enum_negative.rs rename to tests/expectations/tests/enum_negative.rs diff --git a/tests/expectations/enum_packed.rs b/tests/expectations/tests/enum_packed.rs similarity index 100% rename from tests/expectations/enum_packed.rs rename to tests/expectations/tests/enum_packed.rs diff --git a/tests/expectations/extern.rs b/tests/expectations/tests/extern.rs similarity index 100% rename from tests/expectations/extern.rs rename to tests/expectations/tests/extern.rs diff --git a/tests/expectations/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs similarity index 100% rename from tests/expectations/forward_declared_struct.rs rename to tests/expectations/tests/forward_declared_struct.rs diff --git a/tests/expectations/func_proto.rs b/tests/expectations/tests/func_proto.rs similarity index 100% rename from tests/expectations/func_proto.rs rename to tests/expectations/tests/func_proto.rs diff --git a/tests/expectations/func_ptr.rs b/tests/expectations/tests/func_ptr.rs similarity index 100% rename from tests/expectations/func_ptr.rs rename to tests/expectations/tests/func_ptr.rs diff --git a/tests/expectations/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs similarity index 100% rename from tests/expectations/func_ptr_in_struct.rs rename to tests/expectations/tests/func_ptr_in_struct.rs diff --git a/tests/expectations/func_with_array_arg.rs b/tests/expectations/tests/func_with_array_arg.rs similarity index 100% rename from tests/expectations/func_with_array_arg.rs rename to tests/expectations/tests/func_with_array_arg.rs diff --git a/tests/expectations/func_with_func_ptr_arg.rs b/tests/expectations/tests/func_with_func_ptr_arg.rs similarity index 100% rename from tests/expectations/func_with_func_ptr_arg.rs rename to tests/expectations/tests/func_with_func_ptr_arg.rs diff --git a/tests/expectations/in_class_typedef.rs b/tests/expectations/tests/in_class_typedef.rs similarity index 100% rename from tests/expectations/in_class_typedef.rs rename to tests/expectations/tests/in_class_typedef.rs diff --git a/tests/expectations/inherit_named.rs b/tests/expectations/tests/inherit_named.rs similarity index 100% rename from tests/expectations/inherit_named.rs rename to tests/expectations/tests/inherit_named.rs diff --git a/tests/expectations/inherit_typedef.rs b/tests/expectations/tests/inherit_typedef.rs similarity index 100% rename from tests/expectations/inherit_typedef.rs rename to tests/expectations/tests/inherit_typedef.rs diff --git a/tests/expectations/inner_const.rs b/tests/expectations/tests/inner_const.rs similarity index 100% rename from tests/expectations/inner_const.rs rename to tests/expectations/tests/inner_const.rs diff --git a/tests/expectations/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs similarity index 100% rename from tests/expectations/inner_template_self.rs rename to tests/expectations/tests/inner_template_self.rs diff --git a/tests/expectations/int128_t.rs b/tests/expectations/tests/int128_t.rs similarity index 100% rename from tests/expectations/int128_t.rs rename to tests/expectations/tests/int128_t.rs diff --git a/tests/expectations/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs similarity index 100% rename from tests/expectations/jsval_layout_opaque.rs rename to tests/expectations/tests/jsval_layout_opaque.rs diff --git a/tests/expectations/keywords.rs b/tests/expectations/tests/keywords.rs similarity index 100% rename from tests/expectations/keywords.rs rename to tests/expectations/tests/keywords.rs diff --git a/tests/expectations/mutable.rs b/tests/expectations/tests/mutable.rs similarity index 100% rename from tests/expectations/mutable.rs rename to tests/expectations/tests/mutable.rs diff --git a/tests/expectations/namespace.rs b/tests/expectations/tests/namespace.rs similarity index 100% rename from tests/expectations/namespace.rs rename to tests/expectations/tests/namespace.rs diff --git a/tests/expectations/nested.rs b/tests/expectations/tests/nested.rs similarity index 100% rename from tests/expectations/nested.rs rename to tests/expectations/tests/nested.rs diff --git a/tests/expectations/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs similarity index 100% rename from tests/expectations/nested_vtable.rs rename to tests/expectations/tests/nested_vtable.rs diff --git a/tests/expectations/no_copy.rs b/tests/expectations/tests/no_copy.rs similarity index 100% rename from tests/expectations/no_copy.rs rename to tests/expectations/tests/no_copy.rs diff --git a/tests/expectations/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs similarity index 100% rename from tests/expectations/nsStyleAutoArray.rs rename to tests/expectations/tests/nsStyleAutoArray.rs diff --git a/tests/expectations/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs similarity index 100% rename from tests/expectations/only_bitfields.rs rename to tests/expectations/tests/only_bitfields.rs diff --git a/tests/expectations/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs similarity index 100% rename from tests/expectations/opaque_in_struct.rs rename to tests/expectations/tests/opaque_in_struct.rs diff --git a/tests/expectations/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs similarity index 100% rename from tests/expectations/opaque_pointer.rs rename to tests/expectations/tests/opaque_pointer.rs diff --git a/tests/expectations/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs similarity index 100% rename from tests/expectations/opaque_typedef.rs rename to tests/expectations/tests/opaque_typedef.rs diff --git a/tests/expectations/overflowed_enum.rs b/tests/expectations/tests/overflowed_enum.rs similarity index 100% rename from tests/expectations/overflowed_enum.rs rename to tests/expectations/tests/overflowed_enum.rs diff --git a/tests/expectations/private.rs b/tests/expectations/tests/private.rs similarity index 100% rename from tests/expectations/private.rs rename to tests/expectations/tests/private.rs diff --git a/tests/expectations/redeclaration.rs b/tests/expectations/tests/redeclaration.rs similarity index 100% rename from tests/expectations/redeclaration.rs rename to tests/expectations/tests/redeclaration.rs diff --git a/tests/expectations/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs similarity index 100% rename from tests/expectations/ref_argument_array.rs rename to tests/expectations/tests/ref_argument_array.rs diff --git a/tests/expectations/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs similarity index 100% rename from tests/expectations/replace_template_alias.rs rename to tests/expectations/tests/replace_template_alias.rs diff --git a/tests/expectations/replaces_double.rs b/tests/expectations/tests/replaces_double.rs similarity index 100% rename from tests/expectations/replaces_double.rs rename to tests/expectations/tests/replaces_double.rs diff --git a/tests/expectations/size_t_template.rs b/tests/expectations/tests/size_t_template.rs similarity index 100% rename from tests/expectations/size_t_template.rs rename to tests/expectations/tests/size_t_template.rs diff --git a/tests/expectations/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs similarity index 100% rename from tests/expectations/struct_containing_forward_declared_struct.rs rename to tests/expectations/tests/struct_containing_forward_declared_struct.rs diff --git a/tests/expectations/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs similarity index 100% rename from tests/expectations/struct_with_anon_struct.rs rename to tests/expectations/tests/struct_with_anon_struct.rs diff --git a/tests/expectations/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs similarity index 100% rename from tests/expectations/struct_with_anon_struct_array.rs rename to tests/expectations/tests/struct_with_anon_struct_array.rs diff --git a/tests/expectations/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs similarity index 100% rename from tests/expectations/struct_with_anon_struct_pointer.rs rename to tests/expectations/tests/struct_with_anon_struct_pointer.rs diff --git a/tests/expectations/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs similarity index 100% rename from tests/expectations/struct_with_anon_union.rs rename to tests/expectations/tests/struct_with_anon_union.rs diff --git a/tests/expectations/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs similarity index 100% rename from tests/expectations/struct_with_anon_unnamed_struct.rs rename to tests/expectations/tests/struct_with_anon_unnamed_struct.rs diff --git a/tests/expectations/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs similarity index 100% rename from tests/expectations/struct_with_anon_unnamed_union.rs rename to tests/expectations/tests/struct_with_anon_unnamed_union.rs diff --git a/tests/expectations/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs similarity index 100% rename from tests/expectations/struct_with_bitfields.rs rename to tests/expectations/tests/struct_with_bitfields.rs diff --git a/tests/expectations/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs similarity index 100% rename from tests/expectations/struct_with_derive_debug.rs rename to tests/expectations/tests/struct_with_derive_debug.rs diff --git a/tests/expectations/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs similarity index 100% rename from tests/expectations/struct_with_nesting.rs rename to tests/expectations/tests/struct_with_nesting.rs diff --git a/tests/expectations/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs similarity index 100% rename from tests/expectations/struct_with_packing.rs rename to tests/expectations/tests/struct_with_packing.rs diff --git a/tests/expectations/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs similarity index 100% rename from tests/expectations/struct_with_struct.rs rename to tests/expectations/tests/struct_with_struct.rs diff --git a/tests/expectations/struct_with_typedef_template_arg.rs b/tests/expectations/tests/struct_with_typedef_template_arg.rs similarity index 100% rename from tests/expectations/struct_with_typedef_template_arg.rs rename to tests/expectations/tests/struct_with_typedef_template_arg.rs diff --git a/tests/expectations/template.rs b/tests/expectations/tests/template.rs similarity index 100% rename from tests/expectations/template.rs rename to tests/expectations/tests/template.rs diff --git a/tests/expectations/template_alias.rs b/tests/expectations/tests/template_alias.rs similarity index 100% rename from tests/expectations/template_alias.rs rename to tests/expectations/tests/template_alias.rs diff --git a/tests/expectations/template_alias_basic.rs b/tests/expectations/tests/template_alias_basic.rs similarity index 100% rename from tests/expectations/template_alias_basic.rs rename to tests/expectations/tests/template_alias_basic.rs diff --git a/tests/expectations/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs similarity index 100% rename from tests/expectations/template_alias_namespace.rs rename to tests/expectations/tests/template_alias_namespace.rs diff --git a/tests/expectations/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs similarity index 100% rename from tests/expectations/template_typedef_transitive_param.rs rename to tests/expectations/tests/template_typedef_transitive_param.rs diff --git a/tests/expectations/template_typedefs.rs b/tests/expectations/tests/template_typedefs.rs similarity index 100% rename from tests/expectations/template_typedefs.rs rename to tests/expectations/tests/template_typedefs.rs diff --git a/tests/expectations/type_alias_empty.rs b/tests/expectations/tests/type_alias_empty.rs similarity index 100% rename from tests/expectations/type_alias_empty.rs rename to tests/expectations/tests/type_alias_empty.rs diff --git a/tests/expectations/typeref.rs b/tests/expectations/tests/typeref.rs similarity index 100% rename from tests/expectations/typeref.rs rename to tests/expectations/tests/typeref.rs diff --git a/tests/expectations/union_dtor.rs b/tests/expectations/tests/union_dtor.rs similarity index 100% rename from tests/expectations/union_dtor.rs rename to tests/expectations/tests/union_dtor.rs diff --git a/tests/expectations/union_fields.rs b/tests/expectations/tests/union_fields.rs similarity index 100% rename from tests/expectations/union_fields.rs rename to tests/expectations/tests/union_fields.rs diff --git a/tests/expectations/union_template.rs b/tests/expectations/tests/union_template.rs similarity index 100% rename from tests/expectations/union_template.rs rename to tests/expectations/tests/union_template.rs diff --git a/tests/expectations/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs similarity index 100% rename from tests/expectations/union_with_anon_struct.rs rename to tests/expectations/tests/union_with_anon_struct.rs diff --git a/tests/expectations/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs similarity index 100% rename from tests/expectations/union_with_anon_struct_bitfield.rs rename to tests/expectations/tests/union_with_anon_struct_bitfield.rs diff --git a/tests/expectations/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs similarity index 100% rename from tests/expectations/union_with_anon_union.rs rename to tests/expectations/tests/union_with_anon_union.rs diff --git a/tests/expectations/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs similarity index 100% rename from tests/expectations/union_with_anon_unnamed_struct.rs rename to tests/expectations/tests/union_with_anon_unnamed_struct.rs diff --git a/tests/expectations/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs similarity index 100% rename from tests/expectations/union_with_anon_unnamed_union.rs rename to tests/expectations/tests/union_with_anon_unnamed_union.rs diff --git a/tests/expectations/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs similarity index 100% rename from tests/expectations/union_with_big_member.rs rename to tests/expectations/tests/union_with_big_member.rs diff --git a/tests/expectations/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs similarity index 100% rename from tests/expectations/union_with_nesting.rs rename to tests/expectations/tests/union_with_nesting.rs diff --git a/tests/expectations/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs similarity index 100% rename from tests/expectations/unknown_attr.rs rename to tests/expectations/tests/unknown_attr.rs diff --git a/tests/expectations/using.rs b/tests/expectations/tests/using.rs similarity index 100% rename from tests/expectations/using.rs rename to tests/expectations/tests/using.rs diff --git a/tests/expectations/vector.rs b/tests/expectations/tests/vector.rs similarity index 100% rename from tests/expectations/vector.rs rename to tests/expectations/tests/vector.rs diff --git a/tests/expectations/virtual_dtor.rs b/tests/expectations/tests/virtual_dtor.rs similarity index 100% rename from tests/expectations/virtual_dtor.rs rename to tests/expectations/tests/virtual_dtor.rs diff --git a/tests/expectations/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs similarity index 100% rename from tests/expectations/virtual_overloaded.rs rename to tests/expectations/tests/virtual_overloaded.rs diff --git a/tests/expectations/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs similarity index 100% rename from tests/expectations/vtable_recursive_sig.rs rename to tests/expectations/tests/vtable_recursive_sig.rs diff --git a/tests/expectations/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs similarity index 100% rename from tests/expectations/weird_bitfields.rs rename to tests/expectations/tests/weird_bitfields.rs diff --git a/tests/expectations/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs similarity index 100% rename from tests/expectations/what_is_going_on.rs rename to tests/expectations/tests/what_is_going_on.rs diff --git a/tests/expectations/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs similarity index 100% rename from tests/expectations/whitelist_basic.rs rename to tests/expectations/tests/whitelist_basic.rs diff --git a/tests/expectations/whitelist_vars.rs b/tests/expectations/tests/whitelist_vars.rs similarity index 100% rename from tests/expectations/whitelist_vars.rs rename to tests/expectations/tests/whitelist_vars.rs diff --git a/tests/expectations/variadic_template_args.rs b/tests/expectations/variadic_template_args.rs deleted file mode 100644 index f0c6810651..0000000000 --- a/tests/expectations/variadic_template_args.rs +++ /dev/null @@ -1,21 +0,0 @@ -/* automatically generated by rust-bindgen */ - - -#![allow(non_snake_case)] - - -#[repr(C)] -pub struct RefPtr { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData, -} -#[repr(C)] -pub struct RefPtr_Proxy { - pub _address: u8, - pub _phantom_0: ::std::marker::PhantomData, - pub _phantom_1: ::std::marker::PhantomData, - pub _phantom_2: ::std::marker::PhantomData, -} -pub type RefPtr_Proxy_member_function = - *mut ::std::option::Option type-parameter-1-0>; diff --git a/tests/tests.rs b/tests/tests.rs index 4954ac6fa7..1f72fccf9d 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -24,9 +24,9 @@ fn spawn_run_bindgen(run_bindgen: P, let bindgen = bindgen.as_ref(); let header = header.as_ref(); - // Convert from "tests/headers/foo.hpp" to "tests/expectations/foo.rs" by + // Convert from "tests/headers/foo.hpp" to "tests/expectations/tests/foo.rs" by // saving the filename, popping off "headers/foo.hpp", pushing - // "expectations", pushing the saved filename, and finally modifying the + // "expectations/tests", pushing the saved filename, and finally modifying the // extension. let mut expected = PathBuf::from(header); @@ -36,6 +36,7 @@ fn spawn_run_bindgen(run_bindgen: P, expected.pop(); expected.pop(); expected.push("expectations"); + expected.push("tests"); expected.push(file_name); expected.set_extension("rs"); diff --git a/tests/tools/run-bindgen.py b/tests/tools/run-bindgen.py index 1f5f504e2b..aad210da53 100755 --- a/tests/tools/run-bindgen.py +++ b/tests/tools/run-bindgen.py @@ -130,16 +130,6 @@ def generate_bindings(bindgen, dummy_uses, flags, header, output): command.append(header) run_cmd(command, cwd=os.getcwd(), env=make_bindgen_env()) -def test_generated_bindings(bindings): - """Run the generated bindings's #[test]s.""" - name = None - # Do not delete the temp file, because we need to end the with block before - # we can run the tests. - with tempfile.NamedTemporaryFile(delete=False) as tests: - name = tests.name - run_cmd(["rustc", "--test", bindings, "-o", name]) - run_cmd([name]) - def check_actual_vs_expected(expected_bindings, rust_bindings_path): """ Check the actual generated rust bindings versus our expected generated rust @@ -177,7 +167,6 @@ def main(): test_flags, args.header, args.rust_bindings) - test_generated_bindings(args.rust_bindings) check_actual_vs_expected(expected_bindings, args.rust_bindings) sys.exit(0)