Commit d7eea493 authored by Alexander Shaposhnikov's avatar Alexander Shaposhnikov Committed by facebook-github-bot-1

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
parent c5992522
......@@ -22,7 +22,23 @@
using namespace folly;
TEST(Core, size) {
struct Gold {
char lambdaBuf_[8 * sizeof(void*)];
folly::Optional<Try<Unit>> result_;
std::function<void(Try<Unit>&&)> callback_;
detail::FSM<detail::State> fsm_;
std::atomic<unsigned char> attached_;
std::atomic<bool> active_;
std::atomic<bool> interruptHandlerSet_;
folly::MicroSpinLock interruptLock_;
folly::MicroSpinLock executorLock_;
int8_t priority_;
Executor* executor_;
std::shared_ptr<RequestContext> context_;
std::unique_ptr<exception_wrapper> interrupt_;
std::function<void(exception_wrapper const&)> interruptHandler_;
};
// If this number goes down, it's fine!
// If it goes up, please seek professional advice ;-)
EXPECT_EQ(192, sizeof(detail::Core<Unit>));
EXPECT_GE(sizeof(Gold), sizeof(detail::Core<Unit>));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment