From: Greg Farnum Date: Wed, 6 Feb 2013 18:22:06 +0000 (-0800) Subject: test: fix Throttle unit test. X-Git-Tag: v0.58~139 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c0e1070f2f54bcd592a731c9b912669e6c7ca4ee;p=ceph.git test: fix Throttle unit test. A bunch of these are slightly racy so they're enclosed in loops. This particular one, though, changes the Throttle state in ways that invalidate the asserts. To fix, reset the state before commencing a rerun. Signed-off-by: Greg Farnum --- diff --git a/src/test/common/Throttle.cc b/src/test/common/Throttle.cc index f50ef2e1b7b9..60d7daebdac2 100644 --- a/src/test/common/Throttle.cc +++ b/src/test/common/Throttle.cc @@ -193,10 +193,13 @@ TEST_F(ThrottleTest, wait) { t.join(); - if (!(waited = t.waited)) + if (!(waited = t.waited)) { delay *= 2; + // undo the changes we made + throttle.put(throttle_max / 2); + throttle.wait(throttle_max); + } } while(!waited); - } TEST_F(ThrottleTest, destructor) {