diff options
-rw-r--r-- | build/Android.gtest.mk | 8 | ||||
-rw-r--r-- | runtime/gc/space/dlmalloc_space_base_test.cc (renamed from runtime/gc/space/dlmalloc_space_test.cc) | 2 | ||||
-rw-r--r-- | runtime/gc/space/dlmalloc_space_random_test.cc | 34 | ||||
-rw-r--r-- | runtime/gc/space/dlmalloc_space_static_test.cc | 34 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space_base_test.cc (renamed from runtime/gc/space/rosalloc_space_test.cc) | 2 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space_random_test.cc | 34 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space_static_test.cc | 34 | ||||
-rw-r--r-- | runtime/gc/space/space_test.h | 68 |
8 files changed, 188 insertions, 28 deletions
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk index 0b0c445..1dfdc92 100644 --- a/build/Android.gtest.mk +++ b/build/Android.gtest.mk @@ -36,8 +36,12 @@ RUNTIME_GTEST_COMMON_SRC_FILES := \ runtime/exception_test.cc \ runtime/gc/accounting/space_bitmap_test.cc \ runtime/gc/heap_test.cc \ - runtime/gc/space/dlmalloc_space_test.cc \ - runtime/gc/space/rosalloc_space_test.cc \ + runtime/gc/space/dlmalloc_space_base_test.cc \ + runtime/gc/space/dlmalloc_space_static_test.cc \ + runtime/gc/space/dlmalloc_space_random_test.cc \ + runtime/gc/space/rosalloc_space_base_test.cc \ + runtime/gc/space/rosalloc_space_static_test.cc \ + runtime/gc/space/rosalloc_space_random_test.cc \ runtime/gc/space/large_object_space_test.cc \ runtime/gtest_test.cc \ runtime/indenter_test.cc \ diff --git a/runtime/gc/space/dlmalloc_space_test.cc b/runtime/gc/space/dlmalloc_space_base_test.cc index 964c31b..508d869 100644 --- a/runtime/gc/space/dlmalloc_space_test.cc +++ b/runtime/gc/space/dlmalloc_space_base_test.cc @@ -26,7 +26,7 @@ MallocSpace* CreateDlMallocSpace(const std::string& name, size_t initial_size, s return DlMallocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin); } -TEST_SPACE_CREATE_FN(DlMallocSpace, CreateDlMallocSpace) +TEST_SPACE_CREATE_FN_BASE(DlMallocSpace, CreateDlMallocSpace) } // namespace space diff --git a/runtime/gc/space/dlmalloc_space_random_test.cc b/runtime/gc/space/dlmalloc_space_random_test.cc new file mode 100644 index 0000000..43a1bf0 --- /dev/null +++ b/runtime/gc/space/dlmalloc_space_random_test.cc @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "space_test.h" +#include "dlmalloc_space.h" + +namespace art { +namespace gc { +namespace space { + +MallocSpace* CreateDlMallocSpace(const std::string& name, size_t initial_size, size_t growth_limit, + size_t capacity, byte* requested_begin) { + return DlMallocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin); +} + +TEST_SPACE_CREATE_FN_RANDOM(DlMallocSpace, CreateDlMallocSpace) + + +} // namespace space +} // namespace gc +} // namespace art diff --git a/runtime/gc/space/dlmalloc_space_static_test.cc b/runtime/gc/space/dlmalloc_space_static_test.cc new file mode 100644 index 0000000..4fbc81e --- /dev/null +++ b/runtime/gc/space/dlmalloc_space_static_test.cc @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "space_test.h" +#include "dlmalloc_space.h" + +namespace art { +namespace gc { +namespace space { + +MallocSpace* CreateDlMallocSpace(const std::string& name, size_t initial_size, size_t growth_limit, + size_t capacity, byte* requested_begin) { + return DlMallocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin); +} + +TEST_SPACE_CREATE_FN_STATIC(DlMallocSpace, CreateDlMallocSpace) + + +} // namespace space +} // namespace gc +} // namespace art diff --git a/runtime/gc/space/rosalloc_space_test.cc b/runtime/gc/space/rosalloc_space_base_test.cc index 3eac795..df42076 100644 --- a/runtime/gc/space/rosalloc_space_test.cc +++ b/runtime/gc/space/rosalloc_space_base_test.cc @@ -26,7 +26,7 @@ MallocSpace* CreateRosAllocSpace(const std::string& name, size_t initial_size, s Runtime::Current()->GetHeap()->IsLowMemoryMode()); } -TEST_SPACE_CREATE_FN(RosAllocSpace, CreateRosAllocSpace) +TEST_SPACE_CREATE_FN_BASE(RosAllocSpace, CreateRosAllocSpace) } // namespace space diff --git a/runtime/gc/space/rosalloc_space_random_test.cc b/runtime/gc/space/rosalloc_space_random_test.cc new file mode 100644 index 0000000..4d37c9e --- /dev/null +++ b/runtime/gc/space/rosalloc_space_random_test.cc @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "space_test.h" + +namespace art { +namespace gc { +namespace space { + +MallocSpace* CreateRosAllocSpace(const std::string& name, size_t initial_size, size_t growth_limit, + size_t capacity, byte* requested_begin) { + return RosAllocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin, + Runtime::Current()->GetHeap()->IsLowMemoryMode()); +} + +TEST_SPACE_CREATE_FN_RANDOM(RosAllocSpace, CreateRosAllocSpace) + + +} // namespace space +} // namespace gc +} // namespace art diff --git a/runtime/gc/space/rosalloc_space_static_test.cc b/runtime/gc/space/rosalloc_space_static_test.cc new file mode 100644 index 0000000..9f11fd0 --- /dev/null +++ b/runtime/gc/space/rosalloc_space_static_test.cc @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "space_test.h" + +namespace art { +namespace gc { +namespace space { + +MallocSpace* CreateRosAllocSpace(const std::string& name, size_t initial_size, size_t growth_limit, + size_t capacity, byte* requested_begin) { + return RosAllocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin, + Runtime::Current()->GetHeap()->IsLowMemoryMode()); +} + +TEST_SPACE_CREATE_FN_STATIC(RosAllocSpace, CreateRosAllocSpace) + + +} // namespace space +} // namespace gc +} // namespace art diff --git a/runtime/gc/space/space_test.h b/runtime/gc/space/space_test.h index cb036f8..413fc1d 100644 --- a/runtime/gc/space/space_test.h +++ b/runtime/gc/space/space_test.h @@ -539,43 +539,63 @@ void SpaceTest::SizeFootPrintGrowthLimitAndTrimDriver(size_t object_size, Create SizeFootPrintGrowthLimitAndTrimBody(space, object_size, 3, capacity); } -#define TEST_SizeFootPrintGrowthLimitAndTrim(name, spaceName, spaceFn, size) \ - TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_AllocationsOf_##name) { \ +#define TEST_SizeFootPrintGrowthLimitAndTrimStatic(name, spaceName, spaceFn, size) \ + TEST_F(spaceName##StaticTest, SizeFootPrintGrowthLimitAndTrim_AllocationsOf_##name) { \ SizeFootPrintGrowthLimitAndTrimDriver(size, spaceFn); \ - } \ - TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_RandomAllocationsWithMax_##name) { \ + } + +#define TEST_SizeFootPrintGrowthLimitAndTrimRandom(name, spaceName, spaceFn, size) \ + TEST_F(spaceName##RandomTest, SizeFootPrintGrowthLimitAndTrim_RandomAllocationsWithMax_##name) { \ SizeFootPrintGrowthLimitAndTrimDriver(-size, spaceFn); \ } -#define TEST_SPACE_CREATE_FN(spaceName, spaceFn) \ - class spaceName##Test : public SpaceTest { \ +#define TEST_SPACE_CREATE_FN_BASE(spaceName, spaceFn) \ + class spaceName##BaseTest : public SpaceTest { \ }; \ \ - TEST_F(spaceName##Test, Init) { \ + TEST_F(spaceName##BaseTest, Init) { \ InitTestBody(spaceFn); \ } \ - TEST_F(spaceName##Test, ZygoteSpace) { \ + TEST_F(spaceName##BaseTest, ZygoteSpace) { \ ZygoteSpaceTestBody(spaceFn); \ } \ - TEST_F(spaceName##Test, AllocAndFree) { \ + TEST_F(spaceName##BaseTest, AllocAndFree) { \ AllocAndFreeTestBody(spaceFn); \ } \ - TEST_F(spaceName##Test, AllocAndFreeList) { \ + TEST_F(spaceName##BaseTest, AllocAndFreeList) { \ AllocAndFreeListTestBody(spaceFn); \ - } \ - TEST_F(spaceName##Test, SizeFootPrintGrowthLimitAndTrim_AllocationsOf_12B) { \ - SizeFootPrintGrowthLimitAndTrimDriver(12, spaceFn); \ - } \ - TEST_SizeFootPrintGrowthLimitAndTrim(16B, spaceName, spaceFn, 16) \ - TEST_SizeFootPrintGrowthLimitAndTrim(24B, spaceName, spaceFn, 24) \ - TEST_SizeFootPrintGrowthLimitAndTrim(32B, spaceName, spaceFn, 32) \ - TEST_SizeFootPrintGrowthLimitAndTrim(64B, spaceName, spaceFn, 64) \ - TEST_SizeFootPrintGrowthLimitAndTrim(128B, spaceName, spaceFn, 128) \ - TEST_SizeFootPrintGrowthLimitAndTrim(1KB, spaceName, spaceFn, 1 * KB) \ - TEST_SizeFootPrintGrowthLimitAndTrim(4KB, spaceName, spaceFn, 4 * KB) \ - TEST_SizeFootPrintGrowthLimitAndTrim(1MB, spaceName, spaceFn, 1 * MB) \ - TEST_SizeFootPrintGrowthLimitAndTrim(4MB, spaceName, spaceFn, 4 * MB) \ - TEST_SizeFootPrintGrowthLimitAndTrim(8MB, spaceName, spaceFn, 8 * MB) + } + +#define TEST_SPACE_CREATE_FN_STATIC(spaceName, spaceFn) \ + class spaceName##StaticTest : public SpaceTest { \ + }; \ + \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(12B, spaceName, spaceFn, 12) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(16B, spaceName, spaceFn, 16) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(24B, spaceName, spaceFn, 24) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(32B, spaceName, spaceFn, 32) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(64B, spaceName, spaceFn, 64) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(128B, spaceName, spaceFn, 128) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(1KB, spaceName, spaceFn, 1 * KB) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(4KB, spaceName, spaceFn, 4 * KB) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(1MB, spaceName, spaceFn, 1 * MB) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(4MB, spaceName, spaceFn, 4 * MB) \ + TEST_SizeFootPrintGrowthLimitAndTrimStatic(8MB, spaceName, spaceFn, 8 * MB) + +#define TEST_SPACE_CREATE_FN_RANDOM(spaceName, spaceFn) \ + class spaceName##RandomTest : public SpaceTest { \ + }; \ + \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(16B, spaceName, spaceFn, 16) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(24B, spaceName, spaceFn, 24) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(32B, spaceName, spaceFn, 32) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(64B, spaceName, spaceFn, 64) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(128B, spaceName, spaceFn, 128) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(1KB, spaceName, spaceFn, 1 * KB) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(4KB, spaceName, spaceFn, 4 * KB) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(1MB, spaceName, spaceFn, 1 * MB) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(4MB, spaceName, spaceFn, 4 * MB) \ + TEST_SizeFootPrintGrowthLimitAndTrimRandom(8MB, spaceName, spaceFn, 8 * MB) } // namespace space } // namespace gc |