Actually do the stress test on RCURefCount and make the TLRefCountTest not take 2...
[folly.git] / folly / experimental / test / RefCountTest.cpp
index 7a6fc8103d2fa68ec1d0f4cd856f71fe8899c3a6..13907ca306a6ee151b775e20c9603085c02d2afa 100644 (file)
@@ -83,10 +83,8 @@ void basicTest() {
 }
 
 template <typename RefCount>
-void stressTest() {
-  constexpr size_t kItersCount = 10000;
-
-  for (size_t i = 0; i < kItersCount; ++i) {
+void stressTest(size_t itersCount) {
+  for (size_t i = 0; i < itersCount; ++i) {
     RefCount count;
     std::mutex mutex;
     int a{1};
@@ -125,10 +123,12 @@ TEST(TLRefCount, Basic) {
 }
 
 TEST(RCURefCount, Stress) {
-  stressTest<TLRefCount>();
+  stressTest<RCURefCount>(100000);
 }
 
 TEST(TLRefCount, Stress) {
-  stressTest<TLRefCount>();
+  // This is absurdly slow, so we can't
+  // do it that many times.
+  stressTest<TLRefCount>(500);
 }
 }