Disable EnvPosixTest.RunImmediately, add EnvPosixTest.RunEventually. (#4126)
Summary: The original `EnvPosixTest.RunImmediately` assumes that after scheduling a background thread, the thread is guaranteed to complete after 0.1 second. I do not know about any non-real-time OS/runtime providing this guarantee. Nor does C++11 standard say anything about this in the documentation of `std::thread`. In fact, we have observed this test failure multiple times on appveyor, and we haven't been able to reproduce the failure deterministically. Therefore, I disable this test for now until we know for sure how it used to fail. Instead, I add another test `EnvPosixTest.RunEventually` that checks that a thread will be scheduled eventually. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4126 Differential Revision: D8827086 Pulled By: riversand963 fbshipit-source-id: abc5cb655f90d50b791493da5eeb3716885dfe93
This commit is contained in:
parent
90ebf1a257
commit
520bbb1774
9
env/env_test.cc
vendored
9
env/env_test.cc
vendored
@ -125,7 +125,7 @@ static void SetBool(void* ptr) {
|
|||||||
reinterpret_cast<std::atomic<bool>*>(ptr)->store(true);
|
reinterpret_cast<std::atomic<bool>*>(ptr)->store(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(EnvPosixTest, RunImmediately) {
|
TEST_F(EnvPosixTest, DISABLED_RunImmediately) {
|
||||||
for (int pri = Env::BOTTOM; pri < Env::TOTAL; ++pri) {
|
for (int pri = Env::BOTTOM; pri < Env::TOTAL; ++pri) {
|
||||||
std::atomic<bool> called(false);
|
std::atomic<bool> called(false);
|
||||||
env_->SetBackgroundThreads(1, static_cast<Env::Priority>(pri));
|
env_->SetBackgroundThreads(1, static_cast<Env::Priority>(pri));
|
||||||
@ -135,6 +135,13 @@ TEST_F(EnvPosixTest, RunImmediately) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(EnvPosixTest, RunEventually) {
|
||||||
|
std::atomic<bool> called(false);
|
||||||
|
env_->StartThread(&SetBool, &called);
|
||||||
|
env_->WaitForJoin();
|
||||||
|
ASSERT_TRUE(called.load());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OS_WIN
|
#ifdef OS_WIN
|
||||||
TEST_F(EnvPosixTest, AreFilesSame) {
|
TEST_F(EnvPosixTest, AreFilesSame) {
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user