Further split of the space tests
Split the random-size allocations from the static-size allocation tests
Have all tests have distinguished names
Bug: 13117676
Change-Id: I40130b04d11715b9bd1d1ea8d76720f83af6ba82
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/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
similarity index 94%
rename from runtime/gc/space/dlmalloc_space_test.cc
rename to 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 @@
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_test.cc b/runtime/gc/space/dlmalloc_space_random_test.cc
similarity index 93%
copy from runtime/gc/space/dlmalloc_space_test.cc
copy to runtime/gc/space/dlmalloc_space_random_test.cc
index 964c31b..43a1bf0 100644
--- a/runtime/gc/space/dlmalloc_space_test.cc
+++ b/runtime/gc/space/dlmalloc_space_random_test.cc
@@ -26,7 +26,7 @@
return DlMallocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin);
}
-TEST_SPACE_CREATE_FN(DlMallocSpace, CreateDlMallocSpace)
+TEST_SPACE_CREATE_FN_RANDOM(DlMallocSpace, CreateDlMallocSpace)
} // namespace space
diff --git a/runtime/gc/space/dlmalloc_space_test.cc b/runtime/gc/space/dlmalloc_space_static_test.cc
similarity index 93%
copy from runtime/gc/space/dlmalloc_space_test.cc
copy to runtime/gc/space/dlmalloc_space_static_test.cc
index 964c31b..4fbc81e 100644
--- a/runtime/gc/space/dlmalloc_space_test.cc
+++ b/runtime/gc/space/dlmalloc_space_static_test.cc
@@ -26,7 +26,7 @@
return DlMallocSpace::Create(name, initial_size, growth_limit, capacity, requested_begin);
}
-TEST_SPACE_CREATE_FN(DlMallocSpace, CreateDlMallocSpace)
+TEST_SPACE_CREATE_FN_STATIC(DlMallocSpace, CreateDlMallocSpace)
} // namespace space
diff --git a/runtime/gc/space/rosalloc_space_test.cc b/runtime/gc/space/rosalloc_space_base_test.cc
similarity index 94%
copy from runtime/gc/space/rosalloc_space_test.cc
copy to 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 @@
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_test.cc b/runtime/gc/space/rosalloc_space_random_test.cc
similarity index 94%
copy from runtime/gc/space/rosalloc_space_test.cc
copy to runtime/gc/space/rosalloc_space_random_test.cc
index 3eac795..4d37c9e 100644
--- a/runtime/gc/space/rosalloc_space_test.cc
+++ b/runtime/gc/space/rosalloc_space_random_test.cc
@@ -26,7 +26,7 @@
Runtime::Current()->GetHeap()->IsLowMemoryMode());
}
-TEST_SPACE_CREATE_FN(RosAllocSpace, CreateRosAllocSpace)
+TEST_SPACE_CREATE_FN_RANDOM(RosAllocSpace, CreateRosAllocSpace)
} // namespace space
diff --git a/runtime/gc/space/rosalloc_space_test.cc b/runtime/gc/space/rosalloc_space_static_test.cc
similarity index 94%
rename from runtime/gc/space/rosalloc_space_test.cc
rename to runtime/gc/space/rosalloc_space_static_test.cc
index 3eac795..9f11fd0 100644
--- a/runtime/gc/space/rosalloc_space_test.cc
+++ b/runtime/gc/space/rosalloc_space_static_test.cc
@@ -26,7 +26,7 @@
Runtime::Current()->GetHeap()->IsLowMemoryMode());
}
-TEST_SPACE_CREATE_FN(RosAllocSpace, CreateRosAllocSpace)
+TEST_SPACE_CREATE_FN_STATIC(RosAllocSpace, CreateRosAllocSpace)
} // namespace space
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 @@
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