summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-07-25 16:38:52 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-07-25 16:38:52 +0200
commite3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3 (patch)
treecff74e879b13d5d0f7478ac14645ab68efa23b4f /tests
parentMerge "roots.cpp: Reformatting the file." am: ac70ffcc85 am: 922a310d36 am: bba1e66f74 (diff)
parentMerge "otautil: Delete dirUnlinkHierarchy()." am: 031661d4a9 am: 993cec5cc9 (diff)
downloadandroid_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar.gz
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar.bz2
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar.lz
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar.xz
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.tar.zst
android_bootable_recovery-e3134ff774e6d35bb84f8f40ca3d64e2eef6a0e3.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/dirutil_test.cpp32
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/unit/dirutil_test.cpp b/tests/unit/dirutil_test.cpp
index 5e2ae4fb5..e62032c68 100644
--- a/tests/unit/dirutil_test.cpp
+++ b/tests/unit/dirutil_test.cpp
@@ -116,35 +116,3 @@ TEST(DirUtilTest, create_mode_and_timestamp) {
ASSERT_EQ(0, rmdir((prefix + "/a/b").c_str()));
ASSERT_EQ(0, rmdir((prefix + "/a").c_str()));
}
-
-TEST(DirUtilTest, unlink_invalid) {
- // File doesn't exist.
- ASSERT_EQ(-1, dirUnlinkHierarchy("doesntexist"));
-
- // Nonexistent directory.
- TemporaryDir td;
- std::string path(td.path);
- ASSERT_EQ(-1, dirUnlinkHierarchy((path + "/a").c_str()));
- ASSERT_EQ(ENOENT, errno);
-}
-
-TEST(DirUtilTest, unlink_smoke) {
- // Unlink a file.
- TemporaryFile tf;
- ASSERT_EQ(0, dirUnlinkHierarchy(tf.path));
- ASSERT_EQ(-1, access(tf.path, F_OK));
-
- TemporaryDir td;
- std::string path(td.path);
- constexpr mode_t mode = 0700;
- ASSERT_EQ(0, mkdir((path + "/a").c_str(), mode));
- ASSERT_EQ(0, mkdir((path + "/a/b").c_str(), mode));
- ASSERT_EQ(0, mkdir((path + "/a/b/c").c_str(), mode));
- ASSERT_EQ(0, mkdir((path + "/a/d").c_str(), mode));
-
- // Remove "../a" recursively.
- ASSERT_EQ(0, dirUnlinkHierarchy((path + "/a").c_str()));
-
- // Verify it's gone.
- ASSERT_EQ(-1, access((path + "/a").c_str(), F_OK));
-}