1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "include/utils/SkRandom.h"
9 #include "tests/Test.h"
10 
11 // Clang seems to think only 32-bit alignment is guaranteed on 32-bit x86 Android.
12 // See https://reviews.llvm.org/D8357
13 // This is why we have disabled -Wover-aligned there (we allocate 8-byte aligned structs in Ganesh).
DEF_TEST(OverAligned,r)14 DEF_TEST(OverAligned, r) {
15     SkRandom rand;
16     // Let's test that assertion.  We think it really should be providing 8-byte alignment.
17     for (int i = 0; i < 1000; i++) {
18         void* p = sk_malloc_throw(rand.nextRangeU(0,100));
19         REPORTER_ASSERT(r, SkIsAlign8((uintptr_t)p));
20         sk_free(p);
21     }
22 }
23