proxygen
F14AsanSupportTest.cpp File Reference

Go to the source code of this file.

Functions

template<typename S >
void useIteratorAfterInsertSmall ()
 
template<typename S >
void useIteratorAfterInsertLarge ()
 
template<typename S >
void useReferenceAfterInsertSmall ()
 
template<typename S >
void useReferenceAfterInsertLarge ()
 
template<typename F >
void repeat (F const &func)
 
template<typename F >
void expectAsanFailure (F const &func)
 
 TEST (F14AsanSupportTest, F14ValueIterInsertSmall)
 
 TEST (F14AsanSupportTest, F14NodeIterInsertSmall)
 
 TEST (F14AsanSupportTest, F14VectorIterInsertSmall)
 
 TEST (F14AsanSupportTest, F14FastIterInsertSmall)
 
 TEST (F14AsanSupportTest, F14ValueIterInsertLarge)
 
 TEST (F14AsanSupportTest, F14NodeIterInsertLarge)
 
 TEST (F14AsanSupportTest, F14VectorIterInsertLarge)
 
 TEST (F14AsanSupportTest, F14FastIterInsertLarge)
 
 TEST (F14AsanSupportTest, F14ValueRefInsertSmall)
 
 TEST (F14AsanSupportTest, F14VectorRefInsertSmall)
 
 TEST (F14AsanSupportTest, F14FastRefInsertSmall)
 
 TEST (F14AsanSupportTest, F14ValueRefInsertLarge)
 
 TEST (F14AsanSupportTest, F14VectorRefInsertLarge)
 
 TEST (F14AsanSupportTest, F14FastRefInsertLarge)
 
 TEST (F14AsanSupportTest, F14VectorErase)
 

Function Documentation

template<typename F >
void expectAsanFailure ( F const &  func)

Definition at line 73 of file F14AsanSupportTest.cpp.

References folly::kIsSanitizeAddress, and repeat().

Referenced by TEST().

73  {
74  if (kIsSanitizeAddress) {
75  EXPECT_EXIT(
76  repeat(func), testing::ExitedWithCode(1), ".*heap-use-after-free.*");
77  }
78 }
constexpr bool kIsSanitizeAddress
Definition: Portability.h:118
void repeat(F const &func)
TEST ( F14AsanSupportTest  ,
F14ValueIterInsertSmall   
)

Definition at line 80 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertSmall().

80  {
82 }
void useIteratorAfterInsertSmall()
void expectAsanFailure(F const &func)
TEST ( F14AsanSupportTest  ,
F14NodeIterInsertSmall   
)

Definition at line 83 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertSmall().

83  {
85 }
void useIteratorAfterInsertSmall()
void expectAsanFailure(F const &func)
TEST ( F14AsanSupportTest  ,
F14VectorIterInsertSmall   
)

Definition at line 86 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertSmall().

86  {
88 }
void useIteratorAfterInsertSmall()
void expectAsanFailure(F const &func)
TEST ( F14AsanSupportTest  ,
F14FastIterInsertSmall   
)

Definition at line 89 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertSmall().

89  {
91 }
void useIteratorAfterInsertSmall()
void expectAsanFailure(F const &func)
TEST ( F14AsanSupportTest  ,
F14ValueIterInsertLarge   
)

Definition at line 93 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertLarge().

93  {
95 }
void expectAsanFailure(F const &func)
void useIteratorAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14NodeIterInsertLarge   
)

Definition at line 96 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertLarge().

96  {
98 }
void expectAsanFailure(F const &func)
void useIteratorAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14VectorIterInsertLarge   
)

Definition at line 99 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertLarge().

99  {
101 }
void expectAsanFailure(F const &func)
void useIteratorAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14FastIterInsertLarge   
)

Definition at line 102 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useIteratorAfterInsertLarge().

102  {
104 }
void expectAsanFailure(F const &func)
void useIteratorAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14ValueRefInsertSmall   
)

Definition at line 106 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertSmall().

106  {
108 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertSmall()
TEST ( F14AsanSupportTest  ,
F14VectorRefInsertSmall   
)

Definition at line 109 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertSmall().

109  {
111 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertSmall()
TEST ( F14AsanSupportTest  ,
F14FastRefInsertSmall   
)

Definition at line 112 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertSmall().

112  {
114 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertSmall()
TEST ( F14AsanSupportTest  ,
F14ValueRefInsertLarge   
)

Definition at line 116 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertLarge().

116  {
118 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14VectorRefInsertLarge   
)

Definition at line 119 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertLarge().

119  {
121 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14FastRefInsertLarge   
)

Definition at line 122 of file F14AsanSupportTest.cpp.

References expectAsanFailure(), and useReferenceAfterInsertLarge().

122  {
124 }
void expectAsanFailure(F const &func)
void useReferenceAfterInsertLarge()
TEST ( F14AsanSupportTest  ,
F14VectorErase   
)

Definition at line 126 of file F14AsanSupportTest.cpp.

References EXPECT_EQ, EXPECT_NE, and folly::kIsSanitizeAddress.

126  {
127  F14VectorSet<int> set;
128  set.insert(1);
129  set.insert(2);
130  set.insert(3);
131  auto& v = *set.begin();
132  EXPECT_EQ(v, 3);
133  set.erase(2);
134  if (kIsSanitizeAddress) {
135  EXPECT_NE(v, 3);
136  }
137 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
constexpr bool kIsSanitizeAddress
Definition: Portability.h:118
#define EXPECT_NE(val1, val2)
Definition: gtest.h:1926
template<typename S >
void useIteratorAfterInsertLarge ( )

Definition at line 32 of file F14AsanSupportTest.cpp.

References EXPECT_EQ, and i.

Referenced by TEST().

32  {
33  S set;
34  set.insert(10);
35  for (int i = 0; i < 1000; ++i) {
36  auto iter = set.find(10);
37  set.insert(i);
38  if (i > 500) {
39  EXPECT_EQ(*iter, 10);
40  }
41  }
42 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
template<typename S >
void useIteratorAfterInsertSmall ( )

Definition at line 24 of file F14AsanSupportTest.cpp.

References EXPECT_EQ.

Referenced by TEST().

24  {
25  S set;
26  auto iter = set.insert(1).first;
27  set.insert(2);
28  EXPECT_EQ(*iter, 1);
29 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
template<typename S >
void useReferenceAfterInsertLarge ( )

Definition at line 53 of file F14AsanSupportTest.cpp.

References EXPECT_EQ, and i.

Referenced by TEST().

53  {
54  S set;
55  set.insert(10);
56  for (int i = 0; i < 1000; ++i) {
57  auto& ref = *set.find(10);
58  set.insert(i);
59  if (i > 500) {
60  EXPECT_EQ(ref, 10);
61  }
62  }
63 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
template<typename S >
void useReferenceAfterInsertSmall ( )

Definition at line 45 of file F14AsanSupportTest.cpp.

References EXPECT_EQ.

Referenced by TEST().

45  {
46  S set;
47  auto& ref = *set.insert(1).first;
48  set.insert(2);
49  EXPECT_EQ(ref, 1);
50 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922