Skip to content

Commit a149812

Browse files
committed
Revert "[Sanitizer][RISCV][AArch64][Android] Adjust allocator tests"
This reverts commit a00347b due to a test failure on the `sanitizer-x86_64-linux-android` buildbot.
1 parent 3cec93b commit a149812

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,6 @@ using namespace __sanitizer;
3636
#define SKIP_ON_SOLARIS_SPARCV9(x) x
3737
#endif
3838

39-
// On 64-bit systems with small virtual address spaces (e.g. 39-bit) we can't
40-
// use size class maps with a large number of classes, as that will make the
41-
// SizeClassAllocator64 region size too small (< 2^32).
42-
#if SANITIZER_ANDROID && defined(__aarch64__)
43-
#define ALLOCATOR64_SMALL_SIZE 1
44-
#elif SANITIZER_RISCV64
45-
#define ALLOCATOR64_SMALL_SIZE 1
46-
#else
47-
#define ALLOCATOR64_SMALL_SIZE 0
48-
#endif
49-
5039
// Too slow for debug build
5140
#if !SANITIZER_DEBUG
5241

@@ -64,11 +53,6 @@ static const uptr kAllocatorSpace = 0x3000000000ULL;
6453
static const uptr kAllocatorSize = 0x2000000000ULL;
6554
static const u64 kAddressSpaceSize = 1ULL << 39;
6655
typedef VeryCompactSizeClassMap SizeClassMap;
67-
#elif SANITIZER_RISCV64
68-
const uptr kAllocatorSpace = ~(uptr)0;
69-
const uptr kAllocatorSize = 0x2000000000ULL; // 128G.
70-
static const u64 kAddressSpaceSize = 1ULL << 38;
71-
typedef VeryDenseSizeClassMap SizeClassMap;
7256
#else
7357
static const uptr kAllocatorSpace = 0x700000000000ULL;
7458
static const uptr kAllocatorSize = 0x010000000000ULL; // 1T.
@@ -292,7 +276,8 @@ TEST(SanitizerCommon, SizeClassAllocator64Dynamic) {
292276
TestSizeClassAllocator<Allocator64Dynamic>();
293277
}
294278

295-
#if !ALLOCATOR64_SMALL_SIZE
279+
#if !SANITIZER_ANDROID
280+
//FIXME(kostyak): find values so that those work on Android as well.
296281
TEST(SanitizerCommon, SizeClassAllocator64Compact) {
297282
TestSizeClassAllocator<Allocator64Compact>();
298283
}
@@ -376,7 +361,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicMetadataStress) {
376361
SizeClassAllocatorMetadataStress<Allocator64Dynamic>();
377362
}
378363

