Fix a noisy unit test.

Summary: The t/DBTest.DropWrites test still fails under certain gcc version in release unit test.

I unfortunately cannot repro the failure (since the compilers have mapped library which I am not able to map to correctly). I am suspecting the clock skew.

Test Plan: Run make check

Reviewers:

CC: sdong igore

Task ID: #7312624

Blame Rev:
This commit is contained in:
krad 2015-07-08 13:38:20 -07:00
parent 1f4d565709
commit 7189e90c22
1 changed files with 3 additions and 2 deletions

View File

@ -93,10 +93,11 @@ class AtomicCounter {
uint64_t start = env_->NowMicros();
while (count_ < count) {
uint64_t now = env_->NowMicros();
cond_count_.TimedWait(now + /*1s*/ 1 * 000 * 000);
if (env_->NowMicros() - start > /*10s*/ 10 * 000 * 000) {
const uint64_t elapsed_micros = (now > start) ? now - start : 0;
if (elapsed_micros > /*10s*/ 10 * 000 * 000) {
return false;
}
cond_count_.TimedWait(now + /*1s*/ 1 * 000 * 000);
if (count_ < count) {
GTEST_LOG_(WARNING) << "WaitFor is taking more time than usual";
}