From: Alexander Shaposhnikov Date: Thu, 6 Aug 2015 02:25:51 +0000 (-0700) Subject: Make Core.size test portable X-Git-Tag: v0.53.0~4 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d7eea4933bb2273aac4f687869f2674ada3869f2;p=folly.git Make Core.size test portable 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 --- 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)); }