Skip to content

Commit

Permalink
Fix flake in FencedWrapperAllocatorTest::TestAlignment.
Browse files Browse the repository at this point in the history
Re-enable the test on Windows after verifying the tests are
passing gpu_unittests on win trybots.

BUG=226750
TBR=piman
R=michaeln
TEST=gpu_unittests

Review URL: https://chromiumcodereview.appspot.com/14096005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194093 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
hshi@chromium.org committed Apr 13, 2013
1 parent 108f4a3 commit 0ba8c78
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions gpu/command_buffer/client/fenced_allocator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/aligned_memory.h"
#include "base/message_loop.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/client/fenced_allocator.h"
Expand Down Expand Up @@ -33,6 +34,7 @@ using testing::_;
class BaseFencedAllocatorTest : public testing::Test {
protected:
static const unsigned int kBufferSize = 1024;
static const int kAllocAlignment = 16;

virtual void SetUp() {
api_mock_.reset(new AsyncAPIMock);
Expand Down Expand Up @@ -402,7 +404,8 @@ class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest {
// Though allocating this buffer isn't strictly necessary, it makes
// allocations point to valid addresses, so they could be used for
// something.
buffer_.reset(new char[kBufferSize]);
buffer_.reset(static_cast<char*>(base::AlignedAlloc(
kBufferSize, kAllocAlignment)));
allocator_.reset(new FencedAllocatorWrapper(kBufferSize, helper_.get(),
buffer_.get()));
}
Expand All @@ -417,7 +420,7 @@ class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest {
}

scoped_ptr<FencedAllocatorWrapper> allocator_;
scoped_ptr<char[]> buffer_;
scoped_ptr_malloc<char, base::ScopedPtrAlignedFree> buffer_;
};

// Checks basic alloc and free.
Expand Down Expand Up @@ -464,25 +467,19 @@ TEST_F(FencedAllocatorWrapperTest, TestAllocZero) {
}

// Checks that allocation offsets are aligned to multiples of 16 bytes.
#if defined(OS_WIN)
// See crbug/226750
#define MAYBE_TestAlignment DISABLED_TestAlignment
#else
#define MAYBE_TestAlignment TestAlignment
#endif
TEST_F(FencedAllocatorWrapperTest, MAYBE_TestAlignment) {
TEST_F(FencedAllocatorWrapperTest, TestAlignment) {
allocator_->CheckConsistency();

const unsigned int kSize1 = 75;
void *pointer1 = allocator_->Alloc(kSize1);
ASSERT_TRUE(pointer1);
EXPECT_EQ(reinterpret_cast<intptr_t>(pointer1) & 15, 0);
EXPECT_EQ(reinterpret_cast<intptr_t>(pointer1) & (kAllocAlignment - 1), 0);
EXPECT_TRUE(allocator_->CheckConsistency());

const unsigned int kSize2 = 43;
void *pointer2 = allocator_->Alloc(kSize2);
ASSERT_TRUE(pointer2);
EXPECT_EQ(reinterpret_cast<intptr_t>(pointer2) & 15, 0);
EXPECT_EQ(reinterpret_cast<intptr_t>(pointer2) & (kAllocAlignment - 1), 0);
EXPECT_TRUE(allocator_->CheckConsistency());

allocator_->Free(pointer2);
Expand Down

0 comments on commit 0ba8c78

Please sign in to comment.