summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2013-10-17 13:51:25 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2013-10-17 13:51:25 -0700
commit3728f41c7f22e825a58821a6b90b3b3820ab6686 (patch)
treec43b57318518011636ed436aadbd691bd4f323e5
parent47698d990b43189ed63810348432dc540b7285f5 (diff)
parentbcf09e40f1b5edb7c7e90a96efadba5482b13551 (diff)
am bcf09e40: Merge "Fix dumpsys meminfo for art" into klp-dev
* commit 'bcf09e40f1b5edb7c7e90a96efadba5482b13551': Fix dumpsys meminfo for art
-rw-r--r--runtime/utils.cc2
-rw-r--r--runtime/utils_test.cc14
2 files changed, 15 insertions, 1 deletions
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 8e810a7663..bf36bf3e85 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -1196,7 +1196,7 @@ std::string GetDalvikCacheFilenameOrDie(const std::string& location) {
LOG(FATAL) << "Expected path in location to be absolute: "<< location;
}
std::string cache_file(location, 1); // skip leading slash
- if (!EndsWith(location, ".dex") || !EndsWith(location, ".art")) {
+ if (!EndsWith(location, ".dex") && !EndsWith(location, ".art")) {
cache_file += "/";
cache_file += DexFile::kClassesDex;
}
diff --git a/runtime/utils_test.cc b/runtime/utils_test.cc
index 2633964b57..b43177b4fd 100644
--- a/runtime/utils_test.cc
+++ b/runtime/utils_test.cc
@@ -335,4 +335,18 @@ TEST_F(UtilsTest, EndsWith) {
EXPECT_FALSE(EndsWith("oo", "foo"));
}
+void CheckGetDalvikCacheFilenameOrDie(const char* in, const char* out) {
+ std::string expected(getenv("ANDROID_DATA"));
+ expected += "/dalvik-cache/";
+ expected += out;
+ EXPECT_STREQ(expected.c_str(), GetDalvikCacheFilenameOrDie(in).c_str());
+}
+
+TEST_F(UtilsTest, GetDalvikCacheFilenameOrDie) {
+ CheckGetDalvikCacheFilenameOrDie("/system/app/Foo.apk", "system@app@Foo.apk@classes.dex");
+ CheckGetDalvikCacheFilenameOrDie("/data/app/foo-1.apk", "data@app@foo-1.apk@classes.dex");
+ CheckGetDalvikCacheFilenameOrDie("/system/framework/core.jar", "system@framework@core.jar@classes.dex");
+ CheckGetDalvikCacheFilenameOrDie("/system/framework/boot.art", "system@framework@boot.art");
+}
+
} // namespace art