proxygen
FlatCombiningTest.cpp File Reference
#include <folly/experimental/flat_combining/test/FlatCombiningTestHelpers.h>
#include <folly/portability/GTest.h>
#include <glog/logging.h>
#include <mutex>

Go to the source code of this file.

Classes

struct  Params
 
class  FlatCombiningTest
 

Functions

 TEST (FlatCombiningTest, lock_holder)
 
 TEST_P (FlatCombiningTest, combining)
 
 TEST_P (FlatCombiningTest, more_threads_than_records)
 
 INSTANTIATE_TEST_CASE_P (Foo, FlatCombiningTest,::testing::ValuesIn(params))
 

Variables

constexpr int LINES = 5
 
constexpr int NUM_RECS = 20
 
constexpr int WORK = 0
 
constexpr int ITERS = 100
 
static std::vector< int > nthr = {1, 10, 20}
 
constexpr Params params []
 

Function Documentation

INSTANTIATE_TEST_CASE_P ( Foo  ,
FlatCombiningTest  ,
::testing::ValuesIn(params  
)
TEST ( FlatCombiningTest  ,
lock_holder   
)

Definition at line 39 of file FlatCombiningTest.cpp.

References folly::FlatCombining< FcSimpleExample< Mutex, Atom >, Mutex, Atom >::holdLock(), folly::FlatCombining< FcSimpleExample< Mutex, Atom >, Mutex, Atom >::releaseExclusive(), and folly::FlatCombining< FcSimpleExample< Mutex, Atom >, Mutex, Atom >::tryExclusive().

39  {
41  {
42  std::unique_lock<std::mutex> l;
43  ex.holdLock(l);
44  CHECK(l.owns_lock());
45  }
46  {
47  std::unique_lock<std::mutex> l;
48  ex.holdLock(l, std::defer_lock);
49  CHECK(l.try_lock());
50  }
51  CHECK(ex.tryExclusive());
52  ex.releaseExclusive();
53 }
TEST_P ( FlatCombiningTest  ,
combining   
)

Definition at line 55 of file FlatCombiningTest.cpp.

References Params::combining, Params::dedicated, ITERS, LINES, NUM_RECS, folly::test::run_test(), Params::simple, Params::syncop, Params::tc, and WORK.

55  {
56  Params p = GetParam();
57  for (auto n : nthr) {
58  run_test(
59  n,
60  LINES,
61  NUM_RECS,
62  WORK,
63  ITERS,
64  p.combining,
65  p.simple,
66  p.dedicated,
67  p.tc,
68  p.syncop,
69  true,
70  true);
71  }
72 }
static std::vector< int > nthr
constexpr int ITERS
uint64_t run_test(int nthreads, int lines, int numRecs, int work, int ops, bool combining, bool simple, bool dedicated, bool tc, bool syncops, bool excl=false, bool allocAll=false)
constexpr int LINES
constexpr int NUM_RECS
constexpr int WORK
TEST_P ( FlatCombiningTest  ,
more_threads_than_records   
)

Definition at line 74 of file FlatCombiningTest.cpp.

References Params::combining, Params::dedicated, ITERS, LINES, folly::test::run_test(), Params::simple, Params::syncop, Params::tc, and WORK.

74  {
75  int n = 20;
76  int num_recs = 1;
77 
78  Params p = GetParam();
79  run_test(
80  n,
81  LINES,
82  num_recs,
83  WORK,
84  ITERS,
85  p.combining,
86  p.simple,
87  p.dedicated,
88  p.tc,
89  p.syncop,
90  true,
91  true);
92 }
constexpr int ITERS
uint64_t run_test(int nthreads, int lines, int numRecs, int work, int ops, bool combining, bool simple, bool dedicated, bool tc, bool syncops, bool excl=false, bool allocAll=false)
constexpr int LINES
constexpr int WORK

Variable Documentation

constexpr int ITERS = 100

Definition at line 29 of file FlatCombiningTest.cpp.

Referenced by TEST_P().

constexpr int LINES = 5

Definition at line 26 of file FlatCombiningTest.cpp.

Referenced by TEST_P().

std::vector<int> nthr = {1, 10, 20}
static

Definition at line 31 of file FlatCombiningTest.cpp.

constexpr int NUM_RECS = 20

Definition at line 27 of file FlatCombiningTest.cpp.

Referenced by TEST_P().

constexpr Params params[]
Initial value:
= {
{false, false, false, false, false},
{true, true, true, false, true},
{true, true, true, false, false},
{true, true, true, true, true},
{true, true, true, true, false},
{true, true, false, false, true},
{true, true, false, false, false},
{true, true, false, true, true},
{true, true, false, true, false},
{true, false, true, false, true},
{true, false, true, false, false},
{true, false, true, true, true},
{true, false, true, true, false},
{true, false, false, false, true},
{true, false, false, false, false},
{true, false, false, true, true},
{true, false, false, true, false},
}

Definition at line 94 of file FlatCombiningTest.cpp.

Referenced by fizz::client::test::AsyncFizzClientTest::completeEarlyHandshake(), fizz::detail::generateECKeyPair(), fizz::client::test::ClientProtocolTest::getEarlyDataParams(), fizz::client::test::AsyncFizzClientTest::getEarlyDataParams(), fizz::sm::getEarlyDataParams(), fizz::getExtension(), fizz::extensions::TokenBindingServerExtension::getExtensions(), proxygen::HTTPMessage::isResponse(), fizz::extensions::test::TokenBindingClientExtensionTest::setUpServerHelloExtensions(), fizz::extensions::test::ValidatorTest::setUpWithKeyParameters(), TEST(), testing::gmock_matchers_test::TEST(), fizz::client::test::TEST_F(), TEST_P(), fizz::test::TEST_P(), and fizz::sm::validateAcceptedEarly().

constexpr int WORK = 0

Definition at line 28 of file FlatCombiningTest.cpp.

Referenced by TEST_P().