Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80c7d5a3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Fix for rare flakes in Event{Control}ThreadTests"

parents 8a64a835 0655b8e1
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -75,14 +75,16 @@ class AsyncCallRecorder;
template <typename... Args>
class AsyncCallRecorder<void (*)(Args...)> {
public:
    // For the tests, we expect the wait for an expected change to be signaled
    // to be much shorter than this.
    static constexpr std::chrono::milliseconds DEFAULT_CALL_EXPECTED_TIMEOUT{10};

    // The wait here is tricky. We don't expect a change, but we don't want to
    // wait forever (or for longer than the typical test function runtime). As
    // even the simplest Google Test can take 1ms (1000us) to run, we wait for
    // half that time.
    // This wait value needs to be large enough to avoid flakes caused by delays
    // scheduling threads, but small enough that tests don't take forever if
    // something really is wrong. Based on some empirical evidence, 100ms should
    // be enough to avoid the former.
    static constexpr std::chrono::milliseconds DEFAULT_CALL_EXPECTED_TIMEOUT{100};

    // The wait here is tricky. It's for when We don't expect to record a call,
    // but we don't want to wait forever (or for longer than the typical test
    // function runtime). As even the simplest Google Test can take 1ms (1000us)
    // to run, we wait for half that time.
    static constexpr std::chrono::microseconds UNEXPECTED_CALL_TIMEOUT{500};

    using ArgTuple = std::tuple<std::remove_cv_t<std::remove_reference_t<Args>>...>;
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ EventThreadTest::~EventThreadTest() {
    ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());

    // EventThread should unregister itself as VSyncSource callback.
    EXPECT_FALSE(expectVSyncSetCallbackCallReceived());
    EXPECT_TRUE(!mVSyncSetCallbackCallRecorder.waitForUnexpectedCall().has_value());
}

void EventThreadTest::createThread() {