From 51adc5457aba009c5308ea4dea65067f09380e3f Mon Sep 17 00:00:00 2001 From: agiardullo Date: Tue, 5 Jan 2016 17:56:29 -0800 Subject: [PATCH] fix sporadic failure in fault_injection_test Summary: Need to make sure the background task gets scheduled before it goes out of scope. Test Plan: ran test. Will see if sporadic valgrind failures go away. Reviewers: kradhakrishnan Reviewed By: kradhakrishnan Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D52575 --- db/fault_injection_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index 48233d7a2..4c4f38d4a 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -783,6 +783,7 @@ TEST_P(FaultInjectionTest, WriteOptionSyncTest) { // Block the job queue to prevent flush job from running. env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task_low, Env::Priority::HIGH); + sleeping_task_low.WaitUntilSleeping(); WriteOptions write_options; write_options.sync = false; @@ -866,6 +867,7 @@ TEST_P(FaultInjectionTest, ManualLogSyncTest) { // Block the job queue to prevent flush job from running. env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task_low, Env::Priority::HIGH); + sleeping_task_low.WaitUntilSleeping(); WriteOptions write_options; write_options.sync = false;