Add dex2oat support for profile based image creation
Allow creating a boot image with only a profile without requiring
any of --compiled-classes, --compiled-methods, or --image-classes.
To do so, you need to pass --profile-file and
--compiler-filter=speed-profile.
Added a test dex2oat_image_test to verify behavior. This test covers:
--compiled-classes
--compiled-methods
--image-classes
--profile-file
Test: test-art-host-gtest-dex2oat_image_test
Bug: 37966211
Change-Id: I36d41b1c6e6560e6b3494b1df7024a4450ed0c0e
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index 5a4a26a..930bcff 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -461,7 +461,7 @@
runtime_->GetHeap()->SetMinIntervalHomogeneousSpaceCompactionByOom(0U);
}
-void CommonRuntimeTestImpl::ClearDirectory(const char* dirpath) {
+void CommonRuntimeTestImpl::ClearDirectory(const char* dirpath, bool recursive) {
ASSERT_TRUE(dirpath != nullptr);
DIR* dir = opendir(dirpath);
ASSERT_TRUE(dir != nullptr);
@@ -477,9 +477,11 @@
int stat_result = lstat(filename.c_str(), &s);
ASSERT_EQ(0, stat_result) << "unable to stat " << filename;
if (S_ISDIR(s.st_mode)) {
- ClearDirectory(filename.c_str());
- int rmdir_result = rmdir(filename.c_str());
- ASSERT_EQ(0, rmdir_result) << filename;
+ if (recursive) {
+ ClearDirectory(filename.c_str());
+ int rmdir_result = rmdir(filename.c_str());
+ ASSERT_EQ(0, rmdir_result) << filename;
+ }
} else {
int unlink_result = unlink(filename.c_str());
ASSERT_EQ(0, unlink_result) << filename;