379-
#if !ALLOCATOR64_SMALL_SIZE
364+
#if !SANITIZER_ANDROID
380365
TEST(SanitizerCommon, SizeClassAllocator64CompactMetadataStress) {
381366
SizeClassAllocatorMetadataStress<Allocator64Compact>();
382367
}
@@ -423,7 +408,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicGetBlockBegin) {
423408
SizeClassAllocatorGetBlockBeginStress<Allocator64Dynamic>(
424409
1ULL << (SANITIZER_ANDROID ? 31 : 33));
425410
}
426-
#if !ALLOCATOR64_SMALL_SIZE
411+
#if !SANITIZER_ANDROID
427412
TEST(SanitizerCommon, SizeClassAllocator64CompactGetBlockBegin) {
428413
SizeClassAllocatorGetBlockBeginStress<Allocator64Compact>(1ULL << 33);
429414
}
@@ -535,7 +520,7 @@ TEST(SanitizerCommon, LargeMmapAllocatorMapUnmapCallback) {
535520

536521
// Don't test OOM conditions on Win64 because it causes other tests on the same
537522
// machine to OOM.
538-
#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
523+
#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64 && !SANITIZER_ANDROID
539524
TEST(SanitizerCommon, SizeClassAllocator64Overflow) {
540525
Allocator64 a;
541526
a.Init(kReleaseToOSIntervalNever);
@@ -549,8 +534,7 @@ TEST(SanitizerCommon, SizeClassAllocator64Overflow) {
549534
uint32_t chunks[kNumChunks];
550535
bool allocation_failed = false;
551536
for (int i = 0; i < 1000000; i++) {
552-
uptr class_id = a.kNumClasses - 1;
553-
if (!a.GetFromAllocator(&stats, class_id, chunks, kNumChunks)) {
537+
if (!a.GetFromAllocator(&stats, 52, chunks, kNumChunks)) {
554538
allocation_failed = true;
555539
break;
556540
}
@@ -714,7 +698,7 @@ TEST(SanitizerCommon, CombinedAllocator64Dynamic) {
714698
TestCombinedAllocator<Allocator64Dynamic>();
715699
}
716700

717-
#if !ALLOCATOR64_SMALL_SIZE
701+
#if !SANITIZER_ANDROID
718702
TEST(SanitizerCommon, CombinedAllocator64Compact) {
719703
TestCombinedAllocator<Allocator64Compact>();
720704
}
@@ -775,7 +759,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicLocalCache) {
775759
TestSizeClassAllocatorLocalCache<Allocator64Dynamic>();
776760
}
777761

778-
#if !ALLOCATOR64_SMALL_SIZE
762+
#if !SANITIZER_ANDROID
779763
TEST(SanitizerCommon, SizeClassAllocator64CompactLocalCache) {
780764
TestSizeClassAllocatorLocalCache<Allocator64Compact>();
781765
}
@@ -1032,8 +1016,8 @@ TEST(SanitizerCommon, LargeMmapAllocatorBlockBegin) {
10321016

10331017
// Don't test OOM conditions on Win64 because it causes other tests on the same
10341018
// machine to OOM.
1035-
#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
1036-
typedef __sanitizer::SizeClassMap<2, 22, 22, 34, 128, 16> SpecialSizeClassMap;
1019+
#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64 && !SANITIZER_ANDROID
1020+
typedef __sanitizer::SizeClassMap<3, 4, 8, 38, 128, 16> SpecialSizeClassMap;
10371021
template <typename AddressSpaceViewTy = LocalAddressSpaceView>
10381022
struct AP64_SpecialSizeClassMap {
10391023
static const uptr kSpaceBeg = kAllocatorSpace;
@@ -1060,15 +1044,15 @@ TEST(SanitizerCommon, SizeClassAllocator64PopulateFreeListOOM) {
10601044
// ...one man is on a mission to overflow a region with a series of
10611045
// successive allocations.
10621046

1063-
const uptr kClassID = kAllocatorSize == ALLOCATOR64_SMALL_SIZE ? 18 : 24;
1047+
const uptr kClassID = 107;
10641048
const uptr kAllocationSize = SpecialSizeClassMap::Size(kClassID);
10651049
ASSERT_LT(2 * kAllocationSize, kRegionSize);
10661050
ASSERT_GT(3 * kAllocationSize, kRegionSize);
10671051
EXPECT_NE(cache.Allocate(a, kClassID), nullptr);
10681052
EXPECT_NE(cache.Allocate(a, kClassID), nullptr);
10691053
EXPECT_EQ(cache.Allocate(a, kClassID), nullptr);
10701054

1071-
const uptr Class2 = kAllocatorSize == ALLOCATOR64_SMALL_SIZE ? 15 : 21;
1055+
const uptr Class2 = 100;
10721056
const uptr Size2 = SpecialSizeClassMap::Size(Class2);
10731057
ASSERT_EQ(Size2 * 8, kRegionSize);
10741058
char *p[7];
@@ -1354,15 +1338,15 @@ TEST(SanitizerCommon, SizeClassAllocator64ReleaseFreeMemoryToOS) {
13541338
TestReleaseFreeMemoryToOS<Allocator64>();
13551339
}
13561340

1357-
#if !ALLOCATOR64_SMALL_SIZE
1341+
#if !SANITIZER_ANDROID
13581342
TEST(SanitizerCommon, SizeClassAllocator64CompactReleaseFreeMemoryToOS) {
13591343
TestReleaseFreeMemoryToOS<Allocator64Compact>();
13601344
}
13611345

13621346
TEST(SanitizerCommon, SizeClassAllocator64VeryCompactReleaseFreeMemoryToOS) {
13631347
TestReleaseFreeMemoryToOS<Allocator64VeryCompact>();
13641348
}
1365-
#endif // !ALLOCATOR64_SMALL_SIZE
1349+
#endif // !SANITIZER_ANDROID
13661350

13671351
#endif // SANITIZER_CAN_USE_ALLOCATOR64
13681352

0 commit comments

Comments
 (0)