X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FThreadCachedArenaTest.cpp;h=ea978dc1e8216548f178bc4cbc050bf766ffe9f8;hb=5a122efcd603512292bd09b541c212773d2b7d55;hp=431a044b9233cab1d144fd7efc92659f75b0069f;hpb=762965ce25c73623845d3075111b565421dcc608;p=folly.git diff --git a/folly/test/ThreadCachedArenaTest.cpp b/folly/test/ThreadCachedArenaTest.cpp index 431a044b..ea978dc1 100644 --- a/folly/test/ThreadCachedArenaTest.cpp +++ b/folly/test/ThreadCachedArenaTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "folly/ThreadCachedArena.h" -#include "folly/Memory.h" +#include +#include #include #include @@ -26,10 +26,10 @@ #include #include -#include -#include "folly/Range.h" -#include "folly/Benchmark.h" +#include +#include +#include using namespace folly; @@ -94,8 +94,7 @@ void ArenaTester::merge(ArenaTester&& other) { } // namespace TEST(ThreadCachedArena, BlockSize) { - struct Align { char c; } __attribute__((aligned)); - static const size_t alignment = alignof(Align); + static const size_t alignment = alignof(std::max_align_t); static const size_t requestedBlockSize = 64; ThreadCachedArena arena(requestedBlockSize); @@ -119,9 +118,13 @@ TEST(ThreadCachedArena, BlockSize) { TEST(ThreadCachedArena, SingleThreaded) { static const size_t requestedBlockSize = 64; ThreadCachedArena arena(requestedBlockSize); + EXPECT_EQ(arena.totalSize(), sizeof(ThreadCachedArena)); + ArenaTester tester(arena); tester.allocate(100, 100 << 10); tester.verify(); + + EXPECT_GT(arena.totalSize(), sizeof(ThreadCachedArena)); } TEST(ThreadCachedArena, MultiThreaded) { @@ -256,11 +259,10 @@ BENCHMARK_DRAW_LINE() int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); - google::ParseCommandLineFlags(&argc, &argv, true); + gflags::ParseCommandLineFlags(&argc, &argv, true); auto ret = RUN_ALL_TESTS(); if (!ret && FLAGS_benchmark) { folly::runBenchmarks(); } return ret; } -