Commit 45666e3d authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

update the Core fake layout for testing

Summary: There is a golden image of the `Core` layout so that tests will catch accidental increases of the `Core` size. Updated it to the latest `Core` layout.

Differential Revision: D29251632

fbshipit-source-id: d16086390548848f4302678e0b86d9841be1140b
parent 40d61f3f
......@@ -22,22 +22,30 @@
using namespace folly;
TEST(Core, size) {
static constexpr size_t lambdaBufSize = 8 * sizeof(void*);
struct Gold {
typename std::aligned_storage<lambdaBufSize>::type lambdaBuf_;
folly::Optional<Try<Unit>> result_;
struct KeepAliveOrDeferredGold {
enum class State {};
State state_;
Executor* executor_;
};
class CoreBaseGold {
public:
virtual ~CoreBaseGold() = 0;
private:
folly::Function<void(Try<Unit>&&)> callback_;
std::atomic<futures::detail::State> state_;
std::atomic<unsigned char> attached_;
std::atomic<bool> interruptHandlerSet_;
std::atomic<unsigned char> callbackReferences_;
futures::detail::SpinLock interruptLock_;
int8_t priority_;
Executor* executor_;
KeepAliveOrDeferredGold executor_;
std::shared_ptr<RequestContext> context_;
std::unique_ptr<exception_wrapper> interrupt_;
std::function<void(exception_wrapper const&)> interruptHandler_;
std::atomic<futures::detail::InterruptHandler*> interruptHandler_{};
CoreBaseGold* proxy_;
};
class CoreGold : Try<Unit>, public CoreBaseGold {};
// If this number goes down, it's fine!
// If it goes up, please seek professional advice ;-)
EXPECT_GE(sizeof(Gold), sizeof(futures::detail::Core<Unit>));
EXPECT_EQ(sizeof(CoreGold), sizeof(futures::detail::Core<Unit>));
EXPECT_EQ(alignof(CoreGold), alignof(futures::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