New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 592747 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

StatisticsRecorder and HistogramTester conflict and break tests in order-dependent way

Project Member Reported by bcwh...@chromium.org, Mar 7 2016

Issue description

Version: 51.0.2670
OS: all (tests only)

The basic problem is that HistogramTester objects do not play nice with local
StastiticsRecorder objects.

Specifically, HistogramTester calls StatisticsRecorder::Initialize() which
creates the global SR object.  After that point, any attempt to create a local
SR object will crash on DCHECK(!histograms_) in the SR constructor.

base_unittests has one existing instance of HistogramTester and that is within
histogram_tester_unittest.cc.  By luck, this test conveniently runs later and
only one test after it attempts to create local SR objects.  The only one that
does is "HistogramTest" which included the SR::ResetForTesting() method (that
is actually just a hack to get around the just-described problem).

The fix for this is non-trivial.  If HistogramTester were to create its own
instance of a StatisticsRecorder (which was obviously avoided purposely during
its development) then it would crash if any previous test initialized the
lazy-instance with the (global) SR.  The simplest solution seems to be to simply
delete the global instance inside ResetForTesting()...  except there is no way
to reset a LazyInstance.


Run base_unittests with --gtest_shuffle to witness the failure.
 
Components: Internals>Metrics
Adding Internals>Metrics component.
Status: Fixed (was: Assigned)
Included in M51 beta.

Sign in to add a comment