From: Francis Ma Date: Fri, 5 Feb 2016 23:00:39 +0000 (-0800) Subject: Loosen restriction to get folly::future::CoreTest pass on android X-Git-Tag: deprecate-dynamic-initializer~90 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4c0ddd98fddc75be67fd29afbf760dff93220b92;p=folly.git Loosen restriction to get folly::future::CoreTest pass on android Summary: Due to different way of padding, CoreTest failed on android. Loosen the check to make it pass. Reviewed By: mzlee Differential Revision: D2907987 fb-gh-sync-id: 81d715725d6908ec7b259b0a67789a91ed63df71 --- diff --git a/folly/futures/test/CoreTest.cpp b/folly/futures/test/CoreTest.cpp index 4d824d59..2b04998c 100644 --- a/folly/futures/test/CoreTest.cpp +++ b/folly/futures/test/CoreTest.cpp @@ -21,6 +21,14 @@ using namespace folly; +// On android, we see a different way of memory alignment of this structure. +// Adding some extra padding to make it pass. +#ifdef __ANDROID_ +constexpr size_t extraPadding = 8; +#else +constexpr size_t extraPadding = 0; +#endif + TEST(Core, size) { struct Gold { char lambdaBuf_[8 * sizeof(void*)]; @@ -40,5 +48,5 @@ TEST(Core, size) { }; // If this number goes down, it's fine! // If it goes up, please seek professional advice ;-) - EXPECT_GE(sizeof(Gold), sizeof(detail::Core)); + EXPECT_GE(sizeof(Gold) + extraPadding, sizeof(detail::Core)); }