]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "test/time: no need to abs(uint64_t) for comparing"
authorSage Weil <sage@redhat.com>
Fri, 11 Mar 2016 22:42:27 +0000 (17:42 -0500)
committerSage Weil <sage@redhat.com>
Fri, 11 Mar 2016 22:42:27 +0000 (17:42 -0500)
This reverts commit da0f6608dd6cc3356e727e739575f496c2b6a590.

unittest_time fails:

[==========] Running 4 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 2 tests from RealClock
[ RUN      ] RealClock.Sanity
[       OK ] RealClock.Sanity (0 ms)
[ RUN      ] RealClock.Conversions
test/common/test_time.cc:125: Failure
Expected: ((Clock::from_double(bd) - brt).count()) < (30U), actual: 18446744073709551595 vs 30
[  FAILED  ] RealClock.Conversions (0 ms)
[----------] 2 tests from RealClock (0 ms total)

[----------] 2 tests from CoarseRealClock
[ RUN      ] CoarseRealClock.Sanity
[       OK ] CoarseRealClock.Sanity (0 ms)
[ RUN      ] CoarseRealClock.Conversions
test/common/test_time.cc:125: Failure
Expected: ((Clock::from_double(bd) - brt).count()) < (30U), actual: 18446744073709551595 vs 30
[  FAILED  ] CoarseRealClock.Conversions (0 ms)
[----------] 2 tests from CoarseRealClock (0 ms total)

[----------] Global test environment tear-down
[==========] 4 tests from 2 test cases ran. (0 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] RealClock.Conversions
[  FAILED  ] CoarseRealClock.Conversions

Signed-off-by: Sage Weil <sage@redhat.com>
src/test/common/test_time.cc

index 0f6fc2090a71003745a9c6e8aecc76f2d462a8cf..2e6ad4bbcbd2bdc4c9d8bebcd6d3834ce51bb61e 100644 (file)
@@ -122,7 +122,7 @@ static void system_clock_conversions() {
 
   ASSERT_EQ(Clock::to_double(brt), bd);
   // Fudge factor
-  ASSERT_LT((Clock::from_double(bd) - brt).count(), 30U);
+  ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);
 }
 
 TEST(RealClock, Sanity) {