diff --git a/src/test/test-blockdev-util.c b/src/test/test-blockdev-util.c index b97783b41f..134386c3f6 100644 --- a/src/test/test-blockdev-util.c +++ b/src/test/test-blockdev-util.c @@ -8,12 +8,14 @@ static void test_path_is_encrypted_one(const char *p, int expect) { int r; r = path_is_encrypted(p); - if (r == -ENOENT || ERRNO_IS_NEG_PRIVILEGE(r)) + if (IN_SET(r, -ENOENT, -ELOOP) || ERRNO_IS_NEG_PRIVILEGE(r)) /* This might fail, if btrfs is used and we run in a container. In that case we cannot * resolve the device node paths that BTRFS_IOC_DEV_INFO returns, because the device nodes * are unlikely to exist in the container. But if we can't stat() them we cannot determine * the dev_t of them, and thus cannot figure out if they are encrypted. Hence let's just - * ignore ENOENT here. Also skip the test if we lack privileges. */ + * ignore ENOENT here. Also skip the test if we lack privileges. + * ELOOP might happen if the mount point is a symlink, as seen with under + * some rpm-ostree distros */ return; assert_se(r >= 0); diff --git a/test/test-fstab-generator.sh b/test/test-fstab-generator.sh index 50ba321b9c..af8fa7c226 100755 --- a/test/test-fstab-generator.sh +++ b/test/test-fstab-generator.sh @@ -128,6 +128,14 @@ test_one() ( ) for f in "$src"/test-*.input; do + # If /mnt is a symlink, then the expected output from this + # test scenario will not match the actual output + if test "$f" = "$src/test-18-options.fstab.input" -a "$(readlink /mnt)" != "/mnt" + then + echo "Skip $f because /mnt is a symlink" + continue + fi + test_one "$f" yes test_one "$f" no done diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py index 77ef53b983..37a5e9ef3e 100755 --- a/test/test-systemd-tmpfiles.py +++ b/test/test-systemd-tmpfiles.py @@ -31,6 +31,14 @@ except AttributeError: exe_with_args = sys.argv[1:] temp_dir = tempfile.TemporaryDirectory(prefix='test-systemd-tmpfiles.') +# If /tmp isn't owned by either 'root' or the current user +# systemd-tmpfiles will exit with "Detected unsafe path transition" +# breaking this test +tmpowner = os.stat("/tmp").st_uid +if tmpowner != 0 and tmpowner != os.getuid(): + print("Skip: /tmp is not owned by 'root' or current user") + sys.exit(EXIT_TEST_SKIP) + def test_line(line, *, user, returncode=EX_DATAERR, extra={}): args = ['--user'] if user else [] print('Running {} on {!r}'.format(' '.join(exe_with_args + args), line))