summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/utils.cc9
-rw-r--r--runtime/utils.h4
-rw-r--r--runtime/utils_test.cc30
3 files changed, 18 insertions, 25 deletions
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 8ab8cd2814..b676ae5ae5 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -1115,15 +1115,6 @@ bool GetDalvikCacheFilename(const char* location, const char* cache_location,
return true;
}
-std::string GetDalvikCacheFilenameOrDie(const char* location, const char* cache_location) {
- std::string ret;
- std::string error_msg;
- if (!GetDalvikCacheFilename(location, cache_location, &ret, &error_msg)) {
- LOG(FATAL) << error_msg;
- }
- return ret;
-}
-
static void InsertIsaDirectory(const InstructionSet isa, std::string* filename) {
// in = /foo/bar/baz
// out = /foo/bar/<isa>/baz
diff --git a/runtime/utils.h b/runtime/utils.h
index fd1ba23573..84079e2fb2 100644
--- a/runtime/utils.h
+++ b/runtime/utils.h
@@ -264,10 +264,6 @@ void GetDalvikCache(const char* subdir, bool create_if_absent, std::string* dalv
// rooted at cache_location.
bool GetDalvikCacheFilename(const char* file_location, const char* cache_location,
std::string* filename, std::string* error_msg);
-// Returns the absolute dalvik-cache path for a DexFile or OatFile, or
-// dies trying. The path returned will be rooted at cache_location.
-std::string GetDalvikCacheFilenameOrDie(const char* file_location,
- const char* cache_location);
// Returns the system location for an image
std::string GetSystemImageFilename(const char* location, InstructionSet isa);
diff --git a/runtime/utils_test.cc b/runtime/utils_test.cc
index d2100d16d4..0a01cdb4ec 100644
--- a/runtime/utils_test.cc
+++ b/runtime/utils_test.cc
@@ -322,18 +322,24 @@ TEST_F(UtilsTest, EndsWith) {
EXPECT_FALSE(EndsWith("oo", "foo"));
}
-TEST_F(UtilsTest, GetDalvikCacheFilenameOrDie) {
- EXPECT_STREQ("/foo/system@app@Foo.apk@classes.dex",
- GetDalvikCacheFilenameOrDie("/system/app/Foo.apk", "/foo").c_str());
-
- EXPECT_STREQ("/foo/data@app@foo-1.apk@classes.dex",
- GetDalvikCacheFilenameOrDie("/data/app/foo-1.apk", "/foo").c_str());
- EXPECT_STREQ("/foo/system@framework@core.jar@classes.dex",
- GetDalvikCacheFilenameOrDie("/system/framework/core.jar", "/foo").c_str());
- EXPECT_STREQ("/foo/system@framework@boot.art",
- GetDalvikCacheFilenameOrDie("/system/framework/boot.art", "/foo").c_str());
- EXPECT_STREQ("/foo/system@framework@boot.oat",
- GetDalvikCacheFilenameOrDie("/system/framework/boot.oat", "/foo").c_str());
+TEST_F(UtilsTest, GetDalvikCacheFilename) {
+ std::string name;
+ std::string error;
+
+ EXPECT_TRUE(GetDalvikCacheFilename("/system/app/Foo.apk", "/foo", &name, &error)) << error;
+ EXPECT_EQ("/foo/system@app@Foo.apk@classes.dex", name);
+
+ EXPECT_TRUE(GetDalvikCacheFilename("/data/app/foo-1.apk", "/foo", &name, &error)) << error;
+ EXPECT_EQ("/foo/data@app@foo-1.apk@classes.dex", name);
+
+ EXPECT_TRUE(GetDalvikCacheFilename("/system/framework/core.jar", "/foo", &name, &error)) << error;
+ EXPECT_EQ("/foo/system@framework@core.jar@classes.dex", name);
+
+ EXPECT_TRUE(GetDalvikCacheFilename("/system/framework/boot.art", "/foo", &name, &error)) << error;
+ EXPECT_EQ("/foo/system@framework@boot.art", name);
+
+ EXPECT_TRUE(GetDalvikCacheFilename("/system/framework/boot.oat", "/foo", &name, &error)) << error;
+ EXPECT_EQ("/foo/system@framework@boot.oat", name);
}
TEST_F(UtilsTest, GetDalvikCache) {