summaryrefslogtreecommitdiffstats
path: root/cmds/installd/tests
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-04-07 18:14:05 -0700
committerJeff Sharkey <jsharkey@android.com>2015-04-07 20:13:27 -0700
commitc03de09173f98506e73e7cf7df21fe11795d4b24 (patch)
tree52f975303151eb1319acdb7a6a03c3d0042d0c2a /cmds/installd/tests
parent00afb8177fdbf144c75c00e9eacc915589807d35 (diff)
downloadframeworks_native-c03de09173f98506e73e7cf7df21fe11795d4b24.zip
frameworks_native-c03de09173f98506e73e7cf7df21fe11795d4b24.tar.gz
frameworks_native-c03de09173f98506e73e7cf7df21fe11795d4b24.tar.bz2
Plumb through volume UUID when building paths.
Since app data paths can live on expanded storage devices, accept the target volume UUID when building paths. The null UUID indicates the default internal storage. To improve readability, start using std::string in several places, which throws when allocations fail. For now, perform last-second sanity checks on incoming path arguments, but we'll eventually want to check arguments as they come through installd.cpp, instead of crashing the entire daemon. Also remove "lib" symlink code from install() and make_user_data(), since we're no longer supporting /data/app-lib. The framework already uses linklib() to create the right symlink for the selected ISA-specific library dir. Bug: 19993667 Change-Id: Ib9343575ffb62bf3981e19375de8f3822fc31e28
Diffstat (limited to 'cmds/installd/tests')
-rw-r--r--cmds/installd/tests/Android.mk1
-rw-r--r--cmds/installd/tests/installd_utils_test.cpp25
2 files changed, 12 insertions, 14 deletions
diff --git a/cmds/installd/tests/Android.mk b/cmds/installd/tests/Android.mk
index 7300b29..c16375a 100644
--- a/cmds/installd/tests/Android.mk
+++ b/cmds/installd/tests/Android.mk
@@ -8,6 +8,7 @@ test_src_files := \
installd_utils_test.cpp
shared_libraries := \
+ libbase \
libutils \
libcutils \
diff --git a/cmds/installd/tests/installd_utils_test.cpp b/cmds/installd/tests/installd_utils_test.cpp
index 68d150b..ebf7053 100644
--- a/cmds/installd/tests/installd_utils_test.cpp
+++ b/cmds/installd/tests/installd_utils_test.cpp
@@ -321,6 +321,7 @@ TEST_F(UtilsTest, CreatePkgPath_LongPkgNameSuccess) {
const char *prefix = TEST_DATA_DIR PRIMARY_USER_PREFIX;
size_t offset = strlen(prefix);
+
EXPECT_STREQ(pkgname, path + offset)
<< "Package path should be a really long string of a's";
}
@@ -371,20 +372,6 @@ TEST_F(UtilsTest, CreatePkgPath_SecondaryUser) {
<< "Package path should be in /data/user/";
}
-TEST_F(UtilsTest, CreatePkgPathInDir_ProtectedDir) {
- char path[PKG_PATH_MAX];
-
- dir_rec_t dir;
- dir.path = (char*) "/data/app-private/";
- dir.len = strlen(dir.path);
-
- EXPECT_EQ(0, create_pkg_path_in_dir(path, &dir, "com.example.package", ".apk"))
- << "Should successfully create package path.";
-
- EXPECT_STREQ("/data/app-private/com.example.package.apk", path)
- << "Package path should be in /data/app-private/";
-}
-
TEST_F(UtilsTest, CreatePersonaPath_Primary) {
char path[PKG_PATH_MAX];
@@ -482,4 +469,14 @@ TEST_F(UtilsTest, AppendAndIncrement_TooBig) {
<< "String should fail because it's too large to fit";
}
+TEST_F(UtilsTest, CreatePackageDataPath) {
+ EXPECT_EQ("/data/data/com.example", create_package_data_path(nullptr, "com.example", 0));
+ EXPECT_EQ("/data/user/10/com.example", create_package_data_path(nullptr, "com.example", 10));
+
+ EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/0/com.example",
+ create_package_data_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", "com.example", 0));
+ EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/10/com.example",
+ create_package_data_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", "com.example", 10));
+}
+
}