proxygen
|
#include <algorithm>
#include <atomic>
#include <cassert>
#include <random>
#include <boost/thread.hpp>
#include <folly/Random.h>
#include <folly/experimental/FunctionScheduler.h>
#include <folly/portability/GTest.h>
#include <folly/synchronization/Baton.h>
Go to the source code of this file.
Functions | |
TEST (FunctionScheduler, StartAndShutdown) | |
TEST (FunctionScheduler, SimpleAdd) | |
TEST (FunctionScheduler, AddCancel) | |
TEST (FunctionScheduler, AddCancel2) | |
TEST (FunctionScheduler, AddMultiple) | |
TEST (FunctionScheduler, AddAfterStart) | |
TEST (FunctionScheduler, ShutdownStart) | |
TEST (FunctionScheduler, ResetFunc) | |
TEST (FunctionScheduler, ResetFunc2) | |
TEST (FunctionScheduler, ResetFuncWhileRunning) | |
TEST (FunctionScheduler, AddInvalid) | |
TEST (FunctionScheduler, NoFunctions) | |
TEST (FunctionScheduler, AddWhileRunning) | |
TEST (FunctionScheduler, NoShutdown) | |
TEST (FunctionScheduler, StartDelay) | |
TEST (FunctionScheduler, NoSteadyCatchup) | |
TEST (FunctionScheduler, SteadyCatchup) | |
TEST (FunctionScheduler, UniformDistribution) | |
TEST (FunctionScheduler, ConsistentDelay) | |
TEST (FunctionScheduler, ExponentialBackoff) | |
TEST (FunctionScheduler, GammaIntervalDistribution) | |
TEST (FunctionScheduler, AddWithRunOnce) | |
TEST (FunctionScheduler, cancelFunctionAndWait) | |
TEST (FunctionScheduler, cancelAllFunctionsAndWait) | |
TEST (FunctionScheduler, CancelAndWaitOnRunningFunc) | |
TEST (FunctionScheduler, CancelAllAndWaitWithRunningFunc) | |
TEST (FunctionScheduler, CancelAllAndWaitWithOneRunningAndOneWaiting) | |
TEST (FunctionScheduler, ConcurrentCancelFunctionAndWait) | |
TEST | ( | FunctionScheduler | , |
StartAndShutdown | |||
) |
Definition at line 67 of file FunctionSchedulerTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
SimpleAdd | |||
) |
Definition at line 80 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_EQ, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddCancel | |||
) |
Definition at line 92 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddCancel2 | |||
) |
Definition at line 113 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddMultiple | |||
) |
Definition at line 193 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_THROW, EXPECT_TRUE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddAfterStart | |||
) |
Definition at line 216 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_EQ, and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
ShutdownStart | |||
) |
Definition at line 229 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_FALSE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
ResetFunc | |||
) |
Definition at line 244 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::FunctionScheduler::resetFunctionTimer(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
ResetFunc2 | |||
) |
Definition at line 265 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionOnce(), EXPECT_FALSE, EXPECT_TRUE, folly::FunctionScheduler::resetFunctionTimer(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
ResetFuncWhileRunning | |||
) |
Definition at line 282 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), count, and EXPECT_EQ.
TEST | ( | FunctionScheduler | , |
AddInvalid | |||
) |
Definition at line 328 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_FALSE, and EXPECT_THROW.
TEST | ( | FunctionScheduler | , |
NoFunctions | |||
) |
Definition at line 339 of file FunctionSchedulerTest.cpp.
References EXPECT_TRUE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddWhileRunning | |||
) |
Definition at line 347 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_EQ, folly::FunctionScheduler::start(), and folly::pushmi::detail::t.
TEST | ( | FunctionScheduler | , |
NoShutdown | |||
) |
Definition at line 363 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_EQ, and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
StartDelay | |||
) |
Definition at line 379 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_THROW, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
NoSteadyCatchup | |||
) |
Definition at line 410 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_LE, and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
SteadyCatchup | |||
) |
Definition at line 429 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), EXPECT_NEAR, folly::FunctionScheduler::setSteady(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
UniformDistribution | |||
) |
Definition at line 449 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionUniformDistribution(), EXPECT_EQ, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
ConsistentDelay | |||
) |
Definition at line 475 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionConsistentDelay(), count, EXPECT_EQ, EXPECT_NEAR, now(), folly::FunctionScheduler::start(), and folly::pushmi::detail::t.
TEST | ( | FunctionScheduler | , |
ExponentialBackoff | |||
) |
Definition at line 510 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionGenericDistribution(), EXPECT_EQ, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
GammaIntervalDistribution | |||
) |
Definition at line 538 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionGenericDistribution(), EXPECT_EQ, generator, folly::Random::rand32(), folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
AddWithRunOnce | |||
) |
Definition at line 569 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunctionOnce(), EXPECT_EQ, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
cancelFunctionAndWait | |||
) |
Definition at line 588 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunction(), folly::FunctionScheduler::cancelFunctionAndWait(), EXPECT_ANY_THROW, EXPECT_EQ, EXPECT_FALSE, EXPECT_NO_THROW, EXPECT_TRUE, fail(), folly::FunctionScheduler::shutdown(), folly::FunctionScheduler::start(), and folly::TEST().
TEST | ( | FunctionScheduler | , |
cancelAllFunctionsAndWait | |||
) |
Definition at line 664 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelAllFunctionsAndWait(), folly::FunctionScheduler::cancelFunction(), EXPECT_EQ, EXPECT_FALSE, folly::FunctionScheduler::shutdown(), and folly::FunctionScheduler::start().
TEST | ( | FunctionScheduler | , |
CancelAndWaitOnRunningFunc | |||
) |
Definition at line 687 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), ASSERT_TRUE, folly::FunctionScheduler::cancelFunctionAndWait(), EXPECT_TRUE, folly::Baton< MayBlock, Atom >::post(), folly::FunctionScheduler::start(), and folly::Baton< MayBlock, Atom >::try_wait_for().
TEST | ( | FunctionScheduler | , |
CancelAllAndWaitWithRunningFunc | |||
) |
Definition at line 702 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), ASSERT_TRUE, folly::FunctionScheduler::cancelAllFunctionsAndWait(), folly::Baton< MayBlock, Atom >::post(), folly::FunctionScheduler::start(), and folly::Baton< MayBlock, Atom >::try_wait_for().
TEST | ( | FunctionScheduler | , |
CancelAllAndWaitWithOneRunningAndOneWaiting | |||
) |
Definition at line 717 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), ASSERT_TRUE, folly::FunctionScheduler::cancelAllFunctionsAndWait(), EXPECT_EQ, folly::Baton< MayBlock, Atom >::post(), folly::FunctionScheduler::start(), and folly::Baton< MayBlock, Atom >::try_wait_for().
TEST | ( | FunctionScheduler | , |
ConcurrentCancelFunctionAndWait | |||
) |
Definition at line 748 of file FunctionSchedulerTest.cpp.
References folly::FunctionScheduler::addFunction(), folly::FunctionScheduler::cancelFunctionAndWait(), EXPECT_FALSE, EXPECT_TRUE, and folly::FunctionScheduler::start().