71 lines
2.4 KiB
Diff
71 lines
2.4 KiB
Diff
|
From 2e9d763e7cbeb33954bbe3f96fd94de2cd62edf7 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||
|
Date: Thu, 12 Nov 2020 14:28:24 +0100
|
||
|
Subject: [PATCH] test-path-util: do not fail if the fd_is_mount_point check
|
||
|
fails
|
||
|
|
||
|
This test fails on i686 and ppc64le in koji:
|
||
|
/* test_path */
|
||
|
Assertion 'fd_is_mount_point(fd, "/", 0) > 0' failed at src/test/test-path-util.c:85, function test_path(). Aborting.
|
||
|
|
||
|
I guess some permission error is the most likely.
|
||
|
---
|
||
|
src/test/test-path-util.c | 23 +++++++++++++++++------
|
||
|
1 file changed, 17 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
|
||
|
index f4f8d0550b..be428334f3 100644
|
||
|
--- a/src/test/test-path-util.c
|
||
|
+++ b/src/test/test-path-util.c
|
||
|
@@ -40,8 +40,6 @@ static void test_path_simplify(const char *in, const char *out, const char *out_
|
||
|
}
|
||
|
|
||
|
static void test_path(void) {
|
||
|
- _cleanup_close_ int fd = -1;
|
||
|
-
|
||
|
log_info("/* %s */", __func__);
|
||
|
|
||
|
test_path_compare("/goo", "/goo", 0);
|
||
|
@@ -80,10 +78,6 @@ static void test_path(void) {
|
||
|
assert_se(streq(basename("/aa///file..."), "file..."));
|
||
|
assert_se(streq(basename("file.../"), ""));
|
||
|
|
||
|
- fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY);
|
||
|
- assert_se(fd >= 0);
|
||
|
- assert_se(fd_is_mount_point(fd, "/", 0) > 0);
|
||
|
-
|
||
|
test_path_simplify("aaa/bbb////ccc", "aaa/bbb/ccc", "aaa/bbb/ccc");
|
||
|
test_path_simplify("//aaa/.////ccc", "/aaa/./ccc", "/aaa/ccc");
|
||
|
test_path_simplify("///", "/", "/");
|
||
|
@@ -120,6 +114,22 @@ static void test_path(void) {
|
||
|
assert_se(!path_equal_ptr(NULL, "/a"));
|
||
|
}
|
||
|
|
||
|
+static void test_path_is_mountpoint(void) {
|
||
|
+ _cleanup_close_ int fd = -1;
|
||
|
+ int r;
|
||
|
+
|
||
|
+ log_info("/* %s */", __func__);
|
||
|
+
|
||
|
+ fd = open("/", O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY);
|
||
|
+ assert_se(fd >= 0);
|
||
|
+
|
||
|
+ r = fd_is_mount_point(fd, "/", 0);
|
||
|
+ if (r < 0)
|
||
|
+ log_warning_errno(r, "Failed to check if / is a mount point, ignoring: %m");
|
||
|
+ else
|
||
|
+ assert_se(r == 1);
|
||
|
+}
|
||
|
+
|
||
|
static void test_path_equal_root(void) {
|
||
|
/* Nail down the details of how path_equal("/", ...) works. */
|
||
|
|
||
|
@@ -714,6 +724,7 @@ int main(int argc, char **argv) {
|
||
|
|
||
|
test_print_paths();
|
||
|
test_path();
|
||
|
+ test_path_is_mountpoint();
|
||
|
test_path_equal_root();
|
||
|
test_find_executable_full();
|
||
|
test_find_executable(argv[0]);
|