Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Issue 2689103002: Fix partition_alloc unit tests. (Closed)

Created:
3 years, 10 months ago by sof
Modified:
3 years, 10 months ago
Reviewers:
haraken, palmer, Wez
CC:
chromium-reviews, Dai Mikurube (NOT FULLTIME), Mads Ager (chromium), vmpstr+watch_chromium.org, wfh+watch_chromium.org, oilpan-reviews, kouhei+heap_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix partition_alloc unit tests. R=haraken BUG=691197, 684513 Review-Url: https://codereview.chromium.org/2689103002 Cr-Commit-Position: refs/heads/master@{#449892} Committed: https://chromium.googlesource.com/chromium/src/+/57cc1d8512be5a3719e1f5acbe67a3556ee9c2a7

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -18 lines) Patch
M base/allocator/partition_allocator/PartitionAlloc.md View 2 chunks +2 lines, -2 lines 0 comments Download
M base/allocator/partition_allocator/partition_alloc_unittest.cc View 2 chunks +29 lines, -16 lines 9 comments Download

Messages

Total messages: 23 (11 generated)
sof
please take a look.
3 years, 10 months ago (2017-02-12 06:40:43 UTC) #5
haraken
LGTM
3 years, 10 months ago (2017-02-12 13:49:16 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2689103002/1
3 years, 10 months ago (2017-02-12 14:08:09 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/57cc1d8512be5a3719e1f5acbe67a3556ee9c2a7
3 years, 10 months ago (2017-02-12 14:33:54 UTC) #14
Wez
https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc File base/allocator/partition_allocator/partition_alloc_unittest.cc (right): https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc#newcode62 base/allocator/partition_allocator/partition_alloc_unittest.cc:62: memset(&generic_allocator, 0, sizeof(generic_allocator)); This looks highly suspect; why trash ...
3 years, 10 months ago (2017-02-12 18:51:28 UTC) #16
Wez
It would be helpful in future to have the CL description briefly describe the nature ...
3 years, 10 months ago (2017-02-12 18:53:37 UTC) #17
sof
https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc File base/allocator/partition_allocator/partition_alloc_unittest.cc (right): https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc#newcode1307 base/allocator/partition_allocator/partition_alloc_unittest.cc:1307: // Disable this test on Android because, due to ...
3 years, 10 months ago (2017-02-12 19:52:37 UTC) #18
sof
https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc File base/allocator/partition_allocator/partition_alloc_unittest.cc (right): https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc#newcode62 base/allocator/partition_allocator/partition_alloc_unittest.cc:62: memset(&generic_allocator, 0, sizeof(generic_allocator)); On 2017/02/12 18:51:28, Wez wrote: > ...
3 years, 10 months ago (2017-02-12 20:07:04 UTC) #19
awong
Drive-by nit: Drive-by: In future CLs, could you beef up the commit message with a ...
3 years, 10 months ago (2017-02-13 21:38:18 UTC) #20
sof
On 2017/02/13 21:38:18, awong wrote: > Drive-by nit: > > Drive-by: In future CLs, could ...
3 years, 10 months ago (2017-02-13 21:50:51 UTC) #21
Wez
https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc File base/allocator/partition_allocator/partition_alloc_unittest.cc (right): https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_allocator/partition_alloc_unittest.cc#newcode62 base/allocator/partition_allocator/partition_alloc_unittest.cc:62: memset(&generic_allocator, 0, sizeof(generic_allocator)); On 2017/02/12 20:07:04, sof wrote: > ...
3 years, 10 months ago (2017-02-14 00:24:11 UTC) #22
Wez
3 years, 10 months ago (2017-02-14 00:42:50 UTC) #23
Message was sent while issue was closed.
https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_al...
File base/allocator/partition_allocator/partition_alloc_unittest.cc (right):

https://codereview.chromium.org/2689103002/diff/1/base/allocator/partition_al...
base/allocator/partition_allocator/partition_alloc_unittest.cc:62:
memset(&generic_allocator, 0, sizeof(generic_allocator));
On 2017/02/14 00:24:11, Wez wrote:
> On 2017/02/12 20:07:04, sof wrote:
> > On 2017/02/12 18:51:28, Wez wrote:
> > > This looks highly suspect; why trash the instance's fields, rather than
> > creating
> > > a new instance per-test?
> > 
> > The tests use a set of global allocators, which each test initialize by
> calling
> > TestSetup() before referring to them and tidying up. PA doesn't provide a
way
> to
> > uninitialize their PartitionRoots (or the "allocator" toplevel container
> structs
> > themselves), so resetting them by way memset() is the effective means to
bring
> > that about.
> 
> Presumably we're assuming that the tests themselves don't leak, so we should
at
> least be able to assert that the allocators have no active allocations at test
> teardown.
> 
> > Could you rework these unit tests to define their own testing::Test which
> > packaged up these allocators better per-test? Absolutely. Is it needed to
> > address this instability? Don't think so.
> 
> I disagree; we're basically memset()ing over the top of the two structures on
> the assumption that they only contain POD structures, without clarifying why
> that is assumed to be safe, or why "traces" from prior tests would break
things
> (though yes, the tests should be hermetic no matter what).

OK, looking through the PartitionRoot init code, it seems that nothing is
assuming that the data structure was zero'd, so the fact that things fail if
they're not seems like a legitimate bug.

Powered by Google App Engine
This is Rietveld 408576698