diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/test-mountpoint-util.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/test/test-mountpoint-util.c b/src/test/test-mountpoint-util.c index 1f71a25859..6d784a9ae8 100644 --- a/src/test/test-mountpoint-util.c +++ b/src/test/test-mountpoint-util.c @@ -101,7 +101,7 @@ TEST(mnt_id) { * See #11505. */ assert_se(q = hashmap_get(h, INT_TO_PTR(mnt_id2))); - assert_se((r = path_is_mount_point(p, NULL, 0)) >= 0); + assert_se((r = path_is_mount_point_full(p, NULL, 0)) >= 0); if (r == 0) { /* If the path is not a mount point anymore, then it must be a sub directory of * the path corresponds to mnt_id2. */ @@ -123,20 +123,20 @@ TEST(path_is_mount_point) { _cleanup_free_ char *dir1 = NULL, *dir1file = NULL, *dirlink1 = NULL, *dirlink1file = NULL; _cleanup_free_ char *dir2 = NULL, *dir2file = NULL; - assert_se(path_is_mount_point("/", NULL, AT_SYMLINK_FOLLOW) > 0); - assert_se(path_is_mount_point("/", NULL, 0) > 0); - assert_se(path_is_mount_point("//", NULL, AT_SYMLINK_FOLLOW) > 0); - assert_se(path_is_mount_point("//", NULL, 0) > 0); + assert_se(path_is_mount_point_full("/", NULL, AT_SYMLINK_FOLLOW) > 0); + assert_se(path_is_mount_point_full("/", NULL, 0) > 0); + assert_se(path_is_mount_point_full("//", NULL, AT_SYMLINK_FOLLOW) > 0); + assert_se(path_is_mount_point_full("//", NULL, 0) > 0); - assert_se(path_is_mount_point("/proc", NULL, AT_SYMLINK_FOLLOW) > 0); - assert_se(path_is_mount_point("/proc", NULL, 0) > 0); - assert_se(path_is_mount_point("/proc/", NULL, AT_SYMLINK_FOLLOW) > 0); - assert_se(path_is_mount_point("/proc/", NULL, 0) > 0); + assert_se(path_is_mount_point_full("/proc", NULL, AT_SYMLINK_FOLLOW) > 0); + assert_se(path_is_mount_point_full("/proc", NULL, 0) > 0); + assert_se(path_is_mount_point_full("/proc/", NULL, AT_SYMLINK_FOLLOW) > 0); + assert_se(path_is_mount_point_full("/proc/", NULL, 0) > 0); - assert_se(path_is_mount_point("/proc/1", NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point("/proc/1", NULL, 0) == 0); - assert_se(path_is_mount_point("/proc/1/", NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point("/proc/1/", NULL, 0) == 0); + assert_se(path_is_mount_point_full("/proc/1", NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full("/proc/1", NULL, 0) == 0); + assert_se(path_is_mount_point_full("/proc/1/", NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full("/proc/1/", NULL, 0) == 0); /* we'll create a hierarchy of different kinds of dir/file/link * layouts: @@ -170,10 +170,10 @@ TEST(path_is_mount_point) { assert_se(link1); assert_se(symlink("file2", link2) == 0); - assert_se(path_is_mount_point(file1, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(file1, NULL, 0) == 0); - assert_se(path_is_mount_point(link1, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(link1, NULL, 0) == 0); + assert_se(path_is_mount_point_full(file1, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(file1, NULL, 0) == 0); + assert_se(path_is_mount_point_full(link1, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(link1, NULL, 0) == 0); /* directory mountpoints */ dir1 = path_join(tmp_dir, "dir1"); @@ -189,10 +189,10 @@ TEST(path_is_mount_point) { assert_se(dir2); assert_se(mkdir(dir2, 0755) == 0); - assert_se(path_is_mount_point(dir1, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(dir1, NULL, 0) == 0); - assert_se(path_is_mount_point(dirlink1, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(dirlink1, NULL, 0) == 0); + assert_se(path_is_mount_point_full(dir1, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(dir1, NULL, 0) == 0); + assert_se(path_is_mount_point_full(dirlink1, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(dirlink1, NULL, 0) == 0); /* file in subdirectory mountpoints */ dir1file = path_join(dir1, "file"); @@ -201,10 +201,10 @@ TEST(path_is_mount_point) { assert_se(fd > 0); close(fd); - assert_se(path_is_mount_point(dir1file, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(dir1file, NULL, 0) == 0); - assert_se(path_is_mount_point(dirlink1file, NULL, AT_SYMLINK_FOLLOW) == 0); - assert_se(path_is_mount_point(dirlink1file, NULL, 0) == 0); + assert_se(path_is_mount_point_full(dir1file, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(dir1file, NULL, 0) == 0); + assert_se(path_is_mount_point_full(dirlink1file, NULL, AT_SYMLINK_FOLLOW) == 0); + assert_se(path_is_mount_point_full(dirlink1file, NULL, 0) == 0); /* these tests will only work as root */ if (mount(file1, file2, NULL, MS_BIND, NULL) >= 0) { @@ -214,17 +214,17 @@ TEST(path_is_mount_point) { /* files */ /* capture results in vars, to avoid dangling mounts on failure */ log_info("%s: %s", __func__, file2); - rf = path_is_mount_point(file2, NULL, 0); - rt = path_is_mount_point(file2, NULL, AT_SYMLINK_FOLLOW); + rf = path_is_mount_point_full(file2, NULL, 0); + rt = path_is_mount_point_full(file2, NULL, AT_SYMLINK_FOLLOW); file2d = strjoina(file2, "/"); log_info("%s: %s", __func__, file2d); - rdf = path_is_mount_point(file2d, NULL, 0); - rdt = path_is_mount_point(file2d, NULL, AT_SYMLINK_FOLLOW); + rdf = path_is_mount_point_full(file2d, NULL, 0); + rdt = path_is_mount_point_full(file2d, NULL, AT_SYMLINK_FOLLOW); log_info("%s: %s", __func__, link2); - rlf = path_is_mount_point(link2, NULL, 0); - rlt = path_is_mount_point(link2, NULL, AT_SYMLINK_FOLLOW); + rlf = path_is_mount_point_full(link2, NULL, 0); + rlt = path_is_mount_point_full(link2, NULL, AT_SYMLINK_FOLLOW); assert_se(umount(file2) == 0); @@ -245,15 +245,15 @@ TEST(path_is_mount_point) { assert_se(mount(dir2, dir1, NULL, MS_BIND, NULL) >= 0); log_info("%s: %s", __func__, dir1); - rf = path_is_mount_point(dir1, NULL, 0); - rt = path_is_mount_point(dir1, NULL, AT_SYMLINK_FOLLOW); + rf = path_is_mount_point_full(dir1, NULL, 0); + rt = path_is_mount_point_full(dir1, NULL, AT_SYMLINK_FOLLOW); log_info("%s: %s", __func__, dirlink1); - rlf = path_is_mount_point(dirlink1, NULL, 0); - rlt = path_is_mount_point(dirlink1, NULL, AT_SYMLINK_FOLLOW); + rlf = path_is_mount_point_full(dirlink1, NULL, 0); + rlt = path_is_mount_point_full(dirlink1, NULL, AT_SYMLINK_FOLLOW); log_info("%s: %s", __func__, dirlink1file); /* its parent is a mount point, but not /file itself */ - rl1f = path_is_mount_point(dirlink1file, NULL, 0); - rl1t = path_is_mount_point(dirlink1file, NULL, AT_SYMLINK_FOLLOW); + rl1f = path_is_mount_point_full(dirlink1file, NULL, 0); + rl1t = path_is_mount_point_full(dirlink1file, NULL, AT_SYMLINK_FOLLOW); assert_se(umount(dir1) == 0); |