Project

General

Profile

Actions

Bug #9235

closed

unittest_histogram test case Histogram.Position fail

Added by wei li over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
common
Target version:
-
% Done:

100%

Source:
Community (user)
Tags:
Backport:
firefly
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

unittest_histogram test case Histogram.Position fail.

https://github.com/ceph/ceph/blob/master/src/test/common/histogram.cc, line 102,103 has problem.
Here missing the assignment for lb and ub.

In my env, centos7, x86_64.
total: 18446744073709551614, upper_sum: 18446744073709551615, lower_sum: 18446744073709551615, bin: 3
lb: 0 ; ub: 0

So the diff for this unittest need change to

diff --git a/src/test/common/histogram.cc b/src/test/common/histogram.cc
index 2fd3cfe..6b9de1e 100644
--- a/src/test/common/histogram.cc
+++ b/src/test/common/histogram.cc
@@ -99,8 +99,9 @@ TEST(Histogram, Position) {
     h.h[0] = UINT_MAX;
     h.h[5] = UINT_MAX;
     uint64_t lb, ub;
-    ASSERT_EQ(500000u, lb);
-    ASSERT_EQ(500000u, ub);
+    h.get_position_micro(4, &lb, &ub);
+    ASSERT_EQ(0u, lb);
+    ASSERT_EQ(0u, ub);
   }
 }

Actions #1

Updated by Loïc Dachary over 9 years ago

  • Category set to common
  • Status changed from New to In Progress
  • Assignee set to Loïc Dachary
  • Source changed from other to Community (user)
Actions #2

Updated by Loïc Dachary over 9 years ago

  • Status changed from In Progress to Fix Under Review
  • % Done changed from 0 to 90
Actions #3

Updated by Sage Weil over 9 years ago

  • Status changed from Fix Under Review to Resolved
Actions #4

Updated by wei li over 9 years ago

I merger this change, rebuild the unittest, rerun this test case. lb, ub is still 0 in my machine.

[liwei@localhost src]$ ./unittest_histogram         
Running main() from gtest_main.cc
[==========] Running 5 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 5 tests from Histogram
[ RUN      ] Histogram.Basic
[       OK ] Histogram.Basic (0 ms)
[ RUN      ] Histogram.Set
[       OK ] Histogram.Set (0 ms)
[ RUN      ] Histogram.Position
[       OK ] Histogram.Position (0 ms)
[ RUN      ] Histogram.Position2
test/common/histogram.cc:105: Failure
Value of: lb
  Actual: 0
Expected: 500000u
Which is: 500000
[  FAILED  ] Histogram.Position2 (0 ms)
[ RUN      ] Histogram.Decay
[       OK ] Histogram.Decay (0 ms)
[----------] 5 tests from Histogram (0 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 1 test case ran. (0 ms total)
[  PASSED  ] 4 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Histogram.Position2

 1 FAILED TEST

My machine arch is Linux 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
total: 18446744073709551614, upper_sum: 18446744073709551615, lower_sum: 18446744073709551615, bin: 3

Actions #5

Updated by Loïc Dachary over 9 years ago

Could you try again with the master branch ?

Actions #6

Updated by wei li over 9 years ago

The master branch is correct.

Actions #7

Updated by Loïc Dachary over 9 years ago

  • Backport set to firefly
Actions #8

Updated by Loïc Dachary over 9 years ago

  • Status changed from Resolved to Pending Backport
Actions #10

Updated by Loïc Dachary about 9 years ago

  • Status changed from Pending Backport to Resolved
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF