Bug 1802320 - Green up and re-enable style system layout tests. r=boris

It's unclear to me when they were disabled, but we do want to enable
these as otherwise there's no way to catch bindgen issues that can end
up in subtle bugs at best, or memory corruption at worst.

Differential Revision: https://phabricator.services.mozilla.com/D162997
This commit is contained in:
Emilio Cobos Álvarez 2022-11-25 10:52:26 +00:00
parent a1e10a5441
commit 41d2485a4e
4 changed files with 21 additions and 5 deletions

View File

@ -51,8 +51,7 @@ hide-types = [
# https://github.com/rust-lang/rust-bindgen/issues/1503
"mozilla::StyleTimingFunction.*",
# https://github.com/rust-lang/rust-bindgen/issues/1559
"mozilla::StyleGenericTransformOperation_.*",
"mozilla::StyleGenericColor_.*",
"mozilla::StyleGeneric.*",
]
bitfield-enums = [
"nsChangeHint",
@ -402,6 +401,8 @@ opaque-types = [
# generate it conditionally.
"JS::Rooted",
"mozilla::Maybe",
"mozilla::Variant",
"mozilla::dom::TreeOrderedArray", # AutoTArray<>
"gfxSize", # <- union { struct { T width; T height; }; T components[2] };
"gfxSize_Super", # Ditto.
"mozilla::StyleAnimationValue",
@ -409,6 +410,7 @@ opaque-types = [
"mozilla::dom::.*Callback", # Pulls in ErrorResult and other things that
# don't align properly on Linux 32-bit
"mozilla::SchedulerGroup", # Non-standard-layout packing of field into superclass
"mozilla::Widget.*Event", # As above
"mozilla::detail::GkAtoms", # https://bugzilla.mozilla.org/show_bug.cgi?id=1517685
"mozilla::detail::ThreadLocal.*",
]
@ -523,6 +525,12 @@ cbindgen-types = [
{ gecko = "StyleOwnedOrNull", servo = "crate::gecko_bindings::sugar::ownership::OwnedOrNull" },
{ gecko = "StyleStrong", servo = "crate::gecko_bindings::sugar::ownership::Strong" },
{ gecko = "StyleGenericFontFamily", servo = "crate::values::computed::font::GenericFontFamily" },
{ gecko = "StyleGenericPosition", servo = "crate::values::generics::position::GenericPosition" },
{ gecko = "StyleGenericMozImageRect", servo = "crate::values::generics::image::GenericMozImageRect" },
{ gecko = "StyleGenericCounterPair", servo = "crate::values::generics::counters::GenericCounterPair" },
{ gecko = "StyleGenericShapeRadius", servo = "crate::values::generics::basic_shape::GenericShapeRadius" },
{ gecko = "StyleGenericClipRect", servo = "crate::values::generics::GenericClipRect" },
{ gecko = "StyleGenericCursorImage", servo = "crate::values::generics::ui::GenericCursorImage" },
{ gecko = "StyleFontFamily", servo = "crate::values::computed::font::FontFamily" },
{ gecko = "StyleGenericFontSizeAdjust", servo = "crate::values::generics::font::GenericFontSizeAdjust" },
{ gecko = "StyleFontFamilyNameSyntax", servo = "crate::values::computed::font::FontFamilyNameSyntax" },
@ -552,6 +560,7 @@ cbindgen-types = [
{ gecko = "StyleAngle", servo = "crate::values::computed::Angle" },
{ gecko = "StyleGenericBorderImageSideWidth", servo = "crate::values::generics::border::BorderImageSideWidth" },
{ gecko = "StyleGenericUrlOrNone", servo = "crate::values::generics::url::UrlOrNone" },
{ gecko = "StyleGenericCalcNode", servo = "crate::values::generics::calc::GenericCalcNode" },
{ gecko = "StyleCssUrl", servo = "crate::gecko::url::CssUrl" },
{ gecko = "StyleSpecifiedUrl", servo = "crate::gecko::url::SpecifiedUrl" },
{ gecko = "StyleSpecifiedImageUrl", servo = "crate::gecko::url::SpecifiedImageUrl" },

View File

@ -19,7 +19,7 @@
#ifdef XP_WIN
# include <cstdint>
#endif
#ifdef XP_MACOSX
#if defined(XP_MACOSX) && !defined(RUST_BINDGEN)
# include <mach/mach.h>
#endif
@ -158,7 +158,7 @@ struct FileHandleDeleter {
MFBT_API void operator()(FileHandleHelper aHelper);
};
#ifdef XP_MACOSX
#if defined(XP_MACOSX) && !defined(RUST_BINDGEN)
struct MachPortHelper {
MOZ_IMPLICIT MachPortHelper(mach_port_t aPort) : mPort(aPort) {}
@ -215,7 +215,7 @@ using UniqueFreePtr = UniquePtr<T, detail::FreePolicy<T>>;
using UniqueFileHandle =
UniquePtr<detail::FileHandleType, detail::FileHandleDeleter>;
#ifdef XP_MACOSX
#if defined(XP_MACOSX) && !defined(RUST_BINDGEN)
// A RAII class for a Mach port that names a send right.
using UniqueMachSendRight =
UniquePtr<mach_port_t, detail::MachSendRightDeleter>;

View File

@ -16,6 +16,9 @@
non_upper_case_globals,
missing_docs
)]
// TODO: Remove this when updating bindgen, see
// https://github.com/rust-lang/rust-bindgen/issues/1651
#[cfg_attr(test, allow(deref_nullptr))]
pub mod structs {
include!(concat!(env!("OUT_DIR"), "/gecko/structs.rs"));
}

View File

@ -38,6 +38,10 @@ RUST_TESTS = [
# altogether.
if not CONFIG["MOZ_CODE_COVERAGE"]:
RUST_TESTS += ["stylo_tests"]
# Same happens for the style tests, except the windows linker is not great
# at eliminating dead code, so we end up with some missing symbols too.
if CONFIG["OS_TARGET"] != "WINNT":
RUST_TESTS += ["style"]
if CONFIG["CPU_ARCH"] != "x86":
# malloc_size_of_derive is a build dependency, so if we are doing