Commit bcf09e40 authored by Brian Carlstrom's avatar Brian Carlstrom Committed by Android (Google) Code Review
Browse files

Merge "Fix dumpsys meminfo for art" into klp-dev

parents 19b34565 fb2f70c7
......@@ -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;
}
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment