summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-10-16 14:37:22 -0700
committerBrian Carlstrom <bdc@google.com>2013-10-16 14:37:22 -0700
commitfb2f70c7678d33c2027cdd0285d8b5421876e6aa (patch)
tree9921dfc4dfd4ce66be2a9a34358b5d8db1d3e589
parent31b9d6644cce958ddde939e8c26a08e3f704e3df (diff)
downloadart-fb2f70c7678d33c2027cdd0285d8b5421876e6aa.tar.gz
art-fb2f70c7678d33c2027cdd0285d8b5421876e6aa.tar.bz2
art-fb2f70c7678d33c2027cdd0285d8b5421876e6aa.zip
Fix dumpsys meminfo for art
Bug: 10112253 Change-Id: I56fd1318d3f7118a4e602afee8494af9730a8b5b
-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