Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/time: no need to abs(uint64_t) for comparing #7726

Merged
merged 1 commit into from Mar 11, 2016

Conversation

tchaikov
Copy link
Contributor

fixes

/home/kefu/dev/ceph/src/test/common/test_time.cc: In instantiation of
‘void system_clock_conversions() [with Clock =
ceph::time_detail::real_clock]’:
/home/kefu/dev/ceph/src/test/common/test_time.cc:134:40:   required from
here
/home/kefu/dev/ceph/src/test/common/test_time.cc:125:169: error: call of
overloaded ‘abs(std::chrono::duration<long unsigned int, std::ratio<1l,
1000000000l> >::rep)’ is ambiguous
   ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);

as std::abs() in libstdc++ shipped with gcc 6 does not have a specialization for unsigned types, and we
are using uint64_t as the typename duration<>::rep.

Signed-off-by: Kefu Chai kchai@redhat.com

fixes
```
/home/kefu/dev/ceph/src/test/common/test_time.cc: In instantiation of
‘void system_clock_conversions() [with Clock =
ceph::time_detail::real_clock]’:
/home/kefu/dev/ceph/src/test/common/test_time.cc:134:40:   required from
here
/home/kefu/dev/ceph/src/test/common/test_time.cc:125:169: error: call of
overloaded ‘abs(std::chrono::duration<long unsigned int, std::ratio<1l,
1000000000l> >::rep)’ is ambiguous
   ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);
```

as std::abs() does not have a specialization for unsigned types, and we
are using uint64_t as the `typename duration<>::rep`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
@adamemerson
Copy link
Contributor

This change looks fine to me.

liewegas added a commit that referenced this pull request Mar 11, 2016
test/time: no need to abs(uint64_t) for comparing

Reviewed-by: Adam Emerson <aemerson@redhat.com>
@liewegas liewegas merged commit 4adeb41 into ceph:master Mar 11, 2016
@tchaikov tchaikov deleted the wip-fix-ftbfs-gcc6 branch March 11, 2016 15:32
@liewegas
Copy link
Member

@tchaikov I reverted this since it broke the unittest:

[==========] 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

4c97aac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants