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

Issue 658070 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
ex-Googler
Closed: Oct 2016
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

SQLRecoveryTest.AttachFailure is flaky-successful.

Project Member Reported by sh...@chromium.org, Oct 21 2016

Issue description

A totally green build, right?
https://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/318975

But from
https://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/318975/steps/sql_unittests%20%28with%20patch%29%20on%20Mac-10.9/logs/stdio

[ RUN      ] SQLRecoveryTest.AttachFailure
[17256:1287:1019/203115:9039693390179:ERROR:connection.cc(1892)] SQLTest.db sqlite error 26, errno 0: file is encrypted or is not a database, sql: PRAGMA auto_vacuum
[17256:1287:1019/203115:9039693506453:ERROR:connection.cc(1892)] SQLTest.db sqlite error 26, errno 0: file is encrypted or is not a database, sql: PRAGMA journal_mode = TRUNCATE
[17256:1287:1019/203115:9039693609199:ERROR:connection.cc(1892)] SQLTest.db sqlite error 26, errno 0: file is encrypted or is not a database, sql: SELECT name FROM sqlite_master WHERE type=? AND name=? COLLATE NOCASE
[17256:1287:1019/203115:9039693737699:ERROR:connection.cc(1892)] SQLTest.db sqlite error 26, errno 0: file is encrypted or is not a database, sql: SELECT COUNT(*) FROM sqlite_master
[17256:1287:1019/203115:9039694023726:ERROR:connection.cc(1892)]  sqlite error 26, errno -2: file is encrypted or is not a database, sql: ATTACH DATABASE ? AS ?
../../base/test/histogram_tester.cc:59: Failure
Expected: (static_cast<base::HistogramBase*>(__null)) != (histogram), actual: NULL vs NULL
Histogram "Sqlite.RecoveryEvents" does not exist.
[  FAILED  ] SQLRecoveryTest.AttachFailure (3 ms)
[75/76] SQLRecoveryTest.AttachFailure (3 ms)
[76/76] SQLMemoryDumpProviderTest.OnMemoryDump (0 ms)
Retrying 1 test (retry #1)
[77/77] SQLRecoveryTest.AttachFailure (9 ms)
SUCCESS: all tests passed.

Every time.  Running things locally:

./out/Default/sql_unittests # FAIL, but success on retry.

./out/Default/sql_unittests --single-process-tests # success first time.

./out/Default/sql_unittests --gtest_filter=SQLRecoveryTest.* # FAIL

./out/Default/sql_unittests --gtest_filter=SQLRecoveryTest.AttachFailure # success first time.

The gist of this test is:

  base::HistogramTester tester;
  // Call some code.
  tester.ExpectBucketCount(kEventHistogramName, kEventEnum, 1);

Where it's testing that UMA_HISTOGRAM_ENUMERATION() recorded once under the name for the value.

I think what's happening is that state in the histogram system is different when it's running with other tests or not.  But as of yet my mental model can't explain the --single-process-tests success, as this is the last test in the code, so if previous tests mess up state then I'm not sure why it works right both when all the tests run in the same process and when only one test runs in the process.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1cf87f2750870763cfd8bc4230bd4c0ccc91b7e0

commit 1cf87f2750870763cfd8bc4230bd4c0ccc91b7e0
Author: shess <shess@chromium.org>
Date: Tue Oct 25 22:18:29 2016

[sql] Initialize StatisticsRecorder in SQLTestSuite.

Histograms created using the histogram macros are stored in per-site global storage, so any histogram recorded before StatisticsRecorder::Initialize() are unregistered until the process exits.  HistogramTester relies on StatisticsRecorder, so depending on whether HistogramTester is created before or after a particular histogram macro is used, it may or may not be able to find the corresponding histogram.

Pull StatisticsRecorder::Initialize() into the test-suite initialization, which should run before any code under test.

BUG= 658070 

Review-Url: https://codereview.chromium.org/2435933004
Cr-Commit-Position: refs/heads/master@{#427508}

[modify] https://crrev.com/1cf87f2750870763cfd8bc4230bd4c0ccc91b7e0/sql/connection_unittest.cc
[modify] https://crrev.com/1cf87f2750870763cfd8bc4230bd4c0ccc91b7e0/sql/test/sql_test_suite.cc

Comment 2 by sh...@chromium.org, Oct 25 2016

Status: Fixed (was: Assigned)

Sign in to add a comment