proxygen
|
#include <folly/detail/Futex.h>
#include <folly/test/DeterministicSchedule.h>
#include <chrono>
#include <condition_variable>
#include <functional>
#include <ratio>
#include <thread>
#include <glog/logging.h>
#include <folly/Chrono.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Time.h>
Go to the source code of this file.
Typedefs | |
typedef DeterministicSchedule | DSched |
Functions | |
template<template< typename > class Atom> | |
void | run_basic_thread (Futex< Atom > &f) |
template<template< typename > class Atom> | |
void | run_basic_tests () |
template<template< typename > class Atom, typename Clock , typename Duration > | |
void | liveClockWaitUntilTests () |
template<typename Clock > | |
void | deterministicAtomicWaitUntilTests () |
template<template< typename > class Atom> | |
void | run_wait_until_tests () |
template<> | |
void | run_wait_until_tests< DeterministicAtomic > () |
uint64_t | diff (uint64_t a, uint64_t b) |
void | run_system_clock_test () |
void | run_steady_clock_test () |
template<template< typename > class Atom> | |
void | run_wake_blocked_test () |
TEST (Futex, clock_source) | |
TEST (Futex, basic_live) | |
TEST (Futex, basic_emulated) | |
TEST (Futex, basic_deterministic) | |
TEST (Futex, wake_blocked_live) | |
TEST (Futex, wake_blocked_emulated) | |
typedef DeterministicSchedule DSched |
Definition at line 38 of file FutexTest.cpp.
void deterministicAtomicWaitUntilTests | ( | ) |
Definition at line 109 of file FutexTest.cpp.
References Atom, EXPECT_TRUE, f, folly::detail::futexWaitUntil(), folly::detail::INTERRUPTED, now(), and folly::detail::TIMEDOUT.
Definition at line 135 of file FutexTest.cpp.
References a.
Referenced by testing::internal::DoubleNearPredFormat(), folly::UnboundedQueue< T, false, 6 >::getAllocNextSegment(), proxygen::HTTPCommonHeaders::getHeaderCodeFromTableCommonHeaderName(), testing::gmock_matchers_test::GreaterThanMatcher::MatchAndExplain(), testing::internal::FloatingEqMatcher< FloatType >::Impl< T >::MatchAndExplain(), folly::dynamic::merge_diff(), folly::detail::BufferedSlidingWindow< DigestT, ClockT >::onNewDigest(), folly::atomic_shared_ptr< T, Atom, CountedDetail >::release_external(), run_system_clock_test(), runFairness(), folly::HHWheelTimer::scheduleTimeoutImpl(), proxygen::Window::setCapacity(), TEST(), and updateModifiedTime().
void liveClockWaitUntilTests | ( | ) |
Definition at line 62 of file FutexTest.cpp.
References folly::detail::AWOKEN, count, EXPECT_EQ, EXPECT_TRUE, f, folly::detail::futexWaitUntil(), folly::detail::futexWake(), folly::test::DeterministicSchedule::join(), now(), start, folly::test::DeterministicSchedule::thread(), folly::detail::TIMEDOUT, and folly::fibers::yield().
void run_basic_tests | ( | ) |
Definition at line 46 of file FutexTest.cpp.
References Atom, folly::netops::bind(), EXPECT_EQ, f, folly::detail::futexWait(), folly::detail::futexWake(), folly::test::DeterministicSchedule::join(), folly::test::DeterministicSchedule::thread(), folly::detail::VALUE_CHANGED, and folly::fibers::yield().
Definition at line 41 of file FutexTest.cpp.
References Atom, folly::detail::AWOKEN, EXPECT_EQ, and folly::detail::futexWait().
void run_steady_clock_test | ( | ) |
Definition at line 172 of file FutexTest.cpp.
References Atom, B, C, folly::chrono::clock_gettime, count, EXPECT_TRUE, now(), and uint64_t.
Referenced by TEST().
void run_system_clock_test | ( | ) |
The following loop is only to make the test more robust in the presence of clock adjustments that can occur. We just run the loop maxIter times and expect with very high probability that there will be atleast one iteration of the test during which clock adjustments > delta have not occurred.
Definition at line 139 of file FutexTest.cpp.
References a, b, c, folly::chrono::clock_gettime, count, diff(), EXPECT_TRUE, now(), and uint64_t.
Referenced by TEST().
void run_wait_until_tests | ( | ) |
Definition at line 119 of file FutexTest.cpp.
void run_wait_until_tests< DeterministicAtomic > | ( | ) |
Definition at line 129 of file FutexTest.cpp.
Referenced by TEST().
void run_wake_blocked_test | ( | ) |
Definition at line 192 of file FutexTest.cpp.
References folly::detail::AWOKEN, f, folly::detail::futexWait(), folly::detail::futexWake(), folly::test::DeterministicSchedule::join(), folly::detail::success, and folly::test::DeterministicSchedule::thread().
TEST | ( | Futex | , |
clock_source | |||
) |
Definition at line 209 of file FutexTest.cpp.
References run_steady_clock_test(), run_system_clock_test(), and value.
TEST | ( | Futex | , |
basic_live | |||
) |
Definition at line 219 of file FutexTest.cpp.
TEST | ( | Futex | , |
basic_emulated | |||
) |
Definition at line 224 of file FutexTest.cpp.
TEST | ( | Futex | , |
basic_deterministic | |||
) |
Definition at line 229 of file FutexTest.cpp.
References run_wait_until_tests< DeterministicAtomic >(), and folly::test::DeterministicSchedule::uniform().
TEST | ( | Futex | , |
wake_blocked_live | |||
) |
Definition at line 235 of file FutexTest.cpp.
TEST | ( | Futex | , |
wake_blocked_emulated | |||
) |
Definition at line 239 of file FutexTest.cpp.