Skip to content

Commit

Permalink
Fix a noisy unit test.
Browse files Browse the repository at this point in the history
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:
  • Loading branch information
krad committed Jul 9, 2015
1 parent 1f4d565 commit 7189e90
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions db/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down

0 comments on commit 7189e90

Please sign in to comment.