From d7eea4933bb2273aac4f687869f2674ada3869f2 Mon Sep 17 00:00:00 2001 From: Alexander Shaposhnikov Date: Wed, 5 Aug 2015 19:25:51 -0700 Subject: [PATCH] Make Core.size test portable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Summary: Add a golden struct for checking the size of Core. It makes this test pass on OSX (now failing because of the different size of std::function). Reviewed By: @​hannesr Differential Revision: D2315429 --- folly/futures/test/CoreTest.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/folly/futures/test/CoreTest.cpp b/folly/futures/test/CoreTest.cpp index dedfeec3..4d824d59 100644 --- a/folly/futures/test/CoreTest.cpp +++ b/folly/futures/test/CoreTest.cpp @@ -22,7 +22,23 @@ using namespace folly; TEST(Core, size) { + struct Gold { + char lambdaBuf_[8 * sizeof(void*)]; + folly::Optional> result_; + std::function&&)> callback_; + detail::FSM fsm_; + std::atomic attached_; + std::atomic active_; + std::atomic interruptHandlerSet_; + folly::MicroSpinLock interruptLock_; + folly::MicroSpinLock executorLock_; + int8_t priority_; + Executor* executor_; + std::shared_ptr context_; + std::unique_ptr interrupt_; + std::function interruptHandler_; + }; // If this number goes down, it's fine! // If it goes up, please seek professional advice ;-) - EXPECT_EQ(192, sizeof(detail::Core)); + EXPECT_GE(sizeof(Gold), sizeof(detail::Core)); } -- 2.34.